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

(Re-)Escaping entities in input text

Subject: (Re-)Escaping entities in input text
From: David Vergnaud <dvergnaud@xxxxxxxxx>
Date: Wed, 20 Aug 2008 06:50:22 -0700 (PDT)
 (Re-)Escaping entities in input text

I was wondering whether there is an efficient way of "reescaping" the data read from the input file when saving it to an xs:string...

Here's the problem: my input is an XML file which contains text nodes, which in turn may contain escaped entities like &lt; (&amp;lt;) and such. Upon reading it, xsl:value-of (AFAIK) automatically converts these to the corresponding characters '<' etc -- this is completely transparent to the user agent, and in most cases this is sensible. However, in my case, I'm building a string which is actually XML code and whose text nodes are the nodes I've found in my input file. This XML string is then passed on to an external processor (Java class) for further processing. That means, whatever was escaped in my input file should still be escaped in the string, otherwise the string might not be well-formed, and my external processor won't be able to parse it. 

Of course, there is the possibility of replacing all 5 entities "by hand" by calling a transform function, however this might not be very efficient when the string is getting big. Is there either:
- a way of disabling entity interpretation with xsl:value-of (actually getting "&lt;" when it's written like this in the input file)
- a function to "reescape" a piece of text so that it's usable in an XML file/string? 

I know XSLT also escapes metacharacters automatically when outputting to a file, but since I'm only working internally with a string, this doesn't apply to me. "disable-output-escaping" is also not a solution, since it does pretty much exactly the contrary from what I'm trying to do... 

thx in advance for any help! :-)



Current Thread


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.
First Name
Last Name
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.