Subject: RE: Order of processing templates
From: "Pilarski,James" <James.Pilarski@xxxxxxxxx>
Date: Fri, 21 Feb 2003 09:52:29 -0600
|
Karl,
When you say the second template is processed first, do you mean that:
<xsl:apply-templates select="xml/s:Schema/s:ElementType/s:AttributeType[check='true']"/>
is matching on:
<xsl:template match="xml/s:Schema/s:ElementType/s:AttributeType[where!='']">
???
If this is the case, make certain that the predicates in your XPaths are not evaluating to the same value. Regardless, have you tried assigning a mode to your templates? An example of mode could be:
<xsl:template match="/">
select
<xsl:apply-templates select="xml/s:Schema/s:ElementType/s:AttributeType[check='true']" mode="first"/> from
<xsl:value-of select="$table"/>
<xsl:apply-templates select="xml/s:Schema/s:ElementType/s:AttributeType[where!='']" mode="second"/>
</xsl:template>
<xsl:template match="xml/s:Schema/s:ElementType/s:AttributeType[check='true']" mode="first">
<xsl:value-of select="@name"/>
<xsl:if test="position()!=last()">,</xsl:if>
</xsl:template>
<xsl:template match="xml/s:Schema/s:ElementType/s:AttributeType[where!='']" mode="second">
<xsl:if test="position()=1">
where
</xsl:if>
<xsl:value-of select="@name"/>=
<xsl:value-of select="where"/>
</xsl:template>
Jim
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|