xsl-list
[Top] [All Lists]

Re: [xsl] [Summary] Three ways to express in XPath that there are no duplicates in a list of items

2012-11-02 10:35:31

On 02/11/2012 14:25, Dimitre Novatchev wrote:

I believe that it we re-write this in a more specific form then it
wouldn't be so optimizer specific:

   not(//Websites/*[position() = count(distinct-values(//Websites/*))+1])

or does this require the same degree of cleverness than the previous
expression does?

Either way it requires the optimizer to work out that

count(distinct-values(//Websites/*))+1

returns the same value for all the nodes in

//Websites/*

which means working out that (a) all the results in //Websites/* are nodes in 
the same document, and (b) the expression 
count(distinct-values(//Websites/*))+1 is dependent on the context document but 
not on the context item.

Saxon has been able to do that for years, but there are many XPath engines, 
smaller and lighter than Saxon, that don't attempt anything near this level of 
analysis.

Michael Kay
Saxonica








--~------------------------------------------------------------------
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>
--~--