[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Accessing the Next Node in the Current Node List
Subject: [xsl] Accessing the Next Node in the Current Node List From: "Sasha Haghani" <general@xxxxxxxxxxx> Date: Fri, 14 Dec 2001 12:33:13 -0500 |
Thanks for the response Chris, however I have tried using the named following-sibling axis before (I should have mentioned that), but that seems to select the next sibling element in the source document, rather than the next node in the context's current node list (which is what I want). Here's a simple example to illustrate. The following XSL: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" indent="no"/> <xsl:template match="document"> <xsl:apply-templates select="section[@importance = 'high']"/> </xsl:template> <xsl:template match="section"> <xsl:value-of select="."/><xsl:text> </xsl:text> Next Section Importance: <xsl:value-of select="following-sibling::node()/@importance"/> <xsl:text>
</xsl:text> </xsl:template> </xsl:transform> Applied to the following document: <document> <section importance="high">Section 1</section> <section importance="low">Section 2</section> <section importance="high">Section 3</section> </document> Yields the following result document: Section 1 Next Section Importance: low Section 3 Next Section Importance: The apply-templates instruction correctly selects the high importance sections, but the following-sibling axis still returns the second (low importance) section -- which isn't part of the current node list. Does anyone have any ideas as to how to access/select the next node in the current node list? -- Sasha --------------------- Date: Wed, 12 Dec 2001 01:13:20 -0000 From: "Chris Bayes" chris@xxxxxxxxxxx Subject: RE: [xsl] Accessing the Next or Previous Node in the Current node-list <xsl:if test="following-sibling::p">
</xsl:if> -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Sasha Haghani Sent: 12 December 2001 00:23 To: XSL List Subject: [xsl] Accessing the Next or Previous Node in the Current node-list How can I access the next or previous node in the current node-list? I need to perform special whitespace (e.g.: "output a newline character if the next element in the node-list is a paragraph") handling based on the next element which is going to be processed. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] for-each order, Michael Kay | Thread | Re: [xsl] Accessing the Next Node i, David Carlisle |
RE: [xsl] conditional namespaces, Michael Kay | Date | RE: [xsl] for-each order, Michael Kay |
Month |
Keywords