Subject: [xsl] Traversing the tree From: "Agnisys Technology \(P\) Ltd." <agnisys@xxxxxxxxx> Date: Thu, 8 Sep 2005 14:09:50 -0700 (PDT) |
Hi, This is probably simple for the experts of the group but I can't figure this out. Problem I got stuck on was how to find the closest preceding-sibling node with an offset attribute, then count the nodes that don't have the attribute since that node. Input : <top> <a> <reg > A1 </reg> <reg > A2 </reg> <reg offset="10" > A3 </reg> <reg > A4 </reg> <reg > A5 </reg> <reg offset="24" > A6 </reg> <reg > A7 </reg> </a> <a> <reg offset="6"> A8 </reg> <reg > A9 </reg> </a> <a> <reg > A10 </reg> </a> </top> Output: A1 : 0 A2 : 1 A3 : 10 A4 : 11 A5 : 12 A6 : 24 A7 : 25 A8 : 6 A9 : 7 A10: 0 So, start with 0 and count unless @offset is encountered, if so, jump to the offset and start counting again. Offsets are guaranteed to be monotonically increasing, although I do need to create a test elsewhere that verifies that it does. Thanks, Anupam. ______________________________________________________ Click here to donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Apply-templates - how to , Jon Gorman | Thread | Re: [xsl] Traversing the tree, JBryant |
RE: [xsl] Apply-templates - how to , Mike Schinkel | Date | RE: [xsl] Apply-templates - how to , Mike Schinkel |
Month |