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/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--