Tjerk Wolterink
Usenet Archive
- Joined
- Sep 18, 2004
- Messages
- 218
- Reaction score
- 0
Given an node with path a/b[@id=1]
how do i get the next three following sibling nodes?
example document
<a>
<b id="1"/>
<b/>
<b/>
<b/>
</a>
ok you could say: a/b[not(@id)], but that are only three in this example doc.
but i dont know the exact path,
the only thin is know is that . or node is some b node.
i use these xpath expression in an xsl tranformation where i want to create a table with images.
look at this:
<table>
<xsl:for-each select="b[(position mod 3)=1]">
<tr>
<td>
<xsl:call-template name="sometempl">
<xsl:with-param name="param" select="."/>
</xsl:call-template>
</td>
<td>
<xsl:if test="following-sibling::node[position=1]">
<xsl:call-template name="sometempl">
<xsl:with-param name="param" select="following-sibling::node[position=1]/> </xsl:call-template> </xsl:if> </td> <td> <xsl:if test="following-sibling::node[position=2]"> <xsl:call-template name="sometempl"> <xsl:with-param name="param" select="following-sibling::node[position=2]/> </xsl:call-template> </xsl:if> </td> </tr> </xsl:for-each> </table>
but this does not work
hope you know what i mean.
how do i get the next three following sibling nodes?
example document
<a>
<b id="1"/>
<b/>
<b/>
<b/>
</a>
ok you could say: a/b[not(@id)], but that are only three in this example doc.
but i dont know the exact path,
the only thin is know is that . or node is some b node.
i use these xpath expression in an xsl tranformation where i want to create a table with images.
look at this:
<table>
<xsl:for-each select="b[(position mod 3)=1]">
<tr>
<td>
<xsl:call-template name="sometempl">
<xsl:with-param name="param" select="."/>
</xsl:call-template>
</td>
<td>
<xsl:if test="following-sibling::node[position=1]">
<xsl:call-template name="sometempl">
<xsl:with-param name="param" select="following-sibling::node[position=1]/> </xsl:call-template> </xsl:if> </td> <td> <xsl:if test="following-sibling::node[position=2]"> <xsl:call-template name="sometempl"> <xsl:with-param name="param" select="following-sibling::node[position=2]/> </xsl:call-template> </xsl:if> </td> </tr> </xsl:for-each> </table>
but this does not work
hope you know what i mean.