comparison xslt/model.xsl @ 6:1f4009d4afb6

working on model to csharp transform
author cin
date Mon, 05 Mar 2018 10:37:47 +0300
parents d240adc2ac70
children 3fe157be5141
comparison
equal deleted inserted replaced
5:6f67d3a6b950 6:1f4009d4afb6
73 <xsl:call-template name="selectScopeMembers"> 73 <xsl:call-template name="selectScopeMembers">
74 <xsl:with-param name="scope" select="$scope"/> 74 <xsl:with-param name="scope" select="$scope"/>
75 </xsl:call-template> 75 </xsl:call-template>
76 </xsl:variable> 76 </xsl:variable>
77 77
78 <xsl:variable name="members" select="exsl:node-set($scopeMembers)/*[not($memberName) or @name='$memberName']"/> 78 <xsl:variable name="members" select="exsl:node-set($scopeMembers)/*[not($memberName) or @name=$memberName]"/>
79 79
80 <xsl:choose> 80 <xsl:choose>
81 <xsl:when test="$members"> 81 <xsl:when test="$members">
82 <xsl:copy-of select="$members"/> 82 <xsl:copy-of select="$members"/>
83 </xsl:when> 83 </xsl:when>
90 </xsl:call-template> 90 </xsl:call-template>
91 </xsl:when> 91 </xsl:when>
92 <xsl:otherwise> 92 <xsl:otherwise>
93 <xsl:call-template name="warn"> 93 <xsl:call-template name="warn">
94 <xsl:with-param name="msg"> 94 <xsl:with-param name="msg">
95 <t:trace msg="failed to resolve {$member}"/> 95 <t:trace msg="failed to resolve {$memberName}, scope={$scope}"/>
96 <t:trace msg="inspected classes"> 96 <t:trace msg="inspected classes">
97 <xsl:for-each select="$seen | $self"> 97 <xsl:for-each select="$seen | $self">
98 <t:trace msg="{name()} {@name}"/> 98 <t:trace msg="{name()} {@name}"/>
99 </xsl:for-each> 99 </xsl:for-each>
100 </t:trace> 100 </t:trace>
111 <xsl:choose> 111 <xsl:choose>
112 <xsl:when test="$scope='members'"> 112 <xsl:when test="$scope='members'">
113 <xsl:apply-templates mode="filter-members"/> 113 <xsl:apply-templates mode="filter-members"/>
114 </xsl:when> 114 </xsl:when>
115 <xsl:when test="$scope='keys'"> 115 <xsl:when test="$scope='keys'">
116 <xsl:apply-template mode="filter-keys"/> 116 <xsl:apply-templates mode="filter-keys"/>
117 </xsl:when> 117 </xsl:when>
118 <xsl:when test="$scope='properties'"> 118 <xsl:when test="$scope='properties'">
119 <xsl:apply-templates mode="fiflter-properties"/> 119 <xsl:apply-templates mode="fiflter-properties"/>
120 </xsl:when> 120 </xsl:when>
121 <xsl:when test="$scope='relations'"> 121 <xsl:when test="$scope='relations'">
161 --> 161 -->
162 <xsl:template name="getPrimaryKey"> 162 <xsl:template name="getPrimaryKey">
163 <xsl:param name="type" /> 163 <xsl:param name="type" />
164 <xsl:call-template name="getMembers"> 164 <xsl:call-template name="getMembers">
165 <xsl:with-param name="type" select="$type"/> 165 <xsl:with-param name="type" select="$type"/>
166 <xsl:with-param name="scope" select="keys"/> 166 <xsl:with-param name="scope" select="'keys'"/>
167 </xsl:call-template> 167 </xsl:call-template>
168 </xsl:template> 168 </xsl:template>
169 169
170 <xsl:template match="*|text()" mode="process-member"/>
171
172 <xsl:template match="m:hasA" mode="process-member">
173 <xsl:apply-templates mode="process-member"/>
174 </xsl:template>
175
176 <xsl:template match="m:hasA[@type]/m:thisKey" mode="foreign-key">
177 <xsl:variable name="foreignPrimaryKey">
178 <xsl:call-template name="getPrimaryKey">
179 <xsl:with-param name="type" select="../@type"/>
180 </xsl:call-template>
181 </xsl:variable>
182 <m:property type="{exsl:node-set($foreignPrimaryKey)[1]/@type}">
183 <xsl:copy-of select="@*"/>
184 </m:property>
185 </xsl:template>
186
187 <xsl:template match="m:primaryKey" mode="process-member">
188 <m:property>
189 <xsl:copy-of select="@*"/>
190 <xsl:copy-of select="*"/>
191 </m:property>
192 </xsl:template>
193
194
195 </xsl:stylesheet> 170 </xsl:stylesheet>