|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] backwards tree-traversal algorithm?
hello, having some trouble making this work: within my stylesheet,
i have selected a node somewhere in the midst of the document tree,
several nested elements deep. what i would like to do is, given
this node N (at arbitrary depth), walk *back* up the document tree
hierarchy, element by element, printing the successive parent elements
(technically, printing each element's "name" @ribute).
so with node N being <c> and the following document:
<root>
<a>
<b>
<c/>
</b>
<d/>
<e/>
</a>
</root>
i want to print: b, a, root.
my pseudocode was along the lines of:
current = node
while current != root
current = ../
print current/@name
seems simple.
recursive templates seemed like the way to do this in xsl, but i
can't get this to do anything, apparently because the processor i'm
using (sablotron 0.90) won't let me use XPath on the node set i am
passing with call-template (as a param) because it's "not a node-set".
so i guess i have two questions:
1. what is the best algorithm/approach to walk back up the parent:: tree, printing each element?
2. does sabcmd not have a node-set() function? is this what's stopping me?
(if it helps, the stylesheet will know what depth level the current
node is at, and the unique @name attribute of each parent element.)
jm3 / john manoogian III / http://jm3.net / jm3@xxxxxxx
> > > http://jm3.net/linkworld < < <
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








