xsl-list
[Top] [All Lists]

XPath - How to select preceding nodes that are descendants of specific ancestor?

2004-06-26 04:19:16
Hi.

I've got a problem that I can only seem to solve using node-set - and I
can't use node-set in my current XSLT processor.

I have an XML document with multiple subtrees starting at element
'SUBTREE' containing 'LEAF' leaf element descendants at various
hierarchical depths.
I need to know - for each 'LEAF' element - how many preceding 'LEAF'
elements there are within the closest ancestor 'SUBTREE'.

The document has many SUBTREES - so if I just use the 'preceding::' axis
and do a subtraction the processing time is horrendously long.

I've tried applying various predicates to the 'preceding::' axis
(e.g. preceding::LEAF[generated-id(ancestor::SUBTREE[1])=generate-id(current()/ancestor::SUBTREE[1])]
)
but these still seem to be pretty slow.


This feels like it should have an elegant and efficient solution - but I can't find one.

Any help greatly appreciated.

Thanks.






<Prev in Thread] Current Thread [Next in Thread>