Re: [xsl] XSL resources - Flat to hierarchy - Common ancestors

Subject: Re: [xsl] XSL resources - Flat to hierarchy - Common ancestors
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Jul 2004 16:37:03 +0100
> 1) do the nodes returned by ancestor-or-self retain their hierarchy?
If you mean what I think, then yes. Nodes live in the input tree and
have the same parents children etc however they are selected.

< 2) when I do an apply templates on ancestor-or-self, do they 'remember'
> the rest of the document, ie. Can the called template access their
> children etc.?

yes, see above

> 3) Why do I need the ::Menu?

when you go select="foo" it is short for seelct="child::foo" and selects
the foo children of wherever you are. If that's notthe direction you
want to go, you head in another direction around the tree with another
axos eg select="following-sibling::foo" selects siblings instead of
children. Since yor posted code was child::Menu the short answer to your
question is: you don't need it.

> 4) Why does child::Menu seem to return all the descendants and not just
> the first generation?

It doesn't it just selcts the children.
but you have copy of and copy of on an element node copies the entire
branch rooted at that node. If youjust want a "shallow" copy that gets
that element but none of its children ise xsl:copy.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread