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

Complex transform + adding an incremental integer to a

Subject: Complex transform + adding an incremental integer to an attribute
From: "Mathieu Sagot" <mathieu.sagot@xxxxxxxxxxxxxxx>
Date: Wed, 22 Jun 2005 18:32:01 +0100
adding all integers while
 Hello list,

I have been trying to create a list of nodes containing sometimes the
parent and sometimes the childs depending on a "selected" attribute (but
then not keeping the parent).
While keeping the order the nodes came from.
+ adding an "order" attribute which is an incremental integer.

Which would give:

	Input XML					->
Output XML

<n1 id=1>						-> <newNode
order=1>...</newNode>
	<n2 id=1 selected=0>...</n2>
	<n2 id=2 selected=0>...</n2>
</n1>
<n1 id=2>						-> this one is
not kept as we will keep some of the childs
	<n2 id=1 selected=1>...</n2>		-> <newNode
order=2>...</newNode>
	<n2 id=2 selected=0>...</n2>
	<n2 id=3 selected=1>...</n2>		-> <newNode
order=3>...</newNode>
</n1>
<n1 id=3>						-> <newNode
order=4>...</newNode>
	<n2 id=1 selected=0>...</n2>
	<n2 id=2 selected=0>...</n2>
</n1>


I tried to do a template select to return all the wanted nodes and then
use position() to feed the order attribute, but by using the operator |
I ended up with first all the nodes coming from n1 and then all the
nodes coming from n2, which is not the order I want them. And also the
node <n1 id=1> would be transferred although its childs are transferred.

It is a bit of a dual problem because of this order attribute, which is
incremental...

I would be happy with any clue/quidelines/ideas.
Although I am not sure if my explanations are very clear.

Anyway, I thought of a backup solution of using two xsl transform, one
to get all the nodes I want in the correct order, and an other xslt to
fill the order attribute using position()

Thank you for your time

Mathieu Sagot

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-2013 All Rights Reserved.