Re: [xsl] The identity transform and attributes

Subject: Re: [xsl] The identity transform and attributes
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 21 Jan 2008 14:01:06 +0000
On 21/01/2008, Abel Braaksma <> wrote:
> My intuition is the same as yours ;) I understand the reasoning behind
> the decisions, but I find myself doing a lot of extra work when I am
> dealing with attributes.

That describes it nicely.  Although I've been working with this for
years now, I still rarely get it right the first time around when
comes to attributes.

So for a bit of a summary - 2.0 makes things much simpler (as usual ):

To process all attributes except one:

@* except @foo

To check if the current attribute is a particular one:


...and we should perhaps re-learn the identity transform for 2.0 as:

<xsl:template match="element()">
       <xsl:apply-templates select="@*,node()"/>

<xsl:template match="attribute()|text()|comment()|processing-instruction()">

...which might make attribute processing more intuitive for future xslt'ers.

Andrew Welch

Current Thread