[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

following-sibling::

Subject: following-sibling::
From: Myles Pflum <myles_pflum@xxxxxxxxxxxxx>
Date: Fri, 6 Feb 2009 16:59:46 -0800
 following-sibling::
First time poster in need of assistance =)

Using XSLT 1.0, given the following structure:

<document>
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa stylename='start' />
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa stylename='finish' />
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa stylename='start' />
	<aaa />
	<aaa />
	<aaa stylename='finish' />
	<aaa />
	<aaa />
</document>

How can I make the <aaa /> elements that exist in between @='start' and @='finish become children of <aaa stylename='start' />?

I've tried some sibling recursion techniques and such but I can't get my XPath right. I can select all the following-siblings of @='start' until the end of the document, but I need to select all of the following-siblings of @='start' until I reach @='finish'.

I've been using <xsl:copy-of select="following- sibling::*[@stylename='finish']" /> but this selection isn't stopping when I reach the first 'finish'. It's just selecting all the 'finish' in the document.


Desired output:


<document>
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa stylename='start'>
		<aaa />
		<aaa />
		<aaa />
		<aaa />
	</aaa>
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa />
	<aaa stylename='start' />
		<aaa />
		<aaa />
	</aaa>
	<aaa />
	<aaa />
</document>

In addition to this selection issue, "copy-of" is simply copying the elements to the result tree without applying templates. How can I 'copy' these elements and then apply-templates?


Thanks, Myles Pflum

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.