Thanks to all respondants, especially Ken for explaining how predicates bind
to parts of the expression (neat) ... for those that missed it :-
So, I suggest that the following will get you the
first <Value> in the document regardless of the depth of the element:
(//Value)[1]
Hugh explained why your prior attempts don't work
... my wording for this is as follows: //Value[1]
won't work because the predicate is bound at the
step level so "//" looks through the entire
document and "Value[1]" which is an abbreviation
for "child::Value[1]" returns the first child
named "Value", so the combination returns "the
first child named Value at every level of the document".
This is a trick question I have had in my
hands-on XSLT training class since 1999
I just knew I should have booked your course :-)
I've also see it at conferences where vendors post it
on a white board as a "challenge" to stylesheet
writers to determine who knows their XPath and who doesn't.
Oh dear, looks like I failed that test then :-)
Fraser.
--~------------------------------------------------------------------
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>
--~--