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=25993>.
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=25993

XSLTC does not merge xsl:output attributes properly

           Summary: XSLTC does not merge xsl:output attributes properly
           Product: XalanJ2
           Version: CurrentCVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Quoting the XSLT 1.0 recommendation, section 16 (just before 16.1) :
<<A stylesheet may contain multiple xsl:output elements and may include or 
import stylesheets that also contain xsl:output elements. All the xsl:output 
elements occurring in a stylesheet are merged into a single effective 
xsl:output element. For the cdata-section-elements attribute, the effective 
value is the union of the specified values.>>

The following testcase:
-----------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
  xmlns:prfx1="http://buyit.com";> 

<xsl:output 
  method="text" 
  indent="yes" 
  encoding="US-ASCII" 
  omit-xml-declaration="yes"
  cdata-section-elements="prfx1:cdata1" />

<xsl:output 
  method="xml" 
  cdata-section-elements="prfx1:cdata2" 
  omit-xml-declaration="no" />

<xsl:template match="/">
<output>
<prfx1:cdata1>This should be a cdata section and the output method should be 
xml, and indented</prfx1:cdata1>
<prfx1:cdata2>This should be a cdata section and the xml header should be 
present too</prfx1:cdata2>
</output>
</xsl:template>

</xsl:stylesheet>
-----------------------------------------

Produces this for Xalan-J interpretive:
---------------------------------------
<?xml version="1.0" encoding="US-ASCII"?>
<output xmlns:prfx1="http://buyit.com";>
<prfx1:cdata1><![CDATA[This should be a cdata section and the output method 
should be xml, and indented]]></prfx1:cdata1>
<prfx1:cdata2><![CDATA[This should be a cdata section and the xml header should 
be present too]]></prfx1:cdata2>
</output>
---------------------------------------
So Xalan-J clearly merges the elements as its output method is "xml", it is 
indented but its encoding is "US-ASCII".

On the other hand, XSLTC produces this:
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<output xmlns:prfx1="http://buyit.com";><prfx1:cdata1><![CDATA[This should be a 
cdata section and the output method should be xml, and indented]]
></prfx1:cdata1><prfx1:cdata2><![CDATA[This should be a cdata section and the 
xml header should be present too]]></prfx1:cdata2></output>
----------------------------------------

XSLTC has lost all information from the first xsl:output element except for the 
cdata cdata-section-elements lists.

XSLTC needs to merge xsl:output attributes into one effective xsl:output 
element. Both Xalan-J and XSLTC do not report the error that there are more 
than one value for an xsl:output attribute (other than cdata-section-elements) 
and they take the specified recovery of using the last value specified in the 
stylesheet.

Reply via email to