xsl-list
[Top] [All Lists]

Re: xpath question, getting last instance of element

2003-02-25 11:47:23
At 2003-02-25 13:37 -0500, Alan Stein wrote:
I'm trying to figure out how to select the final instance of "DDD" in the following example,

(//DDD)[last()]

By putting the XPath expression in parentheses you are obtaining the set of all DDD elements from the whole document. Then, applying the predicate to the entire set, you end up with the last DDD. Had you not used parentheses you would end up with the set of all DDD elements that are the last of their sibling DDD elements.

I hope this helps.

................... Ken


--
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO
                             North America:      June 16-20, 2003

G. Ken Holman                mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1              Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list