[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hello XSLers,
Is there a way of selecting a node in a node list (as opposed to set, I've been reading the FAQ ;-) other than the current one?
e.g.
01:<xsl:template match="//item[@id=$selected-item]">
02: <!-- item navigator -->
03: <xsl:variable name="current-node-class" select="@class">
04: <xsl:variable name="current-node" select="@id">
05: <xsl:variable name="next-item-id">
06: <xsl:for-each select="//item[@class=$current-node-class">
07: <xsl:sort select="@id" />
08: <xsl:if test="@id=$current-node and position()!=last()">
09: <xsl:value-of select="item[position()+1]/@id /> <!-- :-o -->
10: </xsl:if>
11: </xsl:for-each>
12: </xsl:variable>
13: <a href="?selected-item={$next-item-id}">NEXT</a>
14: <!-- some similar code for previous item..... -->
15:
16: <!-- item content -->
17: <h2><xsl:value-of select="@name" /></h2>
........
18:</xsl:template>
Line 09 here doesn't work because I need some expression which allows me to select the next item in the sorted node list generated by the <xsl:for-each>.
Any ideas?
[xsl] node lists
Subject: [xsl] node lists From: Richard Lewis <richardlewis@xxxxxxxxxxxxxx> Date: Tue, 19 Oct 2004 11:38:17 +0100 |
Hello XSLers,
Is there a way of selecting a node in a node list (as opposed to set, I've been reading the FAQ ;-) other than the current one?
e.g.
01:<xsl:template match="//item[@id=$selected-item]">
02: <!-- item navigator -->
03: <xsl:variable name="current-node-class" select="@class">
04: <xsl:variable name="current-node" select="@id">
05: <xsl:variable name="next-item-id">
06: <xsl:for-each select="//item[@class=$current-node-class">
07: <xsl:sort select="@id" />
08: <xsl:if test="@id=$current-node and position()!=last()">
09: <xsl:value-of select="item[position()+1]/@id /> <!-- :-o -->
10: </xsl:if>
11: </xsl:for-each>
12: </xsl:variable>
13: <a href="?selected-item={$next-item-id}">NEXT</a>
14: <!-- some similar code for previous item..... -->
15:
16: <!-- item content -->
17: <h2><xsl:value-of select="@name" /></h2>
........
18:</xsl:template>
Line 09 here doesn't work because I need some expression which allows me to select the next item in the sorted node list generated by the <xsl:for-each>.
Any ideas?
Cheers, Richard
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] CLARIFICATION IN XML 2 XML TR, Arul Kumar | Thread | Re: [xsl] node lists, David Carlisle |
Re: [xsl] match string, Anton Triest | Date | Re: [xsl] node lists, David Carlisle |
Month |