|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Counting siblings...
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








