Subject: Re: [xsl] Why doesn't <xsl:copy> copy xmlns=""? From: Michael Kay <mike@xxxxxxxxxxxx> Date: Sat, 17 Nov 2012 19:54:01 +0000 |
Michael Kay Saxonica
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Why doesn't <xsl:copy> co, G. Ken Holman | Thread | [xsl] Implementing Closures in XSLT, Costello, Roger L. |
Re: [xsl] Hanging regex, Ihe Onwuka | Date | Re: [xsl] Hanging regex, David Carlisle |
Month |