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

Re: Converting markup to non-markup

Subject: Re: Converting markup to non-markup
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 12 Sep 2002 07:50:08 -0600 (MDT)
xslt lt gt amp
Lars Eskildsen wrote:
> I want to be able to convert an XML snippet like:
> 
> <CONV_TAG>
>     <TAG1 ATTR1="VAL1">Statement: 4 &lt; 5</TAG1>
> <CONV_TAG>
> 
> to this XML code:
> 
> <CONVERTED_TAG>
>    &lt;TAG1 ATTR1=&quot;VAL1&quot;&gt;Statement: 4 &amp;lt; 5&lt;/TAG1&gt;
> </CONVERTED_TAG>

Have a look at http://www.xmlportfolio.com/xml-to-string/

Note that it is a FAQ on this list that converting the output back into
a node-set or copying it to output without escaping, can be quite difficult.

> The problem is i want to convert standard entities inside non-markup content. 
> 
> &lt;	to 	&lt;lt;
> &gt;	to 	&gt;gt;
> &amp;	to	&amp;amp; 

I don't think that's really what you meant. (&lt;lt; should be &amp;lt;, 
right?)  Regardless, you must understand that this in your XML, in the content
of an element...

  Statement: 4 &lt; 5

...is reported by an XML parser (to the XSLT processor) as the character data

  Statement: 4 < 5

You have no access to the lexical details like entity references and character 
references, just like you have no access to the fact that attribute values 
might be quoted with " in some cases and ' in others. (Another FAQ)


   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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.