Hi,
The "vertical slices" you are referring to are called siblings. This is
more apparent if the tree structure is written as
a
/ \
b e
/ \
c f
/ \
d g
To retrieve the siblings of a node, you can refer to the documentation on
the various axes [1].
Here is a simple example to print the siblings of <e>. In this case, we
want to use preceding-sibling and following-sibling.
<xsl:template match="e">
<xsl:for-each select="preceding-sibling::*" |
following-sibling::*">
<xsl:value-of select="name(.)"/>
</xsl:for-each>
</xsl:template>
[1] http://www.w3.org/TR/xpath#axes
Thanks,
Richard Cao
XSLT Development, Toronto IBM Lab
(905) 413-2454 T/L 969-2454
[EMAIL PROTECTED]
Bennett
<[EMAIL PROTECTED]
p.com> To
[EMAIL PROTECTED]
10/09/2003 04:30 cc
PM
Subject
"vertical slices" of tree
Hello,
Say I have the following tree:
<a>
<b>
<c>
<d/>
</c>
</b>
<e>
<f>
<g/>
</f>
</e>
</a>
If I'm calling this into the stylesheet via document():
- How do I get the names of all elements on the same "vertical
slice"
that <b> and <e> are on?
- or the names of all the elements on the same "vertical
slice" as <c>
and <f> ?
- or the names of all the elements on the same "vertical
slice" as <d>
and <g>?
Note: the names of the elements aren't static so I can't just specify a
static path to anything.
Any ideas?
TIA
- "vertical slices" of tree Bennett
- Re: "vertical slices" of tree Richard Cao
- Re: "vertical slices" of tree Joseph Kesselman
- Re: "vertical slices" of tree Johannes Lebek
- Re: "vertical slices" of tree david_marston
