At 02:08 PM 3/11/2004, it was written:
Hmm... What doesn't work? In the code below you should be able to just
change the
<xsl:value-of select="."/> to <xsl:copy-of select="./node()"/>
And ... today's little XPath lesson...:
[0] "." is short for "self::node()"
[1a] select="node()" is short for select="child::node()"
(select all child nodes of the context node)
[1b] select="./node()" is short for select="self::node()/child::node()"
(select all child nodes of the context node itself)
These are functionally equivalent, which makes this case very different
from another apparently similar pairing:
[2a] select="//node()" is short for
select="/descendant-or-self::node()/child::node()"
[2b] select=".//node()" is short for
select="self::node()/descendant-or-self::node()/child::node()"
That is, [2a] is the same as "/descendant::node()" (node descendants of the
root), while [2b] is the same as "self::node()/descendant::node()" (node
descendants of the context node) -- not the same thing at all.
Back to the thread ... if you want to copy the current node (with all
descendants), not just its children (with theirs), that's
<xsl:copy-of select="."/> (expands as in [0])
... or perhaps you really want to copy the node's children (with all
descendants) but not the node itself: you can do this with copy-of
select="node()" [1a].
I say "with all descendants" because that's what copy-of does. For the OP,
that's how the <a> node in the source gets included when its parent's
template says to copy node children.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list