Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old August 22nd, 2003, 12:36 PM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
 
Old August 22nd, 2003, 12:45 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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
 
Old August 22nd, 2003, 12:55 PM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old August 22nd, 2003, 02:09 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
 
Old August 22nd, 2003, 02:24 PM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old August 24th, 2003, 07:09 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Instead of
Code:
<xsl:copy-of select="myNode" />
try
Code:
<xsl:copy-of select="myNode/node()" />
--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
General XSLT Questions in the XSLT Forum jminatel BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 0 March 31st, 2008 07:50 PM
Copy element into complexType in XSLT 2BOrNot2B XSLT 3 December 20th, 2006 09:09 AM
Copy all contents except current node in XSLT 2BOrNot2B XSLT 2 December 19th, 2006 06:44 PM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 12:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.