xsl-list
[Top] [All Lists]

RE: how to insert the *complete* content of a node

2003-03-21 08:27:55
I too have hit this problem, perhaps I have overlooked something here
but an xs:copy-of or a deep copy will return an exact copy:

Given an input of:
<mytag>blabla <foo>foo text</foo> other stuff </mytag>
an xsl:copy-of will result in:
<mytag>blabla <foo>foo text</foo> other stuff </mytag>

ie , the same, which is not necessarily what you want, ie you may want:

<peter name="yes" att="yes">
blabla <foo>foo text</foo> other stuff
</peter>

so how would I get this, ie what would the xsl be?

Regards Peewee
-----Original Message-----
From: Robert P. J. Day [mailto:rpjday(_at_)mindspring(_dot_)com] 
Sent: 21 March 2003 14:07
To: xsl list
Cc: danilo
Subject: Re: [xsl] how to insert the *complete* content of a node

On Fri, 21 Mar 2003, Jeni Tennison wrote:

Hi Danilo,

I have some node that may contain *any* text, including
xml/html-like
text.
I mean something like:

<mytag>blabla <foo>foo text</foo> other stuff </mytag>

I have to produce the complete content of the mytag tag:

blabla <foo>foo text</foo> other stuff 

Use <xsl:copy-of> and select all the children of the <mytag> element
using the node() node test (which matches any node, including elements
and attributes):

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

<xsl:copy-of> gives you an exact copy of the nodes.

uh oh ... i'm confused again.  i thought "node()" explicitly
did *not* match attribute nodes, but only

1) elements
2) text
3) comments
4) processing instructions

was the original poster concerned about attributes as well?

rday


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



BBCi at http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain 
personal views which are not the views of the BBC unless specifically 
stated.
If you have received it in error, please delete it from your system, do 
not use, copy or disclose the information in any way nor act in 
reliance on it and notify the sender immediately. Please note that the 
BBC monitors e-mails sent or received. Further communication will 
signify your consent to this.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list