xsl-list
[Top] [All Lists]

Re: [xsl] Why doesn't <xsl:copy> copy xmlns=""?

2012-11-17 13:54:15
If the xmlns="" appears on the outermost element then the XDM data model is indistinguishable from one in which the xmlns="" is absent - so the XSLT processor doesn't know it's there.

If it appears elsewhere the question gets terribly complicated: see

https://www.w3.org/Bugs/Public/show_bug.cgi?id=5857

Michael Kay
Saxonica


On 17/11/2012 13:39, Costello, Roger L. wrote:
Hi Folks,

I want to do an identity transform of this:
----------------------------------------------------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
                       targetNamespace="http://www.bar.com";
                        xmlns:bar="http://www.bar.com";
                        xmlns=""
                        elementFormDefault="qualified">
...

</xs:schema>
----------------------------------------------------------------------------

Notice the default namespace declaration, xmlns=""

Here is the code that I use to do the identity transform:

     <xsl:template match="xs:schema">
         <xsl:copy>
             <xsl:copy-of select="@*" />
             <xsl:sequence select="node() | comment() | processing-instruction()" 
/>
         </xsl:copy>
     </xsl:template>

(I use this code because I actually do more than just an identity transform, 
which I do not show here.)

Here is the output from transforming the <xs:schema> with my code:
----------------------------------------------------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
                       targetNamespace="http://www.bar.com";
                        xmlns:bar="http://www.bar.com";
                        elementFormDefault="qualified">
...

</xs:schema>
----------------------------------------------------------------------------

Yikes!

What happened to the default namespace declaration?

Questions:

1. Why is my code not copying over the default namespace declaration?

2. What change can I make to my code to ensure that it copies over the default 
namespace declaration?

/Roger

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>