Re: [xsl] Escaped characters being duplicated

Subject: Re: [xsl] Escaped characters being duplicated
From: "Anderson, Paul" <Paul.Anderson@xxxxxxxxxxxxx>
Date: Wed, 12 Dec 2007 11:44:16 -0500
Thank you for the responses so far. There has been some progress on this
issue that I want to report. First, let me answer a few questions that
were raised and ask a few new ones.

David commented:
>It's most likely a problem in input or output (are you passing
serialised
>xml documents between the applications or in memory trees of some
sort)?

All the XML documents remain on the file system. The JSP page uses a
class (we call it ThreadedAntBuilder) that implements Runnable to invoke
Ant and run the build script. We add properties to this class to act as
the "environment variables" that would be present if you ran the Ant
script from the command line. That ThreadedAntBuilder class is wrapped
in a Java Thread and we start the Thread to run the build.

>If a document gets passed through an XML serialisation stage twice then
>XMl characters such as < may get quioted twice (but then I;d expect
>&amp;lt; rather than &lt;&lt;.

I've double checked and verified the following:
&amp; becomes &amp;&amp;
&lt; becomes &lt;&lt;
&gt; becomes &gt;&gt;

Michael commented
>The conversion from "<" to "&lt;" is done by the XML serializer. The
fact
>that you're using the Saxon XSLT processor doesn't necessarily mean
that
>you're using the Saxon serializer (the Saxon output could be sent to a
DOM
>which is then serialized using the DOM serializer); it would be a good
idea
>to find out what serializer is actually being used. The easiest way to
find
>out is to see whether the serialization is affected by xsl:output
>declarations in the stylesheet.

I'll have to try this. I assume you mean I should try changing the
doctype-system and doctype-public attributes?

Michael queried:
>How did you satisfy yourself that both the successful and the
unsuccessful
>runs are using Saxon 6.5.5?

I added the following to the root template of each XSL file:
<xsl:message>Vendor: <xsl:value-of
select="system-property('xsl:vendor')"/></xsl:message>

The Ant log, using Ant's XmlLogger class, then contains:
     [xslt] Vendor: SAXON 6.5.5 from Michael Kay

The new progress is that further testing has associated the problem with
Java 1.6x. All the users who have the duplication problem are running
Java 1.6x. All the users who are still running Java 1.5x do not have
this problem. Keep in mind that the duplication only happens when users
invoke the Ant script that runs the transforms from a JSP page served by
Tomcat. When users invoke the Ant script from the command line, using
either Java 1.5x or Java 1.6x, we get no duplication.

So, to summarize:
If the Tomcat process is using Java 1.6x, we get duplication.
If the Tomcat process is using Java 1.5x, we get no duplication.

Based on this revelation, does anybody have further ideas?

Best regards,

Paul Anderson
Information Developer - Codex Administrator
Compuware Corporation
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Current Thread