Re: [xslt] XPath weirdness



 >Removing the parentheses around the second version doesn't solve the
 >problem, though :( Adding parens in the first version doesn't solve
 >anything either.

Oke, it seems that changing '(parent::*)' in the XSLT examples to
'parent::*' solves the problem.

This code now produces both XXX and YYY, what I needed:
-snip-
<xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     version="1.0">

<xsl:variable name="catid" select="'1'"/>

<xsl:template match="categorynode[@catid = $catid]">
  <xsl:if test="generate-id((parent::*//categorynode[@catid = $catid])[1]) = generate-id(.)">
    XXX: <xsl:value-of select="categorytext"/>
  </xsl:if>
  <xsl:variable name="test" select="parent::*//categorynode[@catid = $catid]"/>
  <xsl:if test="generate-id($test[1]) = generate-id(.)">
    YYY: <xsl:value-of select="categorytext"/>
  </xsl:if>
</xsl:template>

</xsl:stylesheet>
-/snip-

                                                                         robert




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]