cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: Small note on sitemap configuration
Date Thu, 01 Jun 2000 16:38:23 GMT
On Thu, 1 Jun 2000, Stefano Mazzocchi wrote:

>    <when test="machine-load gt 1.0">
>     <filter type="parser"
> src="./foo/styles/style-{round-to-integer(machine-load)}.xsl"/>
>    </when>
>    <otherwise>
>     <filter type="parser" src="./foo/styles/normal-style.xsl"/>
>    </otherwise>
>   </choose>
>   ...
>  </process>
> 
> I don't think you could make such thing pass the (now infamous)
> "Stefano's girlfriend test".
> 
> But I admit I'm not 100% sure about all this....

I'm certainly not either. Let's step back for a second and see what we
agree on. The sitemap author should be able to write the sitemap in such a
way as to...

1. choose different resolver (pipeline? is that your name for my object?)
components depending on request-time information

2. configure difference resolver components with request-time information

do you agree with these assertions? if so, then we're pretty close in our
visions. i'm simply saying that a sitemap that allows conditionals based
on something like this:

<process uri="whatever">
 <matcher type="browser" value="explorer">
  <matcher type="language" value="en">
   <generator type="file" src="explorer.xml">
  </matcher>
  <matcher type="language" value="it">
   <generator type="file" src="explorer.it.xml">
  </matcher>
 </matcher>
 <matcher type="browser" value="lynx">
  <matcher type="language" value="en">
   <generator type="file" src="lynx.xml">
  </matcher>
  <matcher type="language" value="it">
   <generator type="file" src="lynx.it.xml">
  </matcher>
 </matcher>
</process>
  
That's hella-cumbersome, and doesn't factor out the conditionals very
well. My strategy would let you rewrite it like this:

<process>
 <choose>
  <when test="$language='en'">
   <generator type="file" src="{$browser}.xml"/>
  </when>
  <when test="$language='it'">
   <generator type="file" src="{$browser}.{$language}.xml"/>
  </when>
 </choose>
</process>

I think that's much easier to understand and write. Sure, you can get
yourself into trouble if you move too much logic inside the sitemap and
out of your XSP pages or whatever. So what? I prefer to have the extra
rope, even if I might accidentally hang myself.

- donald


Mime
View raw message