forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <>
Subject passing parameters from sitemaps to stylesheets
Date Fri, 12 Aug 2005 05:11:49 GMT
Gav.... wrote:
> How do I check for project.i18n=true (from created by 
> forrest seed) from this when statement.
> I have :-
>  <xsl:choose>
>       <xsl:when test="config.i18n = 'true'">   /* also tried $config/i18n 
> and a few others, this is where I'm stuck */
>                 (i18n compatible stuff)
>       </xsl:when>
>                <xsl:otherwise>
>                        (Remove i18n stuff)
>                 </xsl:otherwise>
>  </xsl:choose>

Ah, this is turning in to a useful lesson. How to
pass parameters from the sitemaps into the stylesheets
and how to access project properties.

Notice that pelt/xslt/html/site2xhtml.xsl
imports common/xslt/html/site2xhtml.xsl
Look at the latter.

<xsl:variable name="config" select="//skinconfig"/>

That sets $config to all of the values from the
project's skinconf.xml file. This information has
been previously aggregated by the sitemap into the 
xml stream that we are transforming.

<xsl:param name="path"/>

That was passed to this stylesheet from the sitemap.

Lets look at the sitemaps to find out how:
cd /svn/asf/forrest/main/webapp
grep site2xhtml *
more sitemap.xmap

That shows that the sitemap resource named "skinit"
was called with <map:parameter name="path" value="{0}"/>
That passes the value of the uri being processed.

Looking at the skinit resource, a transformer then
applies the relevant stylesheet and passes the
parameter "path".

So you could get other properties into your final
stylesheet in that way. Looking at the sitemaps
you can see that those values are obtained from
properties using the syntax {project:blah} or
{defaults:blah} {request:blah} {forrest:blah} etc.

The main/webapp/WEB-INF/xconf/forrest-core.xconf
shows how those values are made available using
"sitemap input modules".


View raw message