[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:value-of, xsl:copy, xsl:copy-of

Subject: Re: xsl:value-of, xsl:copy, xsl:copy-of
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 6 Dec 2004 16:15:51 GMT
value of xsl
   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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.