You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2007/10/09 18:27:50 UTC

[jira] Commented: (XALANJ-2404) Incorrcect handling of namespace

    [ https://issues.apache.org/jira/browse/XALANJ-2404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533406 ] 

Brian Minchau commented on XALANJ-2404:
---------------------------------------

Robert,
On first glance I agree that this is bug.

The XSLT 1.0 recommendation says this on the namespace attribute of xsl:element (which you didn't use).  See section 7.1.2
    http://www.w3.org/TR/xslt#section-Creating-Elements-with-xsl:element
<<
If the namespace attribute is not present then the QName is expanded into an expanded-name using the namespace declarations in effect for the xsl:element element, including any default namespace declaration.
>>

The namespace with prefix "err" is in scope here.


> 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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org