You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by TREGAN Fabien <Fa...@airbus.com> on 2002/07/03 10:29:55 UTC

CDATA disappears with 2.1

I made a custom transformer (wich transform XHTML into the Javascript String
containing the code of the corresponding HTML - please don't ask me why !)

It works well with 2.0.3, but I ned to know the performances with XSLTC, so
I use 2.1 for my tests. The XSL transformation is about 35% faster (just the
transformation, not the whole pipeline... far from the 80% expected ;) ),
but the "CDATA" block disappear : its content is viewable, but escaped.

I could not figure the difference in component définition... Does it come
from the Xalan jar used in 2.1 ? A change in
AbstractTransformer.startCDATA() ?


Code : 

	super.startCDATA();
	escapedHTML = replace(escapedHTML, "\n", "\\n");
	escapedHTML = replace(escapedHTML, "\r", "\\r");
	escapedHTML = replace(escapedHTML, "\"", "\\\"");
	super.characters(escapedHTML.toCharArray(), 0,
escapedHTML.length());
	super.endCDATA();

Pipeline :

		<map:pipeline>
			<map:match pattern="jsst*">
				<map:act type="TestBeanAction">
					<map:parameter name="nb" value="{1}"
/>
				</map:act>
				<map:generate src="test.xml" />
				<map:transform type="castor" />
				<map:transform
src="stylesheet/result2sdngui.xsl" />
				<map:transform
src="stylesheet/SelectList.xsl" />
				<map:transform type="jsst" />
				<map:serialize type="html" />
			</map:match>
		</map:pipeline>

Good result (2.0.3) :

<script>
		var addString = "<form
xmlns:sdngui=\"http://www.airbus.com/sdn/gui/v1\"
onmousedown=\"AActivate(this);\" [...] ";
</script>

(if I use <serialize type="xml" />, it gives : var addString =
"<![CDATA...")

Wrong result (2.1 - xsltc)

<?xml version="1.0" encoding="UTF-8"?>
<test>
	<script>
		var addString = "&lt;?xml version=\"1.0\"
encoding=\"UTF-8\"?&gt;\r\n&lt;form method=\"post\"
onmousedown=\"AActivate(this);\" [...] ";
	</script>
</test>

(if I use <serialize type="xml" />, it gives : var addString = "&lt;?xml
version=\"1.0\"...)

Wrong result (2.1 - no xsltc)

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:castor="http://castor.exolab.org/cocoontransfomer"
xmlns:jsst="http://www.airbus.com/caw/jsst">
	<script>
		var addString = "&lt;?xml version=\"1.0\"
encoding=\"UTF-8\"?&gt;\r\n&lt;form
xmlns:xmlns:sdngui=\"http://www.airbus.com/sdn/gui/v1\"
onmousedown=\"AActivate(this);\" [...] ";
	</script>
</test>


Any idea ?

fabien.

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>