RE: [xsl] Using copy-of to grab child nodes

Subject: RE: [xsl] Using copy-of to grab child nodes
From: "Brian Martinez" <Brian.Martinez@xxxxxxxxxxxx>
Date: Mon, 20 Nov 2006 14:52:43 -0600
<xsl:copy-of select="text/*" />

Your original expression selects any <text> nodes which have child
nodes, and copy-of in that case would include the <text> node as well as
its children.

> Also, is this list appropriate for asking about ASP.net code in the
> context of using it to create and transform XML?

I don't think it's technically off-topic, but you may get a better
response on one of the XML-specific over at MSDN.

Cheers,
b.

> -----Original Message-----
> From: Austin, Darrel [mailto:Darrel.Austin@xxxxxxxxxxxxxxxxxx]
> Sent: Monday, November 20, 2006 1:19 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Using copy-of to grab child nodes
>
> I have xhtml in my xml document. So, it looks like this:
>
> <item>
> <title>title</title>
> <text><p><strong>my text</strong></p></text>
> </item>
>
> In my xslt I want to grab all the HTML in the text node and just spit
it
> out (as HTML).
>
> To do that, I'm using this:
>
> <xsl:copy-of select="text[child::*]" />
>
> Which, I'm guessing, is wrong, as it's actually writing out the
'<text>'
> itself. <My rendered HTML looks like this:
>
> <h1>Title</h1>
> <text><p><strong>my text</strong></p></text>
>
> Can anyone fix my syntax to get rid of the 'text' nodes?
>
> Also, is this list appropriate for asking about ASP.net code in the
> context of using it to create and transform XML?
>
> -Darrel

Current Thread