Re: [xsl] Value-of, copy-of

Subject: Re: [xsl] Value-of, copy-of
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 27 Feb 2002 12:51:14 -0500
Mike and Eric,

Mini XPath abbreviations lesson:

[1] '.' is short for 'self::node()'

so <xsl:copy-of select="."/> is saying "copy the context node".

[2] if no axis is given in the step of a location path, interpolate "child::"

so <xsl:copy-of select="node()"/> is short for <xsl:copy-of select="child::node()"/>, i.e. "copy the child nodes of the context node".

This is what accounts for the behavior you're seeing.

At 12:17 PM 2/27/2002, Mike wrote:
I changed my style sheet and got the results I wanted. I read on p.
187 of Kay's book (1st edition) that copy-of is gives you the content
without the opening and closing tag of the node, if you use it with

<xsl:copy-of select="node()"/>

Strictly speaking, it's not that the node is copied without its tags -- it's that the node is not copied, but all its children are. (Tags only appear when and if the result tree gets serialized as markup.)


He also says that xsl:copy-of does not allow you to controll what
nodes are being included in the output (p. 182), but xsl:copy does.
That was another problem I am having.

Yep: xsl:copy-of gives you a "deep copy" (all the way down from the node you copy), while xsl:copy only copies one level, while allowing you include more instructions (such as apply-templates) to graft more stuff under the node you've copied.


I hope that clears things up a bit,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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



Current Thread