[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: mixed content grouping by whitespace

Subject: RE: mixed content grouping by whitespace
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 13 Apr 2010 21:20:10 +0100
RE:  mixed content grouping by whitespace
I never fully understood why in 
> g-s-w/g-e-w groupings the population needs to be all nodes 
> and not arbitrary sequences. I wonder whether it is because 
> someone insisted that g-s-w/g-e-w conditions need to be 
> patterns and hencefore the population need to be nodes, or 
> whether it was the other way round. Maybe it is as it is for 
> "historical reasons". Or maybe they thought: if we permit an 
> arbitrary expression as g-s/e-w condition then we must check 
> that an effective boolean value may be calculated for this 
> expression, because it should be a yes/no decision whether a 
> given item starts/ends a group. Maybe they found that a 
> pattern that either matches or not is a more clear-cut and 
> comprehensible binary criterion than arcane EBV semantics, at 
> least for the common case of grouping nodes.


All very good questions.

All the places in the language where we apply a boolean test to a specific
node are done by patterns, and I guess that's why it was done here: it would
be odd to do one thing in xsl:number, and a different thing in
xsl:for-each-group. I don't remember a big debate about it.

In retrospect it would be nice if the bifurcation between expressions and
patterns hadn't happened, and everywhere patterns are used we had instead
used an expression evaluated with the target node as context item, taking
its effective boolean value. I suspect people wanted to write
match="section/head" to make it CSS-like, but I think one could achieve the
same with a (pseudo-?) function: match="pattern(section/head)", which could
then be used in XPath expressions anywhere, for example <xsl:when
test="pattern(section/head)".

Integration with types would also have been nice: <xsl:param name="in"
as="pattern(section/head)"/>.

Sadly, though, language decisions once made cannot easily be improved in
this way.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.