cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Collen <>
Subject Re: map:parameter and xsl defaults
Date Wed, 17 Dec 2003 01:26:24 GMT
Anders Forsgren wrote:
> Hi all
> I want to use a request param passed on as an argument to a transform.
> The sitemap snippet looks like this:
> <map:match pattern="log">
>         <map:generate src="log/log.xml"/>
>         <map:transform src="log/log2page.xsl">               
> <map:parameter name="start" value="{request-param:start}"/>
>               <map:parameter name="end" value="{request-param:end}"/>
>         </map:transform>
>         <map:serialize type="xml"/>
> </map:match>
> In the log2page.xsl file, I have defaults for the parameters, for example
> <xsl:param name="end" select="'100'"/> 
> The default values are never assigned, which means the transform only 
> works when both parameters are specified in the request params. What 
> will the {request-param:foo} be replaced with when a param is not 
> specified in the request? I don't know about empty versus "undefined" 
> parameters, I wonder if the sitemap somehow passes an "empty but still 
> valid/defined" (like a "" String versus the null String) -parameter to 
> the xsl that prevents the defaults from being used?
> If  I don't use any map:params with my transform, the defaults are used 
> correctly inthe xsl.
> Do I have to use a sitemap swicth to do the transform without 
> map:parameter when the request parameters are missing, and with 
> map:parameter when they exist? Seems like a lot of work, and also makes 
> the xsl defaults unusable...
> Am I missing the simple solution here?


If you use the request-param input module, and try to get a parameter 
that does not exist, I believe you get "null" back.  If you want to 
prevent this, you could use the ChainMetaModule to "fall-back" to other 
modules or values... this would be the easiest way to ensure getting a 
value back.

> rgds
> Anders


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message