[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 12:23:41 +0000
Re:  The identity transform and attributes
On 21/01/2008, David Carlisle <davidc@xxxxxxxxx> wrote:
> > It's certainly not intuitive that when you what to just change the
> > attribute's value you have to create a new attribute node
>
> Intuition is a personal thing but I don't see why that's not
> intuitive. xslt never updates nodes in place, so you always generate new
> nodes.

Sure, but I meant along the lines of copy vs create... To update an
element's "value" you tend to copy it rather than create a new one.
To update an attribute's value I would say it's intuitive to try the
same approach, especially when the name and value are clearly separate
(to me!).


> Attributes are leaf nodes and work the same way as namespace nodes, and
> PI nodes (that is they have a name and value but no children) element
> nodes are the only ones to have name and children, document nodes have
> children but no name, and comments and text nodes have a value but no
> name.

I've been caught out before doing things like:

<xsl:template match="@*[not(self::foo)]">

...which doesn't work - you have to use name()

Again, I don't know why the self axis isn't available for attribute
nodes... any ideas?



-- 
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.