-
Notifications
You must be signed in to change notification settings - Fork 9
/
introduce.txt
93 lines (68 loc) · 3.02 KB
/
introduce.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>XmlCodeGeneartor</h1>
<p>
<br /><div style='font-size: 12pt; font-family: Malgun Gothic, Consolas; color: #2211AA; text-align: left; font-weight: bold'>Introduce</div>
C#/VB.NET code can be generated by XML + XSLT.
<br /><div style='font-size: 12pt; font-family: Malgun Gothic, Consolas; color: #2211AA; text-align: left; font-weight: bold'>What's New</div>
V 1.0: Initial checked-in.
<br /><div style='font-size: 12pt; font-family: Malgun Gothic, Consolas; color: #2211AA; text-align: left; font-weight: bold'>How to use</div>
1. Create your own XML file in your project. For example,
<pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' >
<IFs>
<DOIT condition="1" />
<DOIT condition="2" />
<DOIT condition="3" />
<DOIT condition="4" />
<DOIT condition="5" />
</IFs>
</pre>
2. Create your own XSLT file in the same directory of XML. You can write XSLT to produce source codes on XML. For example,
<pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' >
<?xml version="1.0" encoding="UTF-8" ?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<output method="text" encoding="utf-8" indent="yes"></output>
<template match="IFs">
using System;
using System.Collections.Generic;
using System.Text;
namespace macroTest
{
public partial class Test
{
private void DoIt(int condition)
{
<apply-templates select="//DOIT"></apply-templates>
}
}
}
</template>
<template match="//DOIT">
if (condition == <value-of select="@condition"/>)
{
funcName_<value-of select="@condition"/>();
}
</template>
</stylesheet>
</pre>
3. Finally, select Xml file and type 'XmlCodeGenerator' on 'Custom Tool' in properties.
<img alt='http://res.sysnet.pe.kr/sysnetimages/xml_xslt.png' src='/SysWebRes/bbs/http://res.sysnet.pe.kr/sysnetimages/xml_xslt.png' />
4. Now, whenever you save xml file, [xml-filename].cs file will be generated by combining with XSLT. For example,
<pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' >
using System;
using System.Collections.Generic;
using System.Text;dafdas
namespace macroTest
{
public partial class Test
{
private void DoIt(int condition)
{
if (condition == 1)
{
funcName_1();
}
// .........[repeat]..........
}
}
}
</pre>
</p>