xsl-list
[Top] [All Lists]

node lists

2004-10-19 03:38:17
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[(_at_)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[(_at_)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



<Prev in Thread] Current Thread [Next in Thread>