Re: [xsl] The identity transform and attributes

Subject: Re: [xsl] The identity transform and attributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 21 Jan 2008 12:02:58 GMT
> 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.

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.

So while it's true that the specific properties of each node type
are different, I don't see anything particularly surprising about
attributes. While it would I suppose be possible to model an attribute
value as a child text node, the behaviour of that child relationship
would be very different from children for document and element nodes:
the child axis would (presumably) have to be constrained to be a single
text node, with other node kinds not being allowed.

David




________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread