XSL Transformations (XSLT) -> copy-of element

Hi.

Sorry to bother you, but one part of the recommendation is not really 
clear to me. I'm not sure about this statement in the copy-of:

> When the result is a node-set, all the nodes in the set are copied in 
> document order into the result tree; copying an element node copies 
> the attribute nodes, namespace nodes and children of the element node 
> as well as the element node itself...

What does it mean to copy namespace nodes?

I'll give you an example of what troubles me here. Below you have a 
simple XML document

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl" ?>
<document>
    <svg>
        <circle cx="30" cy="10" r="5" />
    </svg>
</document>

Here is an XSL for it:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/2000/svg">

    <xsl:template match="/">
        <svg width="200px" height="200px">
            <circle cx="10" cy="10" r="5" />
            <xsl:apply-templates select="//svg" />
        </svg>
    </xsl:template>

    <xsl:template match="svg">
        <xsl:copy-of select="*"/>
    </xsl:template>
</xsl:stylesheet>

This should give me an XML document:

<svg xmlns="http://www.w3.org/2000/svg" width="200px" height="200px">
    <circle cx="10" cy="10" r="5"/>
    <circle cx="30" cy="10" r="5"/>
</svg>

So is this an error to consider the second (copied) circle to be in the 
SVG namespace? To put it in another way: what is the namespace of the 
copied element - the one defined in the XML document or in the XSL document?

It would be quite natural to me if the resulting document would be 
treated as if it would be like that all the time, but as both Opera and 
Firefox display only one circle, then I'm not sure if this is a bug on 
there side or am I wrong here?

Best regards,
Maciej Jaros.

-- 
E-mail: egil@wp.pl

Received on Friday, 29 September 2006 12:38:39 UTC