Subject: Re: the nearest ancestor with the attribute
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 16 Jan 2001 19:00:54 +0000
|
Hi Wendell,
>> > ancestor::*/@attr
[snip]
>>
>>I don't think so. The first in this case is the first in document order,
>>which isn't the nearest in the ancestor axis.
>
> Hm. About this, see XPath 2.4. ancestor is a reverse axis. I don't see
> anything here that changes the order to document order.
You're absolutely right that the ancestor axis is a reverse axis. If
you were using:
ancestor::*[1]/@attr
you'd be fine (aside from the fact that you'd be stuffed if the node's
parent didn't have a 'attr' attribute). However, the last axis used in
the XPath is the 'attribute' axis, which takes you back to document
order again. To get the last one, use:
ancestor::*/@attr[last()]
At least I *think* that's right ;)
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Re: the nearest ancestor with the attribute, (continued)
- Wendell Piez - Mon, 15 Jan 2001 17:12:31 -0500 (EST)
- Vun Kannon, David - Mon, 15 Jan 2001 16:59:33 -0500 (EST)
- Oliver Becker - Tue, 16 Jan 2001 03:28:01 -0500 (EST)
- Wendell Piez - Tue, 16 Jan 2001 11:39:19 -0500 (EST)
- Jeni Tennison - Wed, 17 Jan 2001 03:55:34 -0500 (EST) <=
- Michael Kay - Wed, 17 Jan 2001 04:33:06 -0500 (EST)
- Jeni Tennison - Wed, 17 Jan 2001 05:53:44 -0500 (EST)
- Wendell Piez - Wed, 17 Jan 2001 14:08:10 -0500 (EST)
- Michael Kay - Thu, 18 Jan 2001 04:45:33 -0500 (EST)
|
|