Subject: Re: [xsl] backwards tree-traversal algorithm? From: Stephen Cunliffe <scunliffe@xxxxxxxxxxxxxxxxxx> Date: Wed, 23 Oct 2002 10:51:55 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] backwards tree-traversal , Jeni Tennison | Thread | RE: [xsl] backwards tree-traversal , Andrew Welch |
RE: [xsl] Removing duplicates, Clay Leeds | Date | RE: [xsl] Question about MS setProp, Marrow |
Month |