xsl-list
[Top] [All Lists]

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

2014-02-02 16:48:51
You've somehow got it into your head that the context for evaluation of the rh 
operand depends on the lh operand. Like I said, you're thinking of it as a 
predicate. That's not the case.

descendant::* except self::heading

must be wrong, because the descendant axis never includes a node that's on the 
self axis: this is like saying "all my descendants except myself".

Michael Kay
Saxonica


On 2 Feb 2014, at 21:50, Graydon <graydon(_at_)marost(_dot_)ca> wrote:

On Sun, Feb 02, 2014 at 09:04:28PM +0000, Michael Kay scripsit:
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've found it useful to read "except" as "without"; I have a sequence,
and what I get is that sequence without the members of this other
sequence which I get to define.

The place I usually get snarled up is remembering that the sequences
are.

* except heading

is easy, that's "all the element children without any heading children", 
(child::*) except (child::heading)

* except (heading, references)

is easy, that's "all the element children without any members of this
thing that's really a sequence which happens to be defined as heading or
reference elements",
(child::*) except (child::heading,child::references)

descendant::* except heading

is really "all the descendant elements without any child heading
elements of the context node", and that's usually a source of
intractable bugs.  I think it should be

descendant::* except self::heading

if I want all the descendant elements without any of the descendant
elements who happen to be heading elements.

But then in XSLT 3.0 (at least as currently available) I can say

<xsl:template match="descendant::* except self::heading">
<!-- something happens -->
</xsl:template>

and I get lost because I have no idea how the first sequence is defined.

-- Graydon

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



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