To copy the namespace nodes, you could apply this workaround,

<xsl:for-each select="exsl:node-set($ns-rtf)//*/namespace::node()">
   <xsl:copy />
</xsl:for-each>

(instead of, <xsl:copy-of select="exsl:node-set(
$ns-rtf)//*/namespace::node()"/>)

the above workaround gives the desired output.

On Thu, Oct 23, 2008 at 4:58 PM, Michael Ludwig <[EMAIL PROTECTED]> wrote:
> Xalan-J 2.7.1 fails to copy the namespace nodes from an RTF.
> Maybe this is a known issue. If so, my apologies.
>
> Saxon 6.5 and 9.1 as well as LibXSLT 1.1.24 produce namespace
> declarations as expected.
>
> Michael Ludwig
>
> Input:
> ------
> <Tomate/>
>
> XSL:
> ----
> <xsl:stylesheet version="1.0"
>  xmlns:exsl="http://exslt.org/common";
>  extension-element-prefixes="exsl"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>
>  <xsl:output indent="yes"/>
>
>  <xsl:variable name="ns-rtf">
>    <u:Urmel xmlns:u="http://urmel.de"/>
>    <g:Gurke xmlns:g="http://gurke.de"/>
>  </xsl:variable>
>
>  <xsl:template match="/*">
>    <xsl:copy>
>      <xsl:copy-of select="exsl:node-set( $ns-rtf)//*/namespace::node()"/>
>      <xsl:copy-of select="node()"/>
>      <xsl:element name="u:Test" namespace="http://urmel.de"/>
>      <xsl:element name="g:Test" namespace="http://gurke.de"/>
>    </xsl:copy>
>  </xsl:template>
>
> </xsl:stylesheet>
>
> Expected output:
> ----------------
> <?xml version="1.0"?>
> <Tomate xmlns:u="http://urmel.de"; xmlns:g="http://gurke.de";>
>  <u:Test/>
>  <g:Test/>
> </Tomate>
>
> Xalan-J 2.7.1 output:
> ---------------------
> <?xml version="1.0" encoding="UTF-8"?><Tomate>
> <u:Test xmlns:u="http://urmel.de"/>
> <g:Test xmlns:g="http://gurke.de"/>
> </Tomate>
>



-- 
Regards,
Mukul Gandhi

Reply via email to