On Wednesday, March 13, 2002, at 08:25 pm, Szymon Stasik wrote:

>
> Hi,
>
>
> I have some weird problem that seems to be cocoon/trax related. Let's 
> have two simple files:
>
>
> bug/src.xml (should be allowed to be much more complicated):
>
> <?xml version="1.0"?>
> <root><addsql/><root>
>
>
> bug/addsql.xsl:
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:template match="addsql">
>   <execute-query xmlns="http://apache.org/cocoon/SQL/2.0";>
>     <query name="file">SELECT 1 AS bug</query>
>   </execute-query>
> </xsl:template>
> <xsl:template match="@*|node()|text()" priority="-1">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>
> </xsl:stylesheet>

The definition of XSLT states that:

> node() matches any node other than an attribute node and the root node

So this would explain the non-matching of your root node.

xsl:copy, as I understand it, makes a copy of the node set matched by 
the template match.  I wonder if the match on "node()" but not on "*" 
(representing an element node) means that the resulting copy of the node 
excludes the uniquely element type attributes of the node.  The 
definition of xsl:copy indicates that it automatically copies the 
namespace axis of elements, but perhaps it doesn't if the element is 
matched as a node?

This is the copy-all match I regularly use without problem in my 
stylesheets:

> <xsl:template match="*|comment()|text()|node()" priority="-1">
>     <xsl:copy>
>         <xsl:copy-of select="@*" />
>         <xsl:apply-templates />
>     </xsl:copy>
> </xsl:template>

Stuart.



            Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
      Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
-------------------------------------------------------------------------
Stuart Roebuck                                  [EMAIL PROTECTED]
Systems Architect                             Java, XML, MacOS X, XP, 
etc.
ADOLOS                                           <http://www.adolos.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to