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 November 7th, 2006, 04:46 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default html pass through

Hi,

I'm currently writing a template to translate someone's xml. I need a way to have a certain node to be passed through as is without removing elements. For example, I have this xml document:

<root>
   <element1>some text</element1>
   <element2>
      <text type="body">
         <p>Some content #8221;</p>
      </text>
   </element2>
</root>


in my xsl template, I want to have everything under the <text> element pass through as is, i.e. keep the "<p>Some content #8221;</p>" as is after translation. right now, all of the <p>'s are removed and the output escaping has been converted after translation. Thanks in advance.

-los

 
Old November 7th, 2006, 06:17 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can copy the content of the text element using

<xsl:template match="text">
  <xsl:copy-of select="child::node()"/>
</xsl:template>

The copy will be logically the same, but not necessarily lexically the same, for example the decimal numeric character reference might be replaced by a hexadecimal reference, or by the character itself if your output encoding includes that character. The original lexical form isn't known to the XSLT processor.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove orphaned html elements from html string pauliehaha C# 2008 aka C# 3.0 2 June 30th, 2008 09:40 AM
html:errors and html:messages sparun1607 Struts 0 November 23rd, 2006 08:34 AM
Can you preload child html files to 1parent html? bekim Javascript How-To 4 January 22nd, 2005 04:17 PM
pass html:errors to one of the frames srivalli9 BOOK: Professional Jakarta Struts 1 May 18th, 2004 12:53 PM





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