Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 15th, 2009, 02:01 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default For each with following-sibling

Hi, how do I process nodes of a following sibling with a for each instruction?

Suppose my input xml is:

Code:
<root>
    <item>Data</item>
    <item>Data</item>
    <item>Data</item>
    <note>Note</note>
    <note>Note</note>
    <item>Data</item>
    <item>Data</item>
    <note>Note</note>
</root>
my context node is <item>

Code:
<xsl:template match="item">
        <xsl:value-of select="."/>
            <xsl:for-each select="following-sibling::*[self::note][not(self::item)]">
                <!--do something-->
            </xsl:for-each>        
</xsl:template>
Thanks
 
Old July 15th, 2009, 02:08 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

You need to explain what output you want to achieve or in what way your code does not do what you want.
Your XPath following-sibling::*[self::note][not(self::item)] can certainly be shortened to following-sibling::note but I am not sure that will help.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
bonekrusher (July 15th, 2009)
 
Old July 15th, 2009, 02:18 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thanks Martin. I need to rethink this one... I think I can solve my problem by changing how I process one of the ancestors.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to Pull multiple following-sibling data to preceding-sibling element sameer_kadam XSLT 4 May 9th, 2009 08:07 AM
How to use the following::sibling Nagaraj XSLT 4 April 30th, 2009 10:37 AM
Using preceding-sibling mcanne98 Infopath 0 September 11th, 2008 11:09 PM
following-sibling. hanzelko XSLT 1 February 2nd, 2007 04:11 PM
MDI Sibling calling Sibling... Nick.Net VB.NET 2002/2003 Basics 1 December 8th, 2003 09:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.