cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck <stuartroeb...@mac.com>
Subject Re: [C2] xslt/namespace weird problem
Date Wed, 13 Mar 2002 22:04:54 GMT

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                                  stuart.roebuck@adolos.com
Systems Architect                             Java, XML, MacOS X, XP, 
etc.
ADOLOS                                           <http://www.adolos.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message