Upayavira wrote:

Michael Schlotfeldt wrote:

I completely agree with David. Sitemaps are to primitive at this point. The addition of "and" and "or" to matchers would be a big step forward.


AND:
<map:match pattern="x">
  <map:match pattern="y">
    ...
  </map:match>
</map:match>

OR:
<map:match pattern="x">
  ..
</map:match>
<map:match pattern="y">
  ...
</map:match>

Isn't that enough for and and or?

For AND, it works, although it's not as readable and maintainable as an explicit AND would be. Imagine Java not having && and ||, so you had to say
  if (foo) {
    if (bar) {
instead of
  if (foo && bar) {

For OR, the point is that with this method you have to duplicate code.
Granted, you could probably minimize code duplication with a couple of <map:call>s to a common code block. But ideally an explicit OR without having to create a separate thing to call would be nicer.

But how would it be designed? In order to have multiple match patterns, you'd have either put repeating pattern elements inside the <map:match>, or design the and/or construct into the pattern syntax. Certain brands of regexp syntax do have an OR construct. Don't think I've heard of an AND though. This would also limit you to making all the operands of your ANDs and ORs be of the same kind -- a match pattern or regexp.

A cleaner construct, maybe something like selectors, would let specify multiple conditions of different kinds for entering a block of code and a full grammar for expressing conditions... e.g.
<map:condition-block>
  <map:and>
    <map:match pattern="..."/>
    <map:or>
       <map:not>
          <map:match type="regexp" pattern="...."/>
   </map:not> </map:or> </map:and>
   <!-- if the above condition is met, execute the following code -->
   ...
</map:condition-block>

But XML elements are a pretty long-winded way of describing expressions... that's why XSLT uses XPath, no doubt. Besides, we all know Cocoon is supposed to let you create web applications "without programming" (wink wink).

Lars

Lars



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to