Hi,
Can anyone provide a quick line or two that defines and
differentiates xsl:value-of, xsl:copy and xsl:copy-of? I understand
some of the differences and can get more info from books and online,
but in putting some training materials together I want to make sure I
understand this fully and get it as concise and correct as possible.
TIA,
xsl:value-of always returns the _string_ value of the node supplied in
its select attribute. (ie, teh concatenation of all the characers in its
descendants). If you supply a node set of more than one node, all but
the first node in document order will be discarded.
xsl:copy-of does a "deep copy" of its input, you can supply a value, or
a set of nodes, in its select attribute and all teh nodes/values will be
coped.
xsl:copy does a "shallow copy" it doesn't have a select attribute, and
for nodes without children (atributes/comments/processing instructions)
it does the same as copy-of, but for element nodes it just
generates an element node with the same name, without copying all
the child nodes. Typically you then use xsl:apply-templaes to generate
some new content that isn't a copy.
so if
<x>
<a>asd <b>ljh g</b> jhtg </a>
<y>knv <b>asjfgq</b> oiacb </y>
</x>
and the current node is x then
<xsl:value-of select="a|y"/>
is
"asd ljh g jhtg "
(characters in a, y is discarded)
<xsl:copy-of select="a|y"/>
is
<a>asd <b>ljh g</b> jhtg </a>
<y>knv <b>asjfgq</b> oiacb </y>
copy of those two elements
<xsl:copy>
generates a (currently empty) node
<x>
...
</x>
in the result tree.
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>
--~--