On Tue, 2006-12-05 at 07:58 -0800, Mark Lundquist wrote:
> 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.
There is no need for a one-to-one relation between sitemap tags and
components. (There won't be any Whener in your model either?). So I
don't see the problem in using Matcher implementations for more than one
tag which is not called map:match.
> 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".
Well, why not really use XSLT syntax?
<map:if test="wcmatch(uri(), '**/*.xml'">
where wcmatch() and uri() are Cocoon components.
> 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.
I think we should use two different keywords because otherwise the
content model depends on the presence of various attributes and not on
the tagname only -- that is really confusing.
Whether the keyword pair is match/select or if/choose or cond/switch or
something else I don't care too much.
> cheers and thx for the feedback :-),
> —ml—
Cheers, Alfred.