[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to preserve a node's value containing escaped text (

Subject: Re: How to preserve a node's value containing escaped text (' and " in particular)?
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 26 May 2000 16:33:53 -0600 (MDT)
xml value containing
> Given the following input XML:
> 
> <InputText>&lt; &gt; &amp; &apos; &quot;</InputText>

The entity references will be resolved by the XML parser before the XSLT
processor sees them. The source tree will look something like:

root
  |___element: InputText
         |___text: < > & ' "

> I was hoping to get the following output:
> 
> <OutputText>&lt; &gt; &amp; &apos; &quot;</OutputText>
>
> Instead, I get:
> 
> <OutputText>&lt; &gt; &amp; ' "</OutputText>

Why were you hoping to get the entity references? It makes no difference.
The document you are producing, if XML or HTML, is a stream of bytes that
represent a physical sequence of UCS characters that in turn represent an
underlying sequence of abstract UCS characters. It is the underlying
sequence that is the essence of your document; parsed general entity
references are part of the physical layer and do not change the meaning of
the document as far as an XML or HTML application is concerned.

When you copy the text node containing markup characters to the result
tree with your stylesheet, and the XSLT processor serializes it with an
output method, the XSLT processor will decide how to escape the markup
characters for the chosen output method. You do not have any control over
this process, nor should you need to, for a case like this. I think the
only place where &quot; and &apos; need to be used in XML and HTML is when
' or " appear in an attribute value that is also delimited by those
characters.

   - Mike
___________________________________________________________
Mike J. Brown, software engineer, Webb Interactive Services
XML/XSL stuff: http://www.skew.org/    http://www.webb.net/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.