Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 22nd, 2003, 01:36 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old August 22nd, 2003, 01:45 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
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
Reply With Quote
  #3 (permalink)  
Old August 22nd, 2003, 01:55 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
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.
Reply With Quote
  #4 (permalink)  
Old August 22nd, 2003, 03:09 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
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.
Reply With Quote
  #5 (permalink)  
Old August 22nd, 2003, 03:24 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
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
Reply With Quote
  #6 (permalink)  
Old August 24th, 2003, 08:09 AM
joefawcett's Avatar
Wrox Author
Points: 9,731, Level: 42
Points: 9,731, Level: 42 Points: 9,731, Level: 42 Points: 9,731, Level: 42
Activity: 8%
Activity: 8% Activity: 8% Activity: 8%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,068
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 08: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 01:42 AM



All times are GMT -4. The time now is 05:32 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.