xsl-list
[Top] [All Lists]

Re: [xsl] The identity transform and attributes

2008-01-21 05:35:51


I've been caught out before doing things like:
I think that's a different problem though, unrelated to the fact that
attributes don't take children.


...which doesn't work - you have to use name()
at least you don't have to use name in xslt2 (although you still can't
use self::)
"@* except @foo"
for example works and probably is more readable than the self:: test anyway.

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

The confusing thing is that attribute nodes are on the self axis, if you
are on an attribute then self::attribute() selects the current node,
it's "just" that the QName node test always goes via the "principle node
type" kludge/feature and they decided to keep that being fixed for each
axis to a single node type, element in the case of self::. personally I
think it would have been much simpler if axis::foo had selected any node
with name foo that is in the axis axis:: It's hard to make any examples
where that formulation would have been different in practice from what
was specified, except for making self::foo select an attribute named foo
if it is the current node, which would have been an improvement.
in xpath2 of course you can go self::attribute(foo) but I can't see what
harm would have resulted from allowing (in xslt 1) self::foo for this.
In XPath 2 I think, given that attribute(foo) and the execpt operator
make the use for this a lot more rare anyway, they were right to keep
things compatible (but strange)


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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--