[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] things about grouping

Subject: Re: [xsl] things about grouping
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 28 Nov 2012 09:47:06 +0000

On 28/11/2012 07:04, Ihe Onwuka wrote:

Well XPath has direct support for union and intersect so for
completeness we would expect it to support difference. Thats
reasonable isn't it. So lets go to the part of the specification that
deals with set theoretic operators and see what it says.

The first hint of trouble is in the URL.


Lets read on and see why there is support for union and intersection
and not difference.

op:union 	Returns the union of the two sequence arguments, eliminating
op:intersect 	Returns the intersection of the two sequence arguments,
eliminating duplicates.
op:except 	Returns the difference of the two sequence arguments,
eliminating duplicates.

So difference is supported except (pun intended) it is called except.

But (sic) the semantic of except  that has been ingrained in us since
childhood is that when you say  A except B, B takes it context from A.

You are not really suggesting that set difference operation (except) should behave differently with respect to the current node than the union and intersect operations (or list concatenation are you?

in all these cases A and B are evaluated the same way

A intersect B
A except B

If I understand your message correctly you are arguing that it would somehow have been simpler if in the third case only the current node when evaluating B was somehow different, I'm not sure what exactly,
would you want to evaluate B at every item in A?

In general XPath operators take _values_ (Xpath sequences) not expressions so they are always (conceptually) evaluated before the operator. A except B evaluates A and B and then returns all teh items in A that are not in B.

The path separator / and filter [] are different in that they are specific syntax that changes the current item.


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

Current Thread