On 3/17/08, Mark Lundquist <[EMAIL PROTECTED]> wrote:
>  On Mar 17, 2008, at 5:17 PM, Mark Lundquist wrote:
>  > You might find this interesting:
>  >       http://thread.gmane.org/gmane.text.xml.cocoon.devel/68380/focus=68408
> whoops, I meant just this:
>         http://thread.gmane.org/gmane.text.xml.cocoon.devel/68380

Read the thread.  Good thoughts.

You are correct that Matchers are just a special case of a Selector so
the Selector interface is better than the Matcher interface for your
goals.  Selectors already have multiple conditions and "otherwise".
Matchers and most Selectors could be eliminated, and more
functionality gained with a RegexpSelector:
<map:select type="regexp" src="{request:sitemapURI}">
   <map:when test="^$|^/$">
      <!-- Default with no string -->
   </map:when>
   <map:when test="^([.^/]*)/([.^/]*)/([.^/]*)$">
      <!-- Matches three slash-delimited parts  and loads {1}, {2}, and {3} -->
   </map:when>
   <map:otherwise>
      <!-- Anything else -->
   </map:otherwise>
</map:select>

The (huge) downside is requiring knowledge of rexexp.  An easier
Selector should allow something close to the current system:
<map:select type="match">
   <map:when test="">
      <!-- Default with no string -->
   </map:when>
   <map:when test="/">
      <!-- Another default for no string -->
   </map:when>
   <map:when test="*/*/*">
      <!-- Matches three slash-delimited parts  and loads {1}, {2}, and {3} -->
   </map:when>
   <map:otherwise>
      <!-- Anything else -->
   </map:otherwise>
</map:select>

Since either variant would allow src="{AnyInputModule:AnyVariable}",
these two Selectors could replace all the current variations of
Matchers and Selectors. Best is all the needed code exists in the
current classes so creating these Selectors should be easy.

OTOH, the devs seem excited about losing functionality in future
releases.  A suggestion that Selectors could be used to choose
parameters inside Generator, Transformer, and Serializer elements met
strong resistance.  Aggregators (obviously merging several Generators)
do not share code with Generators so every developer must learn the
hard way that this code does not work:
<map:aggregate element="content">
   <map:part type="someGenerator" src="something"/>
</map:aggregate>
A RegexpSelector and a MatchSelector might be acceptable because they
would not affect other classes.

solprovider

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

Reply via email to