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 2006/12/12 00:48:22 UTC

[jira] Commented: (XALANJ-2334) Namespace nodes are generated for empty namespace

    [ http://issues.apache.org/jira/browse/XALANJ-2334?page=comments#action_12457511 ] 
            
Brian Minchau commented on XALANJ-2334:
---------------------------------------

>From the Xalan-J bug triage on December 11,2006:
       > Related to 2150. Henry Z. says the DTM contains nodes for namespace
       > undelcaration and those nodes are then found when navigating the 
       > namespace axis.  2334 describes the problem of undeclaration of
       > the default namespace, while 2150 describes the problem of undeclaration
       > of any namespace.
       > Kevin Cormier agreed to create the new testcase for 2334 and 2150
       > ... but testcases that are XML 1.1 related should be in the accept bucket.
       > Dave Marston thinks that we should have an issue to track that
       > some 'namespace' tests should be moved from conformance to acceptance buckets.
       >

> Namespace nodes are generated for empty namespace
> -------------------------------------------------
>
>                 Key: XALANJ-2334
>                 URL: http://issues.apache.org/jira/browse/XALANJ-2334
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: Xalan
>    Affects Versions: 2.7
>            Reporter: Mike Brown
>            Priority: Minor
>         Attachments: xmlns.xml, xmlns.xsl
>
>
> When elements in the empty namespace (no namespace) are descendants of nodes in some other unprefixed namespace, in Xalan is reporting namespace nodes for the default, empty namespace -- i.e., it is saying there are namespace nodes that have an empty string-value and empty local-name corresponding to xmlns="".
> The first paragraph of XPath 1.0 section 5.4 and the behavior of other processors indicates such nodes are not part of the XPath data model. That is, it is impossible to have a namespace node whose string-value is an empty string; namespace nodes only indicate what *non-empty* namespaces are in scope.
> The presence of the extra nodes is redundant; it's implicit that the element is in no namespace if it has no namespace nodes with an empty local-name.
> The following example demonstrates. The stylesheet serializes the 'e' elements, showing their namespace node information. Elements 1-4 have extraneous namespace nodes. The others are fine.
> xmlns.xml
> ==========
> <data>
>   <group xmlns="http://example.com/foo">
>     <!--e elements in empty namespace, ancestors in non-empty namespace-->
>     <group xmlns="">
>       <e>one</e>
>       <e>two</e>
>       <group>
>         <e>three</e>
>         <e>four</e>
>       </group>
>     </group>
>     <!--e elements in same non-empty namespace as ancestor-->
>     <group>
>       <e>five</e>
>       <group>
>         <e>six</e>
>       </group>
>     </group>
>   </group>
>   <!--e elements and ancestors in non-empty namespace-->
>   <group>
>     <e>seven</e>
>   </group>
> </data>
> xmlns.xsl
> ==========
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:output method="xml" indent="yes"/>
>   <xsl:template match="/">
>     <xsl:apply-templates select="//*[local-name()='e']"/>
>   </xsl:template>
>   <xsl:template match="*[local-name()='e']">
>     <Element content="{.}">
>       <xsl:for-each select="namespace::*">
>         <Namespace prefix="{local-name()}">
>           <xsl:value-of select="."/>
>         </Namespace>
>       </xsl:for-each>
>     </Element>
>   </xsl:template>
> </xsl:stylesheet>
> expected
> =========
> <?xml version="1.0" encoding="UTF-8"?>
> <Element content="one">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> </Element>
> <Element content="two">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> </Element>
> <Element content="three">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> </Element>
> <Element content="four">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> </Element>
> <Element content="five">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix="">http://example.com/foo</Namespace>
> </Element>
> <Element content="six">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix="">http://example.com/foo</Namespace>
> </Element>
> <Element content="seven">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> </Element>
> actual (with Xalan-J 2.7.0)
> =======================
> <?xml version="1.0" encoding="UTF-8"?>
> <Element content="one">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix=""/>
> </Element>
> <Element content="two">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix=""/>
> </Element>
> <Element content="three">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix=""/>
> </Element>
> <Element content="four">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix=""/>
> </Element>
> <Element content="five">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix="">http://example.com/foo</Namespace>
> </Element>
> <Element content="six">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> <Namespace prefix="">http://example.com/foo</Namespace>
> </Element>
> <Element content="seven">
> <Namespace prefix="xml">http://www.w3.org/XML/1998/namespace</Namespace>
> </Element>
> I have a real-world stylesheet that serializes elements as character data, in XML syntax, in an HTML textarea. I rely on the namespace axis to faithfully report what namespaces are in scope. I'd like to not have to go out of my way to ignore extra namespace nodes in this one XSLT processor.
> Thanks for considering this issue.

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org