xsl-list
[Top] [All Lists]

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

2012-11-17 07:39:35
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>
--~--


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