xsl-list
[Top] [All Lists]

Re: [xsl] Duplicate Elimination

2014-03-13 08:50:44

On 13-3-2014 13:11, Ihe Onwuka wrote:
On Thu, Mar 13, 2014 at 11:56 AM, David Carlisle 
<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
It's iterating through representatives of the quotient set if you factor
by the relation implied by the group-by clause.
A union (B difference A). People who speak English will understand that.

Not sure where this is going, but I personally don't immediately grab
either explanation, they both require a double or triple read. That
might be my lack of English, or my lack of understanding the underlying
problem. However, I do know that I find grouping, when expressed in XSLT
2.0+ terms, fairly understandable on itself.

will not work for anybody restricted to XSLT 1.0

It's easy to rewrite any such use of for-each-group as xsl-for-each plus
a filter using a key (look up muenchian grouping for the details)

Easy for who?

Where's that quote from Mike Kay that use of xsl:key should be common
knowledge in XSLT development - which obviously suggests that it is
not.

Whether or not Michael Kay has at some point in time considered it
should be common knowledge or not does not really matter towards people
that require any kind of grouping in XSLT 1.0. Since grouping is such a
common requirement, I think most XSLT 1.0 programmers are acquainted
with some form of grouping, whether it is Muenchian grouping or another
form.

Whether it is "easy" is hard to say and depends highly on the
individual, I think. For instance, many of my programmers can write a
Bubble Sort algorithm down on paper during an interview, but I wouldn't
be able to. Yet for me, Muenchian grouping is "easy", but then again, I
have had my share of XSLT 1.0 grouping challenges. For just about any
programming pattern, using it becomes "easy" once you grasp its
principles, but if you've never used it, the abstractness of a pattern
may make it hard to grasp at first.

You wrote about explaining it to your client. I wouldn't use that term
if I explained it to my client, I would just say something like
"key-based grouping improved performance, which is why we chose it". But
performance was not an issue, so I guess this argument is void ;).

For a quote from Michael Kay, here is one that I found
(http://www.oxygenxml.com/archives/xsl-list/200412/msg01020.html) when
googling his name and Muenchian grouping, where he writes:

"Muenchian grouping makes it easy to group on the result of any path
expression, e.g. [....]"

But surely, that doesn't mean it is "easy" for everyone ;).

and does not port to XPATH or XQuery.
For xquery you can use the similar group-by clause so long as you
are using V3 http://www.w3.org/TR/xquery-30/#id-group-by
For the cognoscenti who have access to 3.0 processors,  the same group
of people that almost have nothing to learn from reading any of this.

I use XSLT 3.0 daily, but still learn a lot from reading about XSLT 1.0
discussions. A recent post from G. Ken Holman was of particular
interest, about a trick to get the static base uri of the current XSLT
file. It was one of these rare "wow" moments. So please, keep
discussions on XSLT 1.0 alive and let us, XSLT 3.0 people, enjoy it too ;).

Abel Braaksma
Exselt XSLT 3.0 processor
http://exselt.net

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

<Prev in Thread] Current Thread [Next in Thread>