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

Re: Unescaping < and >

Subject: Re: Unescaping < and >
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 24 Jun 2003 18:33:12 -0400
xslt unescaping
Hi Arthur,

At 05:14 PM 6/24/2003, you wrote:
Is there any way of unescaping a "&lt;" and "&gt;" from a text() element.

No, although one occasionally hears rumors of extension elements to parse inline text-with-pseudo-markup into node structures. (Note you really need a node subtree, not a string of markup. The XSLT processor doesn't deal with markup and has no interest in it: all parsing has been done for it up front. Hence, you're not really asking for anything to be "unescaped" ... you're really asking for your text node to be parsed.)


I'd like to re-inject what is supposed to be xml, but is provided instead as escaped text within document elements.

This is an insidious and highly doubtful practice, both practically and in principle, but surprisingly common, leaving you with an ugly requirement. :-> (How do you know the stuff is well-formed? If the process guarantees it, then why not just fold it in as XML instead of disguising it as text-with-angle-brackets? If it doesn't, why are we pretending/hoping it does? I have yet to see a convincing use case for this.)


If you're using Saxon, I think later versions have an extension you can use, that returns a node set for a string. Otherwise, I couldn't say. You could use a pre-process to unescape the characters before parsing, and thereby run the risk of breaking your documents irremediably.

I've tried modifying the identity transform

It won't help. XSLT is designed to keep your mitts off the markup. On balance, this is a good thing. (Angle bracket mungling is really not so fun after a month or three.)


Note that what appears as "& g t ;" in a document *is* an angle bracket ">" -- but not a markup delimiter (that's the point).

This question comes up from time to time so someone else may have a more helpful answer.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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.