Subject: Re: [xsl] xsl:value-of, xsl:copy, xsl:copy-of From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 6 Dec 2004 16:15:51 GMT |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:value-of, xsl:copy, x, Marian Olteanu | Thread | [xsl] apply 2 diff xsl on the same , ficfic m |
Re: [xsl] grouping and sum, dmitrik | Date | Re: [xsl] grouping and sum, David Carlisle |
Month |