Subject: Re: [xsl] <xsl:when test="position()%2=0"> From: Andrew Watt <andrew@xxxxxxxxxxxxxx> Date: Mon, 21 Apr 2003 16:58:14 +0100 |
first of all i wish to thank all of you guys (and gals) for providing me with great help. now i have another query
i would like to find the position of a node whether it is odd or even, and tried to use position() mod 2, but i don't know how to do it
can anyone tell me how to find the remainder of a division or else any ideas on how to find whether a node is odd or even
Source: <?xml version='1.0'?> <Things> <Thing>First</Thing> <Thing>Second</Thing> <Thing>Third</Thing> <Thing>Fourth</Thing> <Thing>Fifth</Thing> <Thing>Sixth</Thing> </Things>
<?xml version='1.0'?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:template match="/Things"> <xsl:copy > <xsl:apply-templates select="Thing" /> </xsl:copy> </xsl:template>
<?xml version="1.0" encoding="UTF-8"?> <Things> <Remainder>1</Remainder> <Thing>First</Thing> <Remainder>1</Remainder> <Thing>Third</Thing> <Remainder>1</Remainder> <Thing>Fifth</Thing> </Things>
If you change the <xsl:when> like this <xsl:when test="not(position() mod 2)" >
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] <xsl:when test="position()%2=, Luke Ambrogio | Thread | RE: [xsl] <xsl:when test="position(, Craig Kattner |
RE: [xsl] <xsl:when test="position(, Craig Kattner | Date | [xsl] Multiple XML into one XSL and, nshah |
Month |