annotate xslt/generator.csharp.xsl @ 4:d240adc2ac70

sync
author cin
date Thu, 01 Mar 2018 16:53:23 +0300
parents 437127ab6a12
children 6f67d3a6b950
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
2 <xsl:stylesheet version="1.0"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://implab.org/schemas/data-model.v1.xsd"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
4 xmlns:clr="http://implab.org/schemas/data-model/dotnet.v1.xsd"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
5 xmlns:cs="http://implab.org/schemas/code-dom/csharp.v1.xsd" xmlns:sql="http://implab.org/schemas/data-model/sql.v1.xsd"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
6 xmlns:t="http://implab.org/schemas/temp" xmlns:exsl="http://exslt.org/common"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
7 exclude-result-prefixes="clr m xsl exsl sql">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
8 <xsl:import href="model.xsl"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
9
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
10 <xsl:output method="xml" indent="yes" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
11
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
12 <!-- generate code for primary package -->
437127ab6a12 non-working version
cin
parents: 2
diff changeset
13 <xsl:template match="m:package[@primary='true' and @clr:namespace]" mode="document">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
14 <cs:namespace name="{@clr:namespace}">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
15 <xsl:apply-templates mode="document" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
16 </cs:namespace>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
17 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
18
437127ab6a12 non-working version
cin
parents: 2
diff changeset
19 <xsl:template match="m:package[@primary='true']" mode="document">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
20 <xsl:apply-templates mode="document" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
21 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
22
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
23 <!-- entity -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
24 <xsl:template match="m:entity" mode="document">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
25 <xsl:apply-templates select="." mode="entity"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
26 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
27
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
28 <xsl:template match="m:entity" mode="entity">
4
cin
parents: 3
diff changeset
29 <xsl:variable name="members">
cin
parents: 3
diff changeset
30 <xsl:apply-templates mode="fiter-members"/>
cin
parents: 3
diff changeset
31 </xsl:variable>
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
32 <cs:class modifiers="partial">
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
33 <xsl:attribute name="name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
34 <xsl:apply-templates select="." mode="class-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
35 </xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
36 <xsl:apply-templates mode="class-attributes" />
4
cin
parents: 3
diff changeset
37 <xsl:apply-templates select="exsl:node-set($members)" mode="members" />
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
38 </cs:class>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
39 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
40
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
41 <!-- class-name -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
42 <xsl:template match="*[@name]" mode="class-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
43 <xsl:value-of select="@name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
44 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
45
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
46 <xsl:template match="*[@clr:name]" mode="class-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
47 <xsl:value-of select="@clr:name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
48 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
49
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
50 <!-- class-attributes -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
51 <xsl:template match="*|text()" mode="class-attributes" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
52
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
53 <xsl:template match="sql:table" mode="class-attributes">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
54 <cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
55 <cs:type name="Table" namespace="Linq2Db" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
56 <cs:parameter><cs:string text="{@name}"/></cs:parameter>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
57 </cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
58 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
59
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
60 <!-- generate members -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
61
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
62 <xsl:template match="*|text()" mode="members" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
63
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
64 <xsl:template match="m:primaryKey | m:property | m:thisKey | clr:association" mode="members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
65 <t:trace msg="{name()} {@name}"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
66 <xsl:apply-templates select="." mode="property"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
67 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
68
4
cin
parents: 3
diff changeset
69 <xsl:template match="m:thisKey" mode="members">
cin
parents: 3
diff changeset
70 <xsl:variable name="properties">
cin
parents: 3
diff changeset
71
cin
parents: 3
diff changeset
72 </xsl:variable>
cin
parents: 3
diff changeset
73 </xsl:template>
cin
parents: 3
diff changeset
74
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
75 <!-- hasA and hasMany doesn't generate members itself, they delegate this work to inner members -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
76 <xsl:template match="m:hasA | m:hasMany" mode="members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
77 <t:trace msg="{name()} {@name}" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
78 <xsl:apply-templates mode="members" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
79 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
80
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
81 <xsl:template match="m:hasA/clr:lazy" mode="members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
82 <xsl:apply-templates select="." mode="field"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
83 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
84
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
85 <!-- member-name -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
86 <xsl:template match="*|text()|@*" mode="member-name" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
87
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
88 <xsl:template match="*[@name]" mode="member-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
89 <xsl:value-of select="@name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
90 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
91 <xsl:template match="*[@clr:name]" mode="member-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
92 <xsl:value-of select="@clr:name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
93 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
94
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
95 <!-- member-type -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
96 <xsl:template match="*|text()|@*" mode="member-type" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
97
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
98 <xsl:template match="*[@type]" mode="member-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
99 <xsl:call-template name="getClrType">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
100 <xsl:with-param name="type" select="@type" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
101 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
102 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
103
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
104 <xsl:template match="*[clr:type]" mode="member-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
105 <xsl:apply-templates select="clr:type" mode="clr-type" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
106 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
107
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
108 <!-- member-attributes -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
109 <xsl:template match="*|text()" mode="member-attributes"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
110
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
111 <!-- member-extension -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
112 <xsl:template match="*|text()" mode="member-extension"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
113 <xsl:template match="*" mode="member-extension">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
114 <xsl:apply-templates mode="member-extension-comments"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
115 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
116
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
117 <xsl:template match="m:hasA/* | m:hasMany/*" mode="member-extension">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
118 <xsl:variable name="comments" select="../m:description | m:description"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
119 <xsl:apply-templates select="$comments[position() = count($comments)]" mode="member-extension-comments"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
120 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
121
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
122 <!-- member-extension-comments -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
123 <xsl:template match="*|text()" mode="member-extension-comments"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
124
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
125 <xsl:template match="m:description" mode="member-extension-comments">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
126 <cs:comments>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
127 <xsl:apply-templates mode="comments" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
128 </cs:comments>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
129 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
130
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
131 <!-- property -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
132
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
133 <xsl:template match="*" mode="property">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
134 <cs:property modifiers="public">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
135 <xsl:attribute name="name"><xsl:apply-templates select="." mode="property-name"/></xsl:attribute>
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
136 <xsl:attribute name="modifiers"><xsl:apply-templates select="." mode="property-modifiers"/></xsl:attribute>
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
137 <xsl:apply-templates select="." mode="property-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
138 <xsl:apply-templates select="." mode="property-attributes"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
139 <xsl:apply-templates select="." mode="property-extension" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
140 <xsl:apply-templates select="." mode="property-accessors"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
141 </cs:property>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
142 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
143
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
144 <!-- property-name -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
145 <xsl:template match="m:hasA/clr:association[not(@name|@clr:name)]" mode="property-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
146 <!-- if the association doesn't define a name, use it from the parent node -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
147 <xsl:apply-templates select=".." mode="property-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
148 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
149 <xsl:template match="m:hasMany/clr:association[not(@name|@clr:name)]" mode="property-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
150 <!-- if the association doesn't define a name, use it from the parent node -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
151 <xsl:apply-templates select=".." mode="property-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
152 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
153
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
154 <xsl:template match="*" mode="property-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
155 <xsl:apply-templates select="." mode="member-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
156 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
157
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
158 <!-- property-modifiers -->
437127ab6a12 non-working version
cin
parents: 2
diff changeset
159 <xsl:template match="*" mode="property-modifiers">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
160 <xsl:text>public</xsl:text>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
161 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
162
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
163 <!-- property-type -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
164 <xsl:template match="m:hasA[@type]/clr:association[not(clr:type)]" mode="property-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
165 <xsl:apply-templates select=".." mode="property-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
166 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
167
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
168 <xsl:template match="m:hasMany[@type]/clr:association[not(clr:type)]" mode="property-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
169 <cs:array>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
170 <xsl:apply-templates select=".." mode="property-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
171 </cs:array>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
172 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
173
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
174 <xsl:template match="m:hasA[@type]/m:thisKey" mode="property-type">
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
175 <xsl:call-template name="getPrimaryKey">
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
176 <xsl:with-param name="type" select="../@type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
177 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
178 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
179
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
180 <xsl:template match="m:hasA[@type and boolean(@optional)]/m:thisKey" mode="property-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
181 <cs:nullable>
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
182 <xsl:call-template name="getPrimaryKey">
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
183 <xsl:with-param name="type" select="../@type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
184 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
185 </cs:nullable>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
186 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
187
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
188 <xsl:template match="*" mode="property-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
189 <xsl:apply-templates select="." mode="member-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
190 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
191
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
192 <!-- property-attributes -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
193 <xsl:template match="m:primaryKey" mode="property-attributes">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
194 <cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
195 <cs:type name="PrimaryKey" namespace="Linq2Db" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
196 </cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
197 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
198
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
199 <xsl:template match="m:hasA/clr:association" mode="property-attributes">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
200 <cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
201 <cs:type name="Association" namespace="Linq2Db"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
202 <cs:parameter name="thisKey">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
203 <cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
204 <xsl:call-template name="getMember">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
205 <xsl:with-param name="memberName" select="../@name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
206 <xsl:with-param name="explicitMemberName" select="@thisKey"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
207 <xsl:with-param name="type" select="../../@name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
208 <xsl:with-param name="short" select="true()"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
209 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
210 </cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
211 </cs:parameter>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
212 <cs:parameter name="otherKey">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
213 <cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
214 <xsl:call-template name="getKeyMember">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
215 <xsl:with-param name="explicitMemberName" select="@thisKey"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
216 <xsl:with-param name="type" select="../@type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
217 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
218 </cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
219 </cs:parameter>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
220 </cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
221 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
222
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
223 <xsl:template match="m:hasMany/clr:association" mode="property-attributes">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
224 <cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
225 <cs:type name="Association" namespace="Linq2Db"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
226 <!-- thisKey points to own primaryKey which may be inherited, using getKeyName to address such cases -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
227 <cs:parameter name="thisKey">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
228 <cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
229 <xsl:call-template name="getKeyMember">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
230 <xsl:with-param name="type" select="../../@name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
231 <xsl:with-param name="explicitMemberName" select="@thisKey"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
232 <xsl:with-param name="short" select="true()"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
233 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
234 </cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
235 </cs:parameter>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
236 <cs:parameter name="otherKey">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
237 <cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
238 <xsl:call-template name="getMember">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
239 <xsl:with-param name="type" select="../@type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
240 <xsl:with-param name="memberName" select="../m:otherKey/@name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
241 <xsl:with-param name="explicitMemberName" select="@otherKey"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
242 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
243 </cs:nameOf>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
244 </cs:parameter>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
245 </cs:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
246 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
247
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
248 <xsl:template match="*" mode="property-attributes">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
249 <xsl:apply-templates select="." mode="member-attributes"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
250 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
251
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
252 <!-- property-extension -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
253 <xsl:template match="*" mode="property-extension">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
254 <xsl:apply-templates select="." mode="member-extension"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
255 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
256
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
257 <!-- property-accessors -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
258 <xsl:template match="*" mode="property-accessors">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
259 <cs:get/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
260 <cs:set/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
261 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
262
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
263 <xsl:template match="m:hasA[clr:lazy]/m:thisKey" mode="property-accessors">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
264 <cs:get>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
265 <xsl:text>return </xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
266 <xsl:apply-templates select="../clr:lazy" mode="field-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
267 <xsl:text>.Key;</xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
268 </cs:get>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
269 <cs:set>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
270 <xsl:apply-templates select="../clr:lazy" mode="field-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
271 <xsl:text>.Key = value;</xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
272 </cs:set>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
273 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
274
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
275 <xsl:template match="m:hasA[clr:lazy]/clr:association" mode="property-accessors">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
276 <cs:get>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
277 <xsl:text>return </xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
278 <xsl:apply-templates select="../clr:lazy" mode="field-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
279 <xsl:text>.Instance;</xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
280 </cs:get>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
281 <cs:set>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
282 <xsl:apply-templates select="../clr:lazy" mode="field-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
283 <xsl:text>.Instance = value;</xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
284 </cs:set>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
285 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
286
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
287 <!-- fields -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
288 <xsl:template match="*" mode="field">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
289 <cs:field>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
290 <xsl:attribute name="name"><xsl:apply-templates select="." mode="field-name"/></xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
291 <xsl:apply-templates select="." mode="field-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
292 <xsl:apply-templates select="." mode="field-initializer"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
293 </cs:field>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
294 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
295
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
296 <!-- field-name -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
297 <xsl:template match="m:hasA/clr:lazy" mode="field-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
298 <xsl:text>m_lazy</xsl:text>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
299 <xsl:apply-templates select=".." mode="property-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
300 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
301
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
302 <xsl:template match="clr:lazy[@field]" mode="field-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
303 <xsl:value-of select="@field"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
304 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
305
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
306 <xsl:template match="*" mode="field-name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
307 <xsl:apply-templates select="." mode="member-name"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
308 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
309
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
310 <!-- field-type -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
311 <xsl:template match="m:hasA[@optional='true']/clr:lazy" mode="field-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
312 <cs:type name="NullableReference" namespace="Pallada.Data">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
313 <xsl:call-template name="getKeyType">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
314 <xsl:with-param name="type" select="../@type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
315 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
316 <xsl:apply-templates select=".." mode="property-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
317 </cs:type>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
318 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
319 <xsl:template match="m:hasA[@optional!='true']/clr:lazy" mode="field-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
320 <cs:type name="Reference" namespace="Pallada.Data">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
321 <xsl:apply-templates select="../m:thisKey" mode="property-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
322 <xsl:apply-templates select=".." mode="property-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
323 </cs:type>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
324 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
325
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
326 <xsl:template match="*" mode="field-type">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
327 <xsl:apply-templates select="." mode="member-type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
328 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
329 <!-- field-initializer -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
330 <xsl:template match="*|text()" mode="field-initializer"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
331
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
332 <xsl:template name="getKeyClrMemberName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
333 <xsl:param name="explicitMemberName" select="''"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
334 <xsl:param name="type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
335 <xsl:param name="short" select="false()"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
336 <cs:member>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
337 <xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
338 <xsl:when test="$explicitMemberName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
339 <xsl:attribute name="name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
340 <xsl:value-of select="$explicitMemberName"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
341 </xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
342 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
343 <xsl:otherwise>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
344 <xsl:attribute name="name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
345 <xsl:call-template name="getKeyName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
346 <xsl:with-param name="type" select="$type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
347 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
348 </xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
349 </xsl:otherwise>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
350 </xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
351 <xsl:if test="not($short)">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
352 <xsl:call-template name="getClrType">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
353 <xsl:with-param name="type" select="$type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
354 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
355 </xsl:if>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
356 </cs:member>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
357 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
358
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
359 <xsl:template name="getClrMemberName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
360 <xsl:param name="memberName"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
361 <xsl:param name="type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
362 <xsl:param name="explicitMemberName" select="''"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
363 <xsl:param name="short" select="false()"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
364 <cs:member>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
365 <xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
366 <xsl:when test="$explicitMemberName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
367 <xsl:attribute name="name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
368 <xsl:value-of select="$explicitMemberName"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
369 </xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
370 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
371 <xsl:otherwise>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
372 <xsl:attribute name="name">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
373 <xsl:call-template name="getClrPropertyName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
374 <xsl:with-param name="member" select="$memberName"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
375 <xsl:with-param name="type" select="$type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
376 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
377 </xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
378 </xsl:otherwise>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
379 </xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
380 <xsl:if test="not($short)">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
381 <xsl:call-template name="getClrType">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
382 <xsl:with-param name="type" select="$type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
383 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
384 </xsl:if>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
385 </cs:member>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
386 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
387
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
388 <!-- lookups for the specified member for the specified type
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
389 and returns the CLR property name -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
390 <xsl:template name="getClrPropertyName">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
391 <xsl:param name="type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
392 <xsl:param name="member"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
393 <!-- prevents cyclic references -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
394 <xsl:param name="seen" select="/.."/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
395 <xsl:for-each select="$module">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
396 <xsl:apply-templates select="key('type', $type)"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
397 mode="member-lookup">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
398 <xsl:with-param name="member" select="$member"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
399 <xsl:with-param name="seen" select="$seen"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
400 </xsl:apply-templates>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
401 </xsl:for-each>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
402 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
403
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
404 <!-- resolves CLR type for the given type -->
437127ab6a12 non-working version
cin
parents: 2
diff changeset
405 <xsl:template name="getClrType">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
406 <xsl:param name="type" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
407 <xsl:param name="typeArgs" select="/.." />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
408 <!-- <t:trace msg="resolveClrType {$type}"/> -->
437127ab6a12 non-working version
cin
parents: 2
diff changeset
409 <xsl:for-each select="$module">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
410 <xsl:apply-templates select="key('type', $type)"
437127ab6a12 non-working version
cin
parents: 2
diff changeset
411 mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
412 <xsl:with-param name="typeArgs" select="$typeArgs"/>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
413 </xsl:apply-templates>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
414 </xsl:for-each>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
415 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
416
437127ab6a12 non-working version
cin
parents: 2
diff changeset
417 <!-- CLR type construction -->
437127ab6a12 non-working version
cin
parents: 2
diff changeset
418 <xsl:template match="*" mode="clr-type" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
419
437127ab6a12 non-working version
cin
parents: 2
diff changeset
420 <xsl:template match="m:type[clr:type]" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
421 <xsl:param name="typeArgs" select="clr:type/*" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
422 <xsl:apply-templates select="clr:type" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
423 <xsl:with-param name="typeArgs" select="$typeArgs" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
424 </xsl:apply-templates>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
425 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
426
437127ab6a12 non-working version
cin
parents: 2
diff changeset
427 <xsl:template match="m:entity" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
428 <cs:type name="{@clr:name | @name[not(../@clr:name)]}" namespace="{ancestor::*[@clr:namespace]/@clr:namespace}" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
429 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
430
437127ab6a12 non-working version
cin
parents: 2
diff changeset
431 <xsl:template match="clr:type" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
432 <xsl:apply-templates mode="clr-type"/>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
433 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
434
437127ab6a12 non-working version
cin
parents: 2
diff changeset
435 <xsl:template match="clr:type[@ref]" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
436 <xsl:param name="typeArgs" select="*" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
437 <xsl:call-template name="getClrType">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
438 <xsl:with-param name="type" select="@ref" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
439 <xsl:with-param name="typeArgs" select="$typeArgs" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
440 </xsl:call-template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
441 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
442
437127ab6a12 non-working version
cin
parents: 2
diff changeset
443 <xsl:template match="clr:type[@cs:name or @name]" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
444 <xsl:param name="typeArgs" select="*" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
445 <xsl:variable name="ns"
437127ab6a12 non-working version
cin
parents: 2
diff changeset
446 select="@cs:namespace | @namespace[not(../@cs:namespace)]" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
447 <cs:type name="{@cs:name | @name[not(../@cs:name)]}">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
448 <xsl:if test="$ns">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
449 <xsl:attribute name="namespace"><xsl:value-of select="$ns" /></xsl:attribute>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
450 </xsl:if>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
451 <xsl:copy-of select="@struct"/>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
452
437127ab6a12 non-working version
cin
parents: 2
diff changeset
453 <xsl:apply-templates select="$typeArgs | *[not($typeArgs)]"
437127ab6a12 non-working version
cin
parents: 2
diff changeset
454 mode="clr-type" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
455 </cs:type>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
456 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
457
437127ab6a12 non-working version
cin
parents: 2
diff changeset
458 <xsl:template match="clr:arrayOf[@type]" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
459 <xsl:param name="typeArgs" select="*" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
460 <cs:array>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
461 <xsl:call-template name="getClrType">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
462 <xsl:with-param name="type" select="@type" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
463 <xsl:with-param name="typeArgs" select="$typeArgs" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
464 </xsl:call-template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
465 </cs:array>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
466 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
467
437127ab6a12 non-working version
cin
parents: 2
diff changeset
468 <xsl:template match="clr:arrayOf[@cs:name or @name]" mode="clr-type">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
469 <xsl:param name="typeArgs" select="*" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
470 <xsl:variable name="ns"
437127ab6a12 non-working version
cin
parents: 2
diff changeset
471 select="@cs:namespace | @namespace[not(../@cs:namespace)]" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
472 <cs:array>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
473 <cs:type name="{@cs:name | @name[not(../@cs:name)]}">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
474 <xsl:if test="$ns">
437127ab6a12 non-working version
cin
parents: 2
diff changeset
475 <xsl:attribute name="namespace"><xsl:value-of
437127ab6a12 non-working version
cin
parents: 2
diff changeset
476 select="$ns" /></xsl:attribute>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
477 </xsl:if>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
478 <xsl:apply-templates select="$typeArgs | *[not($typeArgs)]"
437127ab6a12 non-working version
cin
parents: 2
diff changeset
479 mode="clr-type" />
437127ab6a12 non-working version
cin
parents: 2
diff changeset
480 </cs:type>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
481 </cs:array>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
482 </xsl:template>
437127ab6a12 non-working version
cin
parents: 2
diff changeset
483
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
484
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
485 </xsl:stylesheet>