annotate xslt/model.xsl @ 9:d3542662cf70

working on members preprocessing
author cin
date Sun, 11 Mar 2018 10:27:32 +0300
parents 5fe2e5724331
children 19a8a71eaa54
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
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
9 <xsl:import href="preprocess.xsl" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
10 <xsl:include href="text-tools.xsl"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
11
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
12 <xsl:output method="xml" indent="yes" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
13
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
14 <xsl:key name="type" match="m:package/m:*" use="@name" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
15
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
16 <xsl:template match="/">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
17 <cs:document>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
18 <xsl:apply-templates select="$module" mode="document" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
19 </cs:document>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
20 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
21
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
22 <!-- code generation -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
23
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
24 <!-- disable default template -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
25 <xsl:template match="*|text()" mode="document" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
26
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
27 <xsl:template match="t:module" mode="document">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
28 <xsl:apply-templates mode="document" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
29 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
30
3
437127ab6a12 non-working version
cin
parents: 2
diff changeset
31
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
32
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
33 <!-- member resolution traits -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
34
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
35 <!-- Resolves members using given criteria
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
36 @param type
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
37 the name of the type whose members are inspected
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
38 @param memberName
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
39 the name of the member to lookup
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
40 @param scope
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
41 the scope where to look (members, properties, keys, relations)
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
42
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
43 This template recursively inspects the given type down to it's inheritance
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
44 hierarchy and outputs members matching criteria.
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
45 -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
46 <xsl:template name="getMembers">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
47 <xsl:param name="type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
48 <xsl:param name="memberName" select="''"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
49 <xsl:param name="scope" select="'members'"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
50 <!-- prevents cyclic references -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
51 <xsl:param name="seen" select="/.."/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
52 <xsl:for-each select="$module">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
53 <xsl:apply-templates select="key('type', $type)"
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
54 mode="lookup-members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
55 <xsl:with-param name="memberName" select="$memberName"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
56 <xsl:with-param name="scope" select="$scope"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
57 <xsl:with-param name="seen" select="$seen"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
58 </xsl:apply-templates>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
59 </xsl:for-each>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
60 </xsl:template>
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="*" mode="lookup-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:entity" mode="lookup-members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
65 <xsl:param name="memberName" select="''"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
66 <xsl:param name="scope" select="'members'"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
67 <xsl:param name="seen"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
68
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
69 <xsl:variable name="self" select="."/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
70
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
71 <xsl:if test="not($seen[generate-id() = generate-id($self)])">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
72 <xsl:variable name="scopeMembers">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
73 <xsl:call-template name="selectScopeMembers">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
74 <xsl:with-param name="scope" select="$scope"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
75 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
76 </xsl:variable>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
77
6
1f4009d4afb6 working on model to csharp transform
cin
parents: 4
diff changeset
78 <xsl:variable name="members" select="exsl:node-set($scopeMembers)/*[not($memberName) or @name=$memberName]"/>
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
79
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
80 <xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
81 <xsl:when test="$members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
82 <xsl:copy-of select="$members"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
83 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
84 <xsl:when test="m:extends">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
85 <xsl:call-template name="getMembers">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
86 <xsl:with-param name="type" select="m:extends/@type"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
87 <xsl:with-param name="memberName" select="$memberName"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
88 <xsl:with-param name="scope" select="$scope"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
89 <xsl:with-param name="seen" select="$seen | $self"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
90 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
91 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
92 <xsl:otherwise>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
93 <xsl:call-template name="warn">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
94 <xsl:with-param name="msg">
6
1f4009d4afb6 working on model to csharp transform
cin
parents: 4
diff changeset
95 <t:trace msg="failed to resolve {$memberName}, scope={$scope}"/>
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
96 <t:trace msg="inspected classes">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
97 <xsl:for-each select="$seen | $self">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
98 <t:trace msg="{name()} {@name}"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
99 </xsl:for-each>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
100 </t:trace>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
101 </xsl:with-param>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
102 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
103 </xsl:otherwise>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
104 </xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
105 </xsl:if>
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 <!-- this template implements scope filtering -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
109 <xsl:template name="selectScopeMembers">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
110 <xsl:param name="scope" select="'members'"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
111 <xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
112 <xsl:when test="$scope='members'">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
113 <xsl:apply-templates mode="filter-members"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
114 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
115 <xsl:when test="$scope='keys'">
6
1f4009d4afb6 working on model to csharp transform
cin
parents: 4
diff changeset
116 <xsl:apply-templates mode="filter-keys"/>
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
117 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
118 <xsl:when test="$scope='properties'">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
119 <xsl:apply-templates mode="fiflter-properties"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
120 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
121 <xsl:when test="$scope='relations'">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
122 <xsl:apply-templates mode="fiflter-relations"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
123 </xsl:when>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
124 </xsl:choose>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
125 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
126
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
127 <!-- filter-members -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
128 <xsl:template match="*|text()" mode="filter-members"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
129 <xsl:template match="*[@name]" mode="filter-members">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
130 <xsl:copy>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
131 <xsl:copy-of select="@*" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
132 <xsl:attribute name="declaringType"><xsl:value-of select="../@name" /></xsl:attribute>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
133 <xsl:copy-of select="*" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
134 </xsl:copy>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
135 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
136
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
137 <!-- filter-keys -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
138 <xsl:template match="*|text()" mode="filter-keys"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
139 <xsl:template match="m:primaryKey" mode="filter-keys">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
140 <xsl:apply-templates select="." mode="filter-members"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
141 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
142
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
143 <!-- filter-properties -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
144 <xsl:template match="*|text()" mode="filter-properties"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
145 <xsl:template match="m:property" mode="filter-properties">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
146 <xsl:apply-templates select="." mode="filter-members"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
147 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
148
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
149 <!-- filter-relations -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
150 <xsl:template match="*|text()" mode="filter-relations"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
151 <xsl:template match="m:hasA | m:hasMany" mode="filter-relations">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
152 <xsl:apply-templates select="." mode="filter-members"/>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
153 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
154
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
155
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
156
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
157 <!-- Resolves primaryKey information for the given type name.
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
158 @returns m:primaryKey node copy with additional attribute
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
159 @declaringType which points to the type where this primaryKey
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
160 was defined.
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
161 -->
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
162 <xsl:template name="getPrimaryKey">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
163 <xsl:param name="type" />
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
164 <xsl:call-template name="getMembers">
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
165 <xsl:with-param name="type" select="$type"/>
6
1f4009d4afb6 working on model to csharp transform
cin
parents: 4
diff changeset
166 <xsl:with-param name="scope" select="'keys'"/>
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
167 </xsl:call-template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
168 </xsl:template>
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
169
7
cin
parents: 6
diff changeset
170 <!-- expand-member templates are used to process relations
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
171 and keys and provide useful information. This mode is designed
8
cin
parents: 7
diff changeset
172 to recursively traverse members expanding details like special
cin
parents: 7
diff changeset
173 properties generated by relations.
cin
parents: 7
diff changeset
174
cin
parents: 7
diff changeset
175 expand-member-reference is special mode used to traverse inside
cin
parents: 7
diff changeset
176 members which are referenced from relations. By default this mode
cin
parents: 7
diff changeset
177 does nothing.
cin
parents: 7
diff changeset
178
cin
parents: 7
diff changeset
179 Use this templates to produce intermediate model for further
cin
parents: 7
diff changeset
180 processing by specific code-generators.
7
cin
parents: 6
diff changeset
181
cin
parents: 6
diff changeset
182 @special - means that the member is a composite part and isn't
cin
parents: 6
diff changeset
183 accessible directly
cin
parents: 6
diff changeset
184 -->
cin
parents: 6
diff changeset
185
8
cin
parents: 7
diff changeset
186 <xsl:template match="*" mode="expand-member">
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
187 <xsl:copy>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
188 <xsl:copy-of select="@*"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
189 <xsl:apply-templates mode="expand-member"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
190 </xsl:copy>
8
cin
parents: 7
diff changeset
191 </xsl:template>
cin
parents: 7
diff changeset
192
cin
parents: 7
diff changeset
193
7
cin
parents: 6
diff changeset
194 <!-- short form of primaryKey{@name, @type} -->
cin
parents: 6
diff changeset
195 <xsl:template match="m:primaryKey" mode="expand-member">
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
196 <xsl:variable name="pkName" select="concat(@declaringType, 'Pk')"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
197 <xsl:variable name="propName" select="@name" />
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
198
8
cin
parents: 7
diff changeset
199 <xsl:variable name="specialProperty">
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
200 <m:property name="{$propName}" special="true">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
201 <xsl:copy-of select="@*[not(self::name)]" />
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
202 <m:hiddenBy name="{$pkName}" type="{@declaringType}"/>
7
cin
parents: 6
diff changeset
203 <xsl:copy-of select="*" />
cin
parents: 6
diff changeset
204 </m:property>
8
cin
parents: 7
diff changeset
205 </xsl:variable>
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
206
8
cin
parents: 7
diff changeset
207 <xsl:apply-templates select="exsl:node-set($specialProperty)" mode="expand-member"/>
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
208 <xsl:copy>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
209 <xsl:attribute name="name"><xsl:value-of select="$pkName"/></xsl:attribute>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
210 <m:member name="{@name}" type="{@declaringType}"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
211 </xsl:copy>
7
cin
parents: 6
diff changeset
212 </xsl:template>
cin
parents: 6
diff changeset
213
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
214 <!-- long form of primaryKey{ member{@name}+ } -->
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
215 <xsl:template match="m:primaryKey[m:member]" mode="expand-member">
8
cin
parents: 7
diff changeset
216 <xsl:apply-templates mode="expand-member"/>
7
cin
parents: 6
diff changeset
217 </xsl:template>
cin
parents: 6
diff changeset
218
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
219 <!-- short form of hasA -->
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
220 <xsl:template match="m:hasA" mode="expand-member">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
221 <xsl:variable name="foreignPk">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
222 <xsl:call-template name="getPrimaryKey">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
223 <xsl:with-param name="type" select="@type"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
224 </xsl:call-template>
8
cin
parents: 7
diff changeset
225 </xsl:variable>
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
226 <xsl:variable name="expandedPk">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
227 <xsl:apply-templates select="exsl:node-set($foreignPk)" mode="expand-member"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
228 </xsl:variable>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
229 <xsl:variable name="resolvedPk">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
230 <xsl:apply-templates select="exsl:node-set($expandedPk)/m:primaryKey" mode="resolve-members"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
231 </xsl:variable>
7
cin
parents: 6
diff changeset
232 </xsl:template>
cin
parents: 6
diff changeset
233
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
234 <!-- short form of hasA with matched keys specified -->
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
235 <xsl:template match="m:hasA[m:thisKey]">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
236 <xsl:apply-templates select="m:thisKey" mode="generate-fk-properties"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
237 <xsl:copy>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
238 <xsl:copy-of select="@*"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
239 <xsl:apply-templates mode="expand-member"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
240 </xsl:copy>
7
cin
parents: 6
diff changeset
241 </xsl:template>
cin
parents: 6
diff changeset
242
8
cin
parents: 7
diff changeset
243 <xsl:template match="m:hasA/m:thisKey" mode="expand-member">
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
244 <m:member name="{@name}" matches="{@matches}"/>
7
cin
parents: 6
diff changeset
245 </xsl:template>
cin
parents: 6
diff changeset
246
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
247 <!-- long form of hasA -->
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
248 <xsl:template match="m:hasA[m:member]" mode="expand-member">
7
cin
parents: 6
diff changeset
249 <xsl:apply-templates mode="expand-member"/>
cin
parents: 6
diff changeset
250 </xsl:template>
cin
parents: 6
diff changeset
251
9
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
252 <!-- resolve expands -->
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
253
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
254 <xsl:template match="m:member" mode="resolve-members">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
255 <xsl:variable name="$name" select="@name"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
256 <xsl:variable name="$declaringType" select="@declaringType" />
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
257
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
258 <xsl:choose>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
259 <xsl:when test="/*[@name=$name and @declaringType=$declaringType]">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
260 <xsl:apply-templates select="/*[@name=$name and @declaringType=$declaringType]" mode="resolve-members"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
261 </xsl:when>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
262 <xsl:otherwise>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
263 <xsl:variable name="fragment">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
264 <xsl:call-template name="getMembers">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
265 <xsl:with-param name="memberName" select="$name"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
266 <xsl:with-param name="type" select="$declaringType"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
267 </xsl:call-template>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
268 </xsl:variable>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
269 <xsl:apply-templates select="exsl:node-set($fragment)/*[not(@special)]" mode="resolve-members"/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
270 </xsl:otherwise>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
271 </xsl:choose>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
272 </xsl:template>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
273
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
274 <xsl:template match="m:property" mode="resolve-members">
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
275 <xsl:copy-of select="."/>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
276 </xsl:template>
d3542662cf70 working on members preprocessing
cin
parents: 8
diff changeset
277
2
035de8b7b18e Temporary commit, refactoring, added readme
cin
parents:
diff changeset
278 </xsl:stylesheet>