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

Counting siblings...

Subject: Counting siblings...
From: Giles Smith <Giles.Smith@xxxxxxxxxxxx>
Date: Tue, 13 Jun 2000 11:31:22 +0100
giles smith
Hi,

I have an interesting problem, and wondered if your clever people might be
able to offer some possible solutions:

I have an XML file structure like this:

<root>
<item level=0>
</item>
<item level=1>
</item>
<item level=2>
</item>
<item level=1>
</item>
<item level=2>
</item>
<item level=0>
</item>
<item level=1>
</item>
</root>

Considering the first 5 item elements, both items with a level=1 are direct
replies to the first item with a level=0.  The first item with a level=2 is
a direct reply to the first item with a level=1, and so on.  The second four
items are all classed as replies to the first item with a level=0.  Had the
XML been nested, the 1st 5 would have looked like this;


<item level=0>
	<item level=1>
		<item level=2>
		</item>
	</item>
	<item level=1>
		<item level=2>
		</item>
	</item>
</item>


Now, the problem comes as a result of the flat-file structure.  I need to
count the number of replies to each item element.  Had it been nested, I
could have counted the descendants.  
Now, I need to count the following-siblings, who's level is higher than that
of the context element, but only where the following-siblings continue to
have a higher level (i.e., stop the count when the level decreases again).
As you can probably gauge from my poor phraseology, I'm a bit confused!  Any
help would be gratefully accepted!


Thanks,

Giles Smith


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.