From: "Bas Suverkropp PC" <[EMAIL PROTECTED]>
To: <dev@cocoon.apache.org>

More a query for the user list, I'd have thought...

Subject: Using variables in sitemap component parameter
Date: Thu, 3 May 2007 13:56:34 +0200

I am trying to make my sitemap environment-independent, with local parameters read from
a properties file (assembly.properties)

Unfortunately, using properties does not seem to work in the components declaration.

I want to replace

<map:transformer name="mail" src="nl.kluwer.cocoon.transformation.HtmlMailTransformer" >
        <smtphost>smtp.provider.com</smtphost>
        <smtpport>25</smtpport>
        <from-address>[EMAIL PROTECTED]</from-address>
</map:transformer>

with something like

<map:transformer name="mail" src="nl.kluwer.cocoon.transformation.HtmlMailTransformer" >
        <smtphost>{assembly:smtphost}</smtphost>
        <smtpport>{assembly:smtpport}</smtpport>
        <from-address>{assembly:from}</from-address>
</map:transformer>

Any suggestions?

You didn't say which version of Cocoon you're using. With the latest 2.2 stuff, I believe the intended method is that you include all different versions of the configurations in your .war file and specify a "running mode" in a system property to tell Cocoon which set to use. With 2.1.x, what I've done in the past is to use an external XML entity file rather than a properties file, include it in the relevant place with e.g.

<!DOCTYPE map:sitemap [
<!ENTITY emailsettings SYSTEM "emailsettings.ent">
]>
<map:sitemap>
....
<map:transformer name="mail" src="nl.kluwer.cocoon.transformation.HtmlMailTransformer" >
&emailsettings;
</map:transformer>

and let the parser do the work. The .ent file contains the markup and settings to include inside the map:transformer; .ent (XMLSpy's default for external entities) rather than .xml as this probably won't be a well-formed XML document, but you could name it anything you like. The only down side I found was that editing the settings file required a restart of the application before the changes would take effect (but that may vary depending on which app server you're using).


Andrew.
--
http://pseudoq.sourceforge.net/  Open source java Sudoku application.

_________________________________________________________________
Reserve your place in history - Email Britain! http://www.emailbritain.co.uk/

Reply via email to