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

Re: [xsl] things about grouping

Subject: Re: [xsl] things about grouping
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxx>
Date: Thu, 29 Nov 2012 05:58:45 +0000

> Since we're talking about "except" and language definitions, has anyone
> ever proposed a different form (or is there a different form for) the
> construct:
> div[not(* except (heading,para))]
> It's really useful, but I find it frequently brain-melting, especially
> as a component of more complex expressions.

A problem here is the mixture of notation from mathematical (set
theoretic in the form of except) and non-mathematical (the comma

Then you have the not operator  and the * operator straddling the two domains.

I'll try and recast this in the set-theoretic domain   to get rid of
the type abuse by making the following (possibly wrong) assumptions

the comma operator corresponds to union written as | (by definition a
set is unordered so the additional ordering constraint imposed by the
, operator is meaningless)
* corresponds to the universal set U (in this case the universe is
restricted to child elements of div)
not is set theoretic complement which  I will rewrite as '
// is the set difference operator (borrowed from Haskell)

So we can reduced the parsing of the predicate to a problem of
elementary set theory

( U // (heading | para))'

 which you can solve yourself of avail of my effort below.

By equivalence or you can visualize with a Venn diagram

U // (heading | para) = U intersect (heading|para)'

By DeMorgan's law

( U intersect (heading|para)')' is

U' | (heading|para)

and since | is associative we can rewrite as U' | heading | para

By definition U' is the empty set

and the empty set | X is X.

So unless there is a problem with my translation I'd say that your
predicate evaluates to heading|para

and your expression is div[(heading|para].

Now (get ready for the leap of faith and giant hand wave), substitute
the comma operator back for the | and you have div[(heading,para]

So how do

Current Thread