Incorrcect handling of namespace
--------------------------------

                 Key: XALANJ-2404
                 URL: https://issues.apache.org/jira/browse/XALANJ-2404
             Project: XalanJ2
          Issue Type: Bug
          Components: XSLTC
    Affects Versions: 2.7
         Environment: Windows 2003 Server / XP
            Reporter: Robert Strickland
            Priority: Critical


Please find below a description of a critical problem found in Xalan 2.7.0 
related to the handling of namespaces while using compiled XSLTs (i.e. with 
XSLT).
 
The problem occurs when a set of nodes with namespaces is created in a template 
and copied to the output using the xsl:copy-to functionality. The resulting 
output does not include the namespace prefixes for the node set copied to the 
output.
 
Here is an example XSLT:
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" 
xmlns:err="urn:swift:xsd:error.report" xmlns:test="http://com.swift.sws/test";>
 <xsl:output encoding="UTF-8" indent="no" method="xml" version="1.0"/>
 
 <xsl:template match="/">
  <xsl:element name="test:Result">
   <xsl:variable name="var">
    <xsl:apply-templates select="doc"/>
   </xsl:variable>
   <xsl:copy-of select="$var"/>
  </xsl:element>
 </xsl:template>
 
 <xsl:template match="doc">
  <xsl:element name="err:Error">
   <xsl:element name="err:Reason">content</xsl:element>
  </xsl:element>
 </xsl:template>
 
</xsl:stylesheet>

 
This XSLT applied to following XML document:
 
<?xml version="1.0" encoding="UTF-8"?>
<doc>
</doc>

 
 the expected output is:
 
<?xml version="1.0" encoding="UTF-8"?>
<test:Result xmlns:test="http://com.swift.sws/test";>
    <err:Error xmlns:err="urn:swift:xsd:error.report">
        <err:Reason>content</err:Reason>
    </err:Error>
</test:Result>

 
This is the result that is obtained with the following transformers:
Java 1.5.0_11 default transformer. 
Java 1.6.0_02 default transformer. 
Xalan 2.7.0 interpreted
However, when applying the exact same transformation using Xalan 2.7.0 compiled 
(with XSLTC), the result is as follows:
 
<?xml version="1.0" encoding="UTF-8"?>
<test:Result xmlns:test="http://com.swift.sws/test";>
    <Error xmlns:err="urn:swift:xsd:error.report">
        <Reason>content</Reason>
    </Error>
</test:Result>

The namespace "urn:swift:xsd:error.report" is correctly defined on the "Error" 
element but the "Error" and "Reason" elements have no tag prefix. This means 
that these elments belong to the default namespace and not to the expected 
namespace "urn:swift:xsd:error.report". The result is therefore wrong.
 
This is a blocking issue for us since this means that it is not possible to use 
Xalan 2.7.0 compiled XSLTs. Using Xalan 2.7.0 in translated form is not an 
option due to performance reasons.
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to