XSLTC produces incorrect output for multiple default namespaces
---------------------------------------------------------------

         Key: XALANJ-2069
         URL: http://issues.apache.org/jira/browse/XALANJ-2069
     Project: XalanJ2
        Type: Bug
  Components: XSLTC  
    Versions: 2.6    
 Environment: Windows XP, J2SE 1.5.0 default SDK install, Eclipse 1.0.1 defualt 
install. JAXP interface
    Reporter: Benjamin


Input template:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/">
<core:Display
        xmlns:core="http://example.com/core";
        xmlns:foo="http://example.com/java/foo";
        >
        <core:Styles xmlns="http://example.com/java/foo";>
                <Constant/>
        </core:Styles>
        <core:View xmlns="http://example.com/java/javax.swing";>
                <!-- workaround for buggy(?) XSLT processor.-->
                <!--This should work:-->
                <foo:Constant/>
                <!--Workaround is:-->
                <!--xsl:element
                        namespace="http://example.com/java/foo";
                        name="Constant"
                        /-->
        </core:View>
</core:Display>
</xsl:template>
</xsl:stylesheet>

Input document:
<doc/>

Expected result:
<?xml version="1.0" encoding="UTF-8"?>
<core:Display xmlns:core="http://example.com/core";
xmlns:foo="http://example.com/java/foo";>
<core:Styles xmlns="http://example.com/java/foo";>
<Constant/>
</core:Styles>
<core:View xmlns="http://example.com/java/javax.swing";>
<foo:Constant/>
</core:View>
</core:Display>

Actual result:
<?xml version="1.0" encoding="UTF-8"?>
<core:Display xmlns:core="http://example.com/core";
xmlns:foo="http://example.com/java/foo";>
<core:Styles xmlns="http://example.com/java/foo";>
<Constant/>
</core:Styles>
<core:View xmlns="http://example.com/java/javax.swing";>
<Constant/>
</core:View>
</core:Display>

(Note second Constant tag is missing namespace prefix)

The error only occurs when a node is defined when its namespace was the default,
then later the same node is defined when its namespace is no longer the default.
The lack of prefix the second time around means it goes into the new (now
incorrect) default namespace. This example is a cut-down version of working
software.

I'm fairly new to the Java sphere, so am not 100% sure of version numbers. I'm
running Eclipse 3.0 and the 1.5.0 Java SDK and am using whatever the combination
of these two forces brings in by default. The classes that get instantiated
appear to be XSLTC-related, and I'm using the JAXP interface. My code looks
something like this:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder parser = factory.newDocumentBuilder();
Document template = parser.parse("transform.xsl");
Document instance = parser.parse("doc.xsli");
Document result = parser.newDocument();
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transform = factory.newTransformer(new DOMSource(template));
DOMResult doc = new DOMResult(result);
transform.transform(new DOMSource(instance), doc);

This is the same bug as the misfiled Bug 33783. This may be a duplicate of 
XALANJ-2032, but is probably an escilation since actual incorrect output is 
produced.

Benjamin.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to