This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: is this a limitation / processor bug?





<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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]