Glen Tulin wrote:
Glen Tulin wrote:
I need to access external config files within my custom sitemap.xmap --
either forrest.properties or skinconf.xml.
<map:pipeline>
<map:match pattern="my_pattern.xml">
<map:generate src="my.xml"/>
<map:transform src="{project:resources.stylesheets}/my-to-doc.xsl">
<map:parameter name="my_parameter_for_my_xsl" value="xxx"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
What should I have instead of xxx in order to get parameter from either
forrest.properties or skinconf.xml?
For values in forrest.properties use {forrest:PROPERTY_NAME} (see the
*.xmap files in FORREST_HOME/main/webapp for examples.
For skinconf.xml you would not pass the value from the sitemap like
this. You would access the value from within your transformation. See
the pelt skin XSLT's for examples.
Yes, I know how to use $config in the SKIN xslt's -- like <xsl:value-of
select="$config/year"/>. Apparently the $config variable is defined when
Forrest is appyling a skin. But I am asking about my own xslt that gets
executed before Forrest default sitemap. I guess that at first Cocoon
processes my custom xmap ($config is not initialized yet) that transforms my
xml to document-v20 xdoc and then Cocoon process the Forrest xmap ($config
is initialized).
$config is only a normal XSLT parameter. If you look in the skins XSLT
you will see how it is initialised, for example:
in
http://svn.apache.org/viewcvs.cgi/*checkout*/forrest/trunk/main/webapp/skins/common/xslt/html/site2xhtml.xsl?rev=161829
you can see:
<xsl:variable name="config" select="//skinconfig"/>
and in
http://svn.apache.org/viewcvs.cgi/forrest/trunk/main/webapp/sitemap.xmap?rev=209820&view=markup
you can see:
<map:match pattern="**/*.html">
<map:aggregate element="site">
<map:part src="cocoon:/skinconf.xml"/>
<map:part src="cocoon:/build-info"/>
<map:part src="cocoon:/{1}/tab-{2}.html"/>
<map:part src="cocoon:/{1}/menu-{2}.html"/>
<map:part src="cocoon:/{1}/body-{2}.html"/>
</map:aggregate>
<map:call resource="skinit">
<map:parameter name="type" value="site2xhtml"/>
<map:parameter name="path" value="{0}"/>
</map:call>
</map:match>