annotate xslt/generator.csharp.xsl @ 3:437127ab6a12

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