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

Re: CDATA and Named Entities to ASCII

Subject: Re: CDATA and Named Entities to ASCII
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Nov 2007 17:55:53 -0500
Re:  CDATA and Named Entities to ASCII
At 2007-11-30 22:51 +0000, Mark Anderson wrote:
I need to transform some XML to ASCII text.

However, the XML contains named entities - e.g. <a>this &amp; that</a>, and may contain CDATA - e.g. CDATA[This & That]]

Is there a way to transform the above to 'this & that'

<xsl:output method="text"/> will serialize your result tree as simple text without escaping markup-sensitive characters.


In your result tree all elements and attributes are ignored and all PCDATA is serialized to the output.

Construct your result tree as you would for any HTML or XML result ... that bit doesn't change ... putting out simple text is just a serialization issue.

Note that if you really need US ASCII 7-bit, then you would need:

<xsl:output method="text" encoding="US-ASCII"/>

Typically for 8-bit text I use the Latin-1 character set:

<xsl:output method="text" encoding="ISO-8859-1"/>

The default is UTF-8, a hybrid 7-bit/8-bit encoding.

I hope this helps.

. . . . . . . . Ken


-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

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.