Re: is this a limitation / processor bug?

Subject: Re: is this a limitation / processor bug?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 7 Apr 2000 10:02:41 +0100 (BST)


<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


Current Thread