W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > October 2006

Match Pattern Proposal

From: Alex Milowski <alex@milowski.org>
Date: Tue, 31 Oct 2006 08:04:25 -0800
Message-ID: <45477409.5040009@milowski.org>
To: public-xml-processing-model-wg <public-xml-processing-model-wg@w3.org>

For a number of reasons--including support of streaming processors and
consistency between viewports and other constructs--I believe we should
restrict XPaths to match patterns for everything but parameters.  As
such, here is what I think is a cohesive proposal:

1. The XPath expressions on inputs via the 'select' attribute are
    restricted to match patterns.  Since we said we're sticking with
    XPath 1.0, we probably want XSLT 1.0 match patterns.

2. The 'select' attribute should be renamed to 'match' (or some
    name other than 'select') on p:input.

3. The default semantic is to return only the first matches (i.e.
    return the outermost element).

4. We should add an optional 'nested' attribute on p:input that
    which takes a boolean value.  A value of 'true' means you would
    return the nested matches as their own subtrees in document
    order.  The default is 'false' (i.e. part (3) of this list).

5. Parameters and choose constructs can continue to use full XPath
    expressions and so those attributes can retain their name of
    'select'.

The point of (3) and (4) is to cover Jeni's use case.  I think is
is consistent to deliver nested subtrees as long as the outer
subtree(s) is delivered as a whole.  The consequence of this is a lot
of caching by the implementation.  That's why the default is to
*not* deliver nested subtrees.

For parameters and choose/when constructs (i.e part (5) ), I think
the computational overhead and potential for caching anyway overrides
any possible gain you might have from restrictions to match patterns.
As such, if an implementation can detect and optimize those expressions,
they have the opportunity but a use will know that they are doing
something more expensive (just as in XSLT).


-- 
--Alex Milowski

"The excellence of grammar as a guide is proportional to the paucity
of the inflexions, i.e. to the degree of analysis effected by the
language considered."

Bertrand Russell in a footnote of Principles of Mathematics
Received on Tuesday, 31 October 2006 16:32:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:49 GMT