DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6109>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6109

xsl:comment tags cause truncated output from stylesheet





------- Additional Comments From [EMAIL PROTECTED]  2002-01-30 
17:01 -------
Here is some additional information on this bug. 

We are only encountering this problem under the IBM jdk1.2.2; we don't 
encounter it under the sun jdk. 

We have developed a transformation engine that caches a pool of stylesheet 
templates objects. Each transformation reuses the templates objects that have 
been compiled by XSLTC using the XALAN2.2 TRAX API. A new Transformer instance 
is created every time to run the transformation. Our transformation engine runs 
as a servlet under Websphere 3.5.2, but we have also reproduced this bug using 
a straight java application using the IBM jdk. 

The first transformation against the cached templates object runs fine. It's 
the succeeding transformations that truncate the output after an xsl:comment 
element. We have also noted that the problem is related to a combination of 
using an xsl:comment tag and a xsl:for-each element in the stylesheet. If no 
xsl:for-each element is in the stylesheet, then xsl:comment works fine, and if 
no xsl:comment is in the stylesheet then xsl:for-each works fine. It seems to 
be the combination of the two in a stylesheet that cause this problem.

Here's the sample stylesheet, input xml, and output html from the 
transformation.

Sample stylesheet:
-----------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
        <xsl:output method="html" media-type="text/html" indent="yes"/>
        <xsl:template match="Request">

<html>
<head>
        <title>XSLTC Error</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1"/>
        <SCRIPT LANGUAGE="JavaScript">
        <xsl:comment>
                function test() {}
        //</xsl:comment>
        </SCRIPT>
</head>
<body bgcolor="white" text="#000000" onLoad="test()">
        <select name="selectUserID" size="1">
                <xsl:for-each select="./List/User">
                        <xsl:element name="option">
                                        <xsl:attribute name="value">
                                                <xsl:value-of 
select="./id"></xsl:value-of>
                                        </xsl:attribute>
                                        <xsl:value-of 
select="./name"></xsl:value-of>
                        </xsl:element>
                </xsl:for-each>                                                 
                        
        </select>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-----------------------------------------------------------

Sample input XML to transformation:
-----------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Request>
        <List>
                <User>
                        <id>xxx</id>
                        <name>Ren</name>
                </User>
                <User>
                        <id>yyy</id>
                        <name>Stimpy</name>
                </User>
                <User>
                        <id>aaa</id>
                        <name>Starsky</name>
                </User>
                <User>
                        <id>bbb</id>
                        <name>Hutch</name>
                </User>
        </List>
</Request>
-----------------------------------------------------------

Sample output for two successive runs of the transformation. Note that the 
first runs produces the correct output, but the second run truncates the body 
section of the html:

-----------------------------------------------------------
Compiling stylesheet sample.xsl ...
Finished compiling stylesheet sample.xsl.

Processing transformation...

<html>
  <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>XSLTC Error</title><meta http-equiv="Content-Type" 
content="text/html; charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript"><!--
                function test() {}
        //--></SCRIPT>
  </head>
  <body bgcolor="white" text="#000000" onLoad="test()">
    <select name="selectUserID" size="1">
      <option value="xxx">Ren</option>
      <option value="yyy">Stimpy</option>
      <option value="aaa">Starsky</option>
      <option value="bbb">Hutch</option>
    </select>
  </body>
</html>
Transformation complete.


Processing transformation...

<html>
  <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>XSLTC Error</title><meta http-equiv="Content-Type" 
content="text/html; charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript"><!--
                function test() {}
        //--></SCRIPT>
  </head>
</html>
Transformation complete.
-----------------------------------------------------------

Here's the environment setup information that is output from our java 
application that runs the transformations:

-----------------------------------------------------------
#---- BEGIN writeEnvironmentReport($Revision: 1.9 $): Useful stuff found: ----
java.version=1.2.2
version.JAXP=1.1
version.crimson=not-present
java.class.path=C:\java\xml\xalan-j_2_2_0\bin\java_cup.jar;C:\java\xml\xalan-
j_2_2_0\bin\jlex.jar;C:\java\xml\xalan-j_2_2_0
\bin\runtime.jar;C:\java\xml\xalan-j_2_2_0\bin\xerces.jar;C:\java\xml\xalan-
j_2_2_0\bin\xml-apis.jar;.;C:\java\xml\xalan-j_2_2_0
\bin\xalan.jar;C:\java\xml\xalan-j_2_2_0
\bin\xsltc.jar;c:\java\mocha;c:\java\mocha\Mocha.zip
#---- BEGIN Listing XML-related jars in: foundclasses.java.class.path ----
xerces.jar-path=c:\java\xml\xalan-j_2_2_0\bin\xerces.jar
xerces.jar-apparent.version=xerces.jar WARNING.present-unknown-version
xml-apis.jar-apparent.version=xml-apis.jar present-unknown-version
xml-apis.jar-path=c:\java\xml\xalan-j_2_2_0\bin\xml-apis.jar
xalan.jar-apparent.version=xalan.jar WARNING.present-unknown-version
xalan.jar-path=c:\java\xml\xalan-j_2_2_0\bin\xalan.jar
xsltc.jar-apparent.version=xsltc.jar present-unknown-version
xsltc.jar-path=c:\java\xml\xalan-j_2_2_0\bin\xsltc.jar
#----- END Listing XML-related jars in: foundclasses.java.class.path -----
java.ext.dirs=K:\bin\ibmjdk1.2.2\jre\lib\ext
version.xalan2_2=Xalan Java 2.2.0
version.DOM=2.0
version.xalan2x=Xalan Java 2.2.0
version.xerces2=not-present
version.xerces1=Xerces 1.4.4
version.DOM.draftlevel=2.0fd
version.ant=not-present
version.xalan1=not-present
version.SAX=2.0
sun.boot.class.path=K:\bin\ibmjdk1.2.2\jre\lib\rt.jar;K:\bin\ibmjdk1.2.2
\jre\lib\i18n.jar;K:\bin\ibmjdk1.2.2\jre\classes
#----- END writeEnvironmentReport: Useful properties found: -----
# YAHOO! Your environment seems to be OK.

Using org.apache.xalan.xsltc.trax.TransformerFactoryImpl factory implementation
-----------------------------------------------------------

Reply via email to