This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: is this a limitation / processor bug?
- To: xsl-list at mulberrytech dot com
- Subject: Re: is this a limitation / processor bug?
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Fri, 7 Apr 2000 10:02:41 +0100 (BST)
- References: <01BFA016.FCDC8BA0@host213-1-63-46.btinternet.com>
- Reply-To: xsl-list at mulberrytech dot com
<xsl:template match="schematics">
<xsl:variable name="model" select="modelnumber"/>
<xsl:variable name="applicableModel" select="documentation/currentModel"/>
<xsl:choose>
<xsl:when test="$model=$applicableModel">
<xsl:apply-templates select="link"/>
</xsl:when>
</xsl:choose>
</xsl:template>
(I removed two / and changed one \ to / from your original)
This may or may not be correct, depending on what your input looks like.
If it is correct, you don't need the variables, it is equivalent to
<xsl:template match="schematics">
<xsl:choose>
<xsl:when test="modelnumber="documentation/currentModel">
<xsl:apply-templates select="link"/>
</xsl:when>
</xsl:choose>
</xsl:template>
so your input looks like this?
<schematics>
<documentation>
<currentModel>123</currentModel>
</documentation>
<modelnumber>123</modelnumber>
<link>
stuff that has templates applied
</link>
<schematics>
If so, your template looks about right except beware you are doing
string comparison in that = so any white space differences would
make it false, you may want number(modelnumber)=number(documentation/currentModel)
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list