Re: [xsl] General rule for designing XPath expressions to return items in document order?

Subject: Re: [xsl] General rule for designing XPath expressions to return items in document order?
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Wed, 8 Jan 2014 10:48:59 -0000 (GMT)
On Wed, January 8, 2014 10:33 am, Costello, Roger L. wrote:
...
> I am seeking a general rule for designing XPath expressions to return the
> selected items in document order. Can you provide a general rule?

Put '/.' at the end:

      If E is any expression that returns a sequence of nodes,
      then the expression E/. returns the same nodes in document
      order, with duplicates eliminated based on node identity. [1]

Regards,


Tony Graham                                   tgraham@xxxxxxxxxx
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL-FO and XSLT consulting, training and programming
       Chair, Print and Page Layout Community Group @ W3C

[1] http://www.w3.org/TR/xpath20/#abbrev, last list item

Current Thread