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

Re: prevent xslt ant task using xalan from converting

Subject: Re: prevent xslt ant task using xalan from converting CDATA to spaces
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 25 Feb 2004 20:52:32 GMT
ant cdata
> How do I prevent the CDATA from being transformed into spaces ?
?? It isn't being transformed into spaces.
The sole purpose of CDATA is to "auto" quote < and & XPath does not
record whether a < character was input as &lt; or as <![CDATA[<]]> these
are equivalent input and both reported by the parser as a single <
character, so XSLT can not distinguish these.

Why do you need it to be something that looks like a comment but inside
a Cdata section rather than a real comment? If your input file had a
real comment you wouldn't have the problem, you could just copy the
comment node. 

If you can't change the input, then if this text is inside an element
rather thna at the top of the file you can specify that element as a
cdata-section-elements attribute to xsl:output, then it will linearise
the content of that element using CDATA rather than character entities.

Note however that either format is equivalent to teh next xml parser in
the chain though so this should be a cosmetic change.


      <!-- Evil work-around for Xalan warning message about not being able to
           copy the jsp:root version attribute which is mandatory for JSP -->

You'd be getting that because you are trying to add attributes (by
applying templates to @*) after you have added your jsp:directive and
jsp:scriptlet elements and you have to add attributes first.

remove the |@* from your apply-templates and instead have 
<xsl:copy-of select="@*"/> immeditately after the xsl:copy.

David


-- 
http://www.dcarlisle.demon.co.uk/matthew

 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.