Subject: Re: [xsl] The identity transform and attributes From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 21 Jan 2008 12:35:23 GMT |
> 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. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] The identity transform an, Andrew Welch | Thread | Re: [xsl] The identity transform an, Abel Braaksma |
Re: [xsl] The identity transform an, Andrew Welch | Date | Re: [xsl] The identity transform an, Abel Braaksma |
Month |