Richard Tobin wrote:
Yes, but given the OP's example:
You're right, I was reading in a hurry, as well entangling his two
sketched soltuions. (Sorry; negotiating on a house and somewhat
distracted.) Lemme recheck...
<Accept>
<XXXX/>
<Token image="From"/>
<Date value="2007-01-01"/>
<Token image="To"/>
<Date value="2007-01-01"/>
</Accept>
>"child::Toke n[fn:upper- case(@image)='T O']/following-sibling::*"
In this particular example, that should return the second Date. If there
are any other elements following the "TO" token, they will also be
returned. Given the <XXXX/>, I presume this is a simplified example, and
thus I presume he'd be better off limiting it.
"child::Tok en[fn:upper- case(@image)='T O']/following-sibling::*[1]"
indeed ought to work, to return the first following sibling element.
(though I'd still suggest explicitly using "child::Tok en[fn:upper-
case(@image)='T O']/following-sibling::Date[1]")
His workaround, "child::Tok en[fn:upper-case(@image)='F ROM']/
following-sibling::*[2]", SHOULDN'T work -- that should be returning the
"TO" token, not the date, assuming the description of the input is
correct. He claims it does work, which suggests that either the XPath
implementation he's using is broken or that the input isn't actually as
shown.
I may still be half-asleep and distracted and incoherent; apologies if
so... but there's something here I'm missing.
(This is why associated data should generally be grouped as
parent-child, or in a higher-level wrapper, or as attributes on a single
element, rather than counting on the order.)
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry