W3C home > Mailing lists > Public > xsl-editors@w3.org > July to September 2006

XSL Transformations (XSLT) -> copy-of element

From: Maciej Jaros <egil@wp.pl>
Date: Fri, 29 Sep 2006 12:38:49 +0300
Message-ID: <451CE9A9.8000801@wp.pl>
To: xsl-editors@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:58 GMT