cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: [RT] Improved matching & selecting
Date Tue, 05 Dec 2006 15:58:14 GMT
Hi Alfred,

On Dec 4, 2006, at 12:46 PM, Alfred Nathaniel wrote:

> Or use different tags, say in resemblance to XSLT:
>
> <map:if path="...">
> ...
> </map:if>
>
> <map:choose>
>   <map:when path="...">

I'm not so keen on that, 'cause I'm actually trying to get away from 
using 2 different elements for this.  Rationale:

1) The precedent of <match> and <select> would have conditioned users 
to interpret <if> and <choose> as referring to two different kinds of 
sitemap components ("Iffer"s and "Choose"rs? :-).  I'd like the syntax 
to emphasize that it's all matching and there is only one component 
now, The Matcher.

2) The sitemap language is not XSLT and has nothing to do with XSLT.  
The only relationship is that the sitemap has to do with Cocoon and 
Cocoon uses XSLT... big deal! :-)  Trying to imitate XSLT in the 
sitemap in the interest of familiarity IMHO is misguided and results in 
confusion.  Things that are different should look and feel different.  
For example: in XSLT <if> and <choose>, the @test clause contains a 
predicate.  This is fundamentally different then in the sitemap, where 
the corresponding attribute contains a pattern, and the predicate 
comprises some kind of (implicit or configured) match of this pattern 
against a configured target value.  Now the way this is expressed in 
the "classic" sitemap, the <select/when> version puts this value into 
an attribute called "test" — probably, again, in deference to XSLT, and 
IMHO confusing — while the <match> version puts it in an attribute 
called "pattern".  But in either case, the semantics are rather 
different than XSLT owing to the difference between "predicate" and 
"pattern".

3) I think XSLT got it wrong :-).  They should have used something like 
"<xsl:cond>" for both, and treated @test like I treat @value in my 
proposal.  An analogy between <xsl:choose> and a "switch" or "case" 
statement is flawed, the correct analogy is to "if()... else if()" 
— again, because of the distinction between predicate and pattern!  
Switch/case is really like today's <map:select>!!!  "if()..." 
inaugurates a conditional using the same keyword regardless of how many 
alternatives there are — one, or many.  That's how sitemap matching 
(which has only patterns) should do it, and that's how XSLT (which has 
only predicates) should have done it.  No need for two different 
keywords.

cheers and thx for the feedback :-),
—ml—

Mime
View raw message