Thanks for the reply.
Part of your problem is that you are using xsl:value-of rather than
xsl:copy-of, value-of always
As I understand it, copy-of does a literal copy, and does not apply any
templates, right?
-Mike
-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]
Sent: Thursday, September 08, 2005 4:45 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Apply-templates - how to omit top level element tags?
Unfortunately, I still don't grok the difference between:
Unfortunately, I still don't grok the difference between:
*
.
node()
Part of your problem is that you are using xsl:value-of rather than
xsl:copy-of, value-of always gives teh _string value_ of its argument,
so you never see the difference between an element and a text node using
value-of
Consider an input of
<a>www
<b>zzz</b>
<!-- yyy -->
<z/>
</a>
and
<xsl:template match="a">
...
</xsl:template>
then if ... is
<xsl:copy-of select="."/>
You will output a copy of the current node (which is a) a node includes
all children etc so you get
<a>www
<b>zzz</b>
<!-- yyy -->
<z/>
</a>
then if ... is
<xsl:copy-of select="*"/>
then * is short for child::* and selects all child elements so you get
<b>zzz</b><z/>
note, no top level a, no comments and no text nodes, including
indentation white space nodes.
then if ... is
<xsl:copy-of select="node()"/>
then node() is short for child::node() which selects all child nodes
(elements, text, comments and processing instructions) and you get
www
<b>zzz</b>
<!-- yyy -->
<z/>
(no top level <a> element, as you only copied children.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. For more information on a proactive anti-virus
service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--