 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 22nd, 2003, 12:36 PM
|
|
Registered User
|
|
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
xslt copy-of
hello,
i have an xml node with some html tags within it:
<myNode>This is <b>bold</b> and this is <i>italics</i> in HTML.</myNode>
i want to copy everything in the node, EXCEPT the node name.
if i use <xsl:copy-of select="myNode" />
my result is: <myNode>This is <b>bold</b> and this is <i>italics</i> in HTML.</myNode>
is there a way to only get:
This is <b>bold</b> and this is <i>italics</i> in HTML.
so that <myNode> </myNode> is not in the return string?
as for a note, if i use <xsl:value-of select="myNode" /> , the HTML tags are lost.
|
|

August 22nd, 2003, 12:45 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
I think you should get what you want with this:
Code:
<xsl:value-of select="myNode" disable-output-escaping="no" />
------------------------
Peter
Somewhere outside
Boston, MA USA Earth
|
|

August 22nd, 2003, 12:55 PM
|
|
Registered User
|
|
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi planoie,
thanks for the suggestion and i gave it a try, but it did not give me the correct results, the result was the node value, without the html tags:
This is bold and this is italics in HTML.
what im looking for is:
This is <b>bold</b> and this is <i>italics</i> in HTML.
|
|

August 22nd, 2003, 02:09 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Ok, I just realized I made a mistake. Try disable-output-escaping="yes".
Maybe that will work. Otherwise, I think the transform is stripping or escaping the tags.
|
|

August 22nd, 2003, 02:24 PM
|
|
Registered User
|
|
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
gave that one a try also, but still the same result, i'll see what else i can find on the net,
thx again for your help
|
|

August 24th, 2003, 07:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Instead of
Code:
<xsl:copy-of select="myNode" />
try
Code:
<xsl:copy-of select="myNode/node()" />
--
Joe
|
|
 |