hi!
I m looking for a way to use position() in a way that it returns not only the context position of one node. I would like it to return the position of the whole dukument.
like, if I had:
<Test>
<one>
<name>name1</name>
<name>name2</name>
</one>
<two>
<name>name1</name>
</two>
</Test>
If I let my XSLT stylsheet procces it I get something like that. The number is the value the position funktion returns. the X field is how I would like it to be:
NAME Nr X
name1 1 1
name2 2 2
name1 1 3
currently I m doing it like this:
<xsl:value-of select="position()"/>
but the idea behind it is to get a different color for each row.
Currently I m doing it like this:
<xsl:variable name="color">
<xsl:choose>
<xsl:when test="(position() mod 2 ) = 0">
<xsl:value-of select="$white"/>
</xsl:when>
<xsltherwise>
<xsl:value-of select="$red"/>
</xsltherwise>
</xsl:choose>
</xsl:variable>
Do u know a correct way of doing this?
thx!!
I m looking for a way to use position() in a way that it returns not only the context position of one node. I would like it to return the position of the whole dukument.
like, if I had:
<Test>
<one>
<name>name1</name>
<name>name2</name>
</one>
<two>
<name>name1</name>
</two>
</Test>
If I let my XSLT stylsheet procces it I get something like that. The number is the value the position funktion returns. the X field is how I would like it to be:
NAME Nr X
name1 1 1
name2 2 2
name1 1 3
currently I m doing it like this:
<xsl:value-of select="position()"/>
but the idea behind it is to get a different color for each row.
Currently I m doing it like this:
<xsl:variable name="color">
<xsl:choose>
<xsl:when test="(position() mod 2 ) = 0">
<xsl:value-of select="$white"/>
</xsl:when>
<xsltherwise>
<xsl:value-of select="$red"/>
</xsltherwise>
</xsl:choose>
</xsl:variable>
Do u know a correct way of doing this?
thx!!