forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject Re: [sitemap.xmap] How to access a new ant property ?
Date Mon, 11 Jul 2005 20:35:07 GMT
On Mon, 2005-07-11 at 15:43 +0200, Cyriaque Dupoirieux wrote:
> Hi,
>     I added a new property : project.locale set in init-props in 
> - just as forrest.home is.
>     I init - in forrest-core.xconf - the component-instance 
> name="project" class="org.apache.forrest.conf.ForrestConfModule" with 
> the new property :
>         <locale>@project.locale@</locale>
>     I try to use it in sitemap.xmp :
>         <map:transform type="i18n">
>               <map:parameter name="locale" value="{project:locale}"/>
>             </map:transform>
>     And the value of my locale - known with a System.out added in 
> org.apache.forrest.conf.ForrestConfModule class - is always @project.locale@
>     Any Idea ? (will be welcome because I am close to find a pretty 
> solution to use $LANG variable to generate the static site.)

You did everything right!!!

I just tried it with adding the following to in the
"init-props" target.
<property name="project.view-skin" value="target-x"/>
<echo>test: ${project.view-skin}</echo>

and then in forrest-core.xconf into the same instance

Then I used in the internal.xmap in views
<map:transform src="resources/stylesheets/viewLocationmap.xsl">
 <map:parameter value="{project:view-skin}" name="project.view-skin"/>

and in this stylesheet
<xsl:param name="project.view-skin">not found</xsl:param>
  project.view-skin: <xsl:value-of select="$project.view-skin"/>

I did then a *build* of forrest and my plugin (not shown).
./ clean; ./

Changed to my project and added the new property to
project.view-skin=just a test :)

Last step was running forrest in dyn mode (forrest run).

Then I got:
1) starting up (from the shell):
test: just a test :)
2)requesting the test page:
<!--project.view-skin: just a test :)-->

So the only thing that you may forgot is ┬┐building forrest?

...but all the above is only true if you called your variable
project.someName because "project" get filtered. In the you can find:
<echoproperties prefix="project" destfile="${projfilters}"/>
<filter filtersfile="${projfilters}"/>

Which will take care to replace @tokens@. You can control that searching
for project.someName in $PROJECT_HOME/tmp/

Some useful links:

...if your plan is to replace all i18n definitions in the sitemaps, that
is an awesome idea but what is wrong with using the 'project.i18n'
parameter we already have?

Would save you the time doing the above and do we really need 'local'
and 'i18n'?

Another question is how do you override it later in the dyn mode for the
requests of a client? Would that not permanently determine the outputted


P.S. diff attached for clarifications:
---   (revision 210207)
+++   (working copy)
@@ -44,9 +44,6 @@
   <property name="forrest.core"
   <property name="forrest.core.webapp"

   <import file="targets/validate.xml"/>
   <import file="targets/webapp.xml"/>
   <import file="targets/site.xml"/>
@@ -98,7 +95,9 @@
     <property file="${project.home}/" />
     <property file="${user.home}/" />
file="${forrest.core.webapp}/" />
+    <property name="project.view-skin" value="default"/>
+    <echo>test: ${project.view-skin}
+      </echo>
     <!-- people should use to override following
defaults  -->
     <property name="build.plugins-dir"     value="build/plugins"/>
     <property name="forrest.skins-dir"
Index: webapp/WEB-INF/xconf/forrest-core.xconf
--- webapp/WEB-INF/xconf/forrest-core.xconf     (revision 210207)
+++ webapp/WEB-INF/xconf/forrest-core.xconf     (working copy)
@@ -135,6 +135,7 @@

     <component-instance name="project"
+        <view-skin>@project.view-skin@</view-skin>


"Together we stand, divided we fall!" 
Hey you (Pink Floyd)

View raw message