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

Re: [xsl] except (was: Keys with duplicates should be simple)

Subject: Re: [xsl] except (was: Keys with duplicates should be simple)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 2 Feb 2014 21:46:36 -0800

I have both graduate-level mathematics education and not extremely-bad

I have never found any problems with the name of the XPath 2.0
operator "except".

The name clearly conveys the semantics -- both to non- mathematicians
and to people with mathematics background.

Also, it is a notable achievement that the WGs involved in producing
the XPath 2.0 and the F &O   W3C specifications, found a good *single*
word for what mathematicians express using a 2-word phrase.

The main thing to remember when using the operators "union",
"intersect" and "except" is that they are set operators and cannot be
applied on arbitrary sequences -- such that contain one or more atomic

Of course, it would be unrealistic to expect that the names could also
convey the set-based semantics, without becoming much longer and
confusing to the non-mathematician.

On Sun, Feb 2, 2014 at 1:04 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>> So while I agree with you on the whole, I also make an exception for
>> 'except'. It just isn't that bad. Indeed, there is an entire
>> profession of people (I think they're called 'mathematicians') who
>> consider such verbal stunt work to be just a day at the office.
> Indeed, I'm a little curious as to why "except" causes problems. I think we
chose "except" rather than "difference" because "except" would be more
meaningful to non-mathematicians.
> We often get people on XSLT forums who are sufficiently unfamiliar with
boolean logic that they use "and" and "or" incorrectly. For example, they will
use "and" to mean "union", as in
> select="para and section"
> which is natural enough if you understand English and don't understand
maths. I don't think it would have been prudent to design a language in which
"and" meant "union". So in general, maths is a better guide to these operators
than English.
> But as for "except", it seems very natural to me:
> select="* except para"
> seems to reflect normal English usage, such as "all vehicles except
bicycles". (Allowing plurals would make it more readable, but that's asking a
bit much...)
> Perhaps you are reading "except" as "that are not", i.e. a negated predicate
rather than a set difference). In English this reading would often work, as in
"all vehicles that are not bicycles". But in English grammar, what follows
"except" is not a predicate that qualifies what precedes it: you cannot say
"all vehicles except blue". So I think the XPath usage is aligned with English
usage in this instance.
> I'm not sure I followed the thread carefully enough, but I think the
usability problem in this case was not in fact the "except" operator, but
rather the use of "para" to mean "child::para" rather than "self::para".
That's probably an inevitable price you have to pay for conciseness: wherever
you allow defaults, they will sometimes be wrong.
> Michael Kay
> Saxonica

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.
To invent, you need a good imagination and a pile of junk
Never fight an inanimate object
To avoid situations in which you might make mistakes may be the
biggest mistake of all
Quality means doing it right when no one is looking.
You've achieved success in your field when you don't know whether what
you're doing is work or play
To achieve the impossible dream, try going to sleep.
Facts do not cease to exist because they are ignored.
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
I finally figured out the only reason to be alive is to enjoy it.

Current Thread