[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: The identity transform and attributes

Subject: Re: The identity transform and attributes
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 21 Jan 2008 14:01:06 +0000
Re:  The identity transform and attributes
On 21/01/2008, Abel Braaksma <abel.online@xxxxxxxxx> 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:

test="self::attribute(foo)"

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

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

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

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


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.