RE: [xsl] [XSL] copying namesapces with prefix "xmlns:".

Subject: RE: [xsl] [XSL] copying namesapces with prefix "xmlns:".
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 Aug 2005 09:08:14 +0100
Use 

<xsl:copy-of select="namespace::*"/>

Note that namespace nodes are not attributes in the XPath data model, and
xsl:attribute will only construct attribute nodes, not namespace nodes.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: siva [mailto:siva@xxxxxxx] 
> Sent: 26 August 2005 07:01
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] [XSL] copying namesapces with prefix "xmlns:".
> 
> Hi,
> 
> I wants to copy the namespaces from my input.xml to 
> output.xml using xsl.
> 
> For example,
> Input.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <Package Id="typeoperation" ......
> xmlns:any="http://any/";>
> ...........
> 
> Output.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions Id="typeoperation" ......
> xmlns:any="http://any/";>
> .............
> 
> I have tried the following and which will give error  "Illegal value 
> used for attribute name: xmlns: ".
> ............
> <definitions>   
>     <xsl:for-each select="namespace::*">
>           <xsl:attribute name="xmlns:{$NameSpace}"><xsl:value-of 
> select="$Location"/></xsl:attribute>
>     </xsl:for-each>       
> </definitions>
> ............
> 
> Could anyone help me??

Current Thread