Re: [xsl] Using attributes with XPath

Subject: Re: [xsl] Using attributes with XPath
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 24 Aug 2006 14:31:46 +0100
Mike I'm not sure what you mean by this:

> 2. Here the meaning is something like 
> <xsl:template match="@type[....]"/>

the OP's original code of

<xsl:template match="@type[parent::list]"/>

was correct although most people would write it as

<xsl:template match="list/@type"/>

> Certainly, it
> is more than obvious that an attribute must have some relationship
> with the element it stands with, it cannot be floating in space.

although XSLT2 does in fact allow you to generate attribute nodes that
do just that.
<xsl:variable name="a" as="attribute()">
<xsl:attribute name="x">y</xsl;attribute>

then $a is an attribute node with no parent (and can't be serialised
unless it is copied into the content of an element being constructed)


Current Thread