Subject: [xsl] Why doesn't <xsl:copy> copy xmlns=""? From: "Costello, Roger L." <costello@xxxxxxxxx> Date: Sat, 17 Nov 2012 13:39:20 +0000 |
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] Hanging regex, Ihe Onwuka | Thread | Re: [xsl] Why doesn't <xsl:copy> co, Martin Honnen |
Re: [xsl] Hanging regex, David Carlisle | Date | Re: [xsl] Why doesn't <xsl:copy> co, Martin Honnen |
Month |