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

Mike Brown commented on XALANJ-2334:
------------------------------------

I'm the originator of this issue, but will not be able to test the fix anytime 
soon. I'd appreciate it if someone else could verify it on my behalf. Thanks.

> Namespace nodes are generated for empty namespace
> -------------------------------------------------
>
>                 Key: XALANJ-2334
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2334
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: Xalan
>    Affects Versions: 2.7
>            Reporter: Mike Brown
>            Assignee: David Marston
>            Priority: Minor
>             Fix For: 2.7.1
>
>         Attachments: xalan2334-tests.patch, 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.
-
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