You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bas Suverkropp PC <BS...@kluwer.nl> on 2007/05/03 13:56:34 UTC
Using variables in sitemap component parameter
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>xxx@provider.com</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?
This email and any attachments may contain confidential or privileged information and is intended for the addressee only. If you are not the intended recipient, please immediately notify us by email or telephone and delete the original email and attachments without using, disseminating or reproducing its contents to anyone other than the intended recipient. Kluwer shall not be liable for the incorrect or incomplete transmission of this email or any attachments, nor for unauthorized use by its employees.
Deze e-mail (en eventuele bijlagen) kan vertrouwelijke informatie bevatten en is alleen bestemd voor de geadresseerde. Als u niet de bedoelde geadresseerde bent, informeer ons a.u.b. hierover per e-mail of telefoon en verwijder de originele e-mail zonder de inhoud en bijlagen te gebruiken, te verspreiden of te vermenigvuldigen aan anderen dan de bedoelde geadresseerde. Kluwer is niet aansprakelijk voor onjuiste of incomplete verzending van deze e-mail en bijlagen, noch voor ongeautoriseerd gebruik door haar medewerkers.
Kluwer bv is statutair gevestigd te Deventer en ingeschreven in het handelsregister van de Kamer van Koophandel onder het nummer 380 132 26.
RE: Using variables in sitemap component parameter
Posted by Andrew Stevens <at...@hotmail.com>.
>From: "Bas Suverkropp PC" <BS...@kluwer.nl>
>To: <de...@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>xxx@provider.com</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/
RE: Using variables in sitemap component parameter
Posted by Geert Josten <ge...@daidalos.nl>.
Dear Bas,
Rewrite your component to accept properties at transform time and pass
them in the map:transform step with map:parameter calls.
Groeten,
Geert
>
Drs. G.P.H. Josten
Consultant
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
> From: Bas Suverkropp PC [mailto:BSuverkroppPC@kluwer.nl]
> Sent: donderdag 3 mei 2007 13:57
> To: dev@cocoon.apache.org
> Subject: Using variables in sitemap component parameter
>
> 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>xxx@provider.com</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?
>
> This email and any attachments may contain confidential or
> privileged information and is intended for the addressee
> only. If you are not the intended recipient, please
> immediately notify us by email or telephone and delete the
> original email and attachments without using, disseminating
> or reproducing its contents to anyone other than the intended
> recipient. Kluwer shall not be liable for the incorrect or
> incomplete transmission of this email or any attachments, nor
> for unauthorized use by its employees.
> Deze e-mail (en eventuele bijlagen) kan vertrouwelijke
> informatie bevatten en is alleen bestemd voor de
> geadresseerde. Als u niet de bedoelde geadresseerde bent,
> informeer ons a.u.b. hierover per e-mail of telefoon en
> verwijder de originele e-mail zonder de inhoud en bijlagen te
> gebruiken, te verspreiden of te vermenigvuldigen aan anderen
> dan de bedoelde geadresseerde. Kluwer is niet aansprakelijk
> voor onjuiste of incomplete verzending van deze e-mail en
> bijlagen, noch voor ongeautoriseerd gebruik door haar medewerkers.
> Kluwer bv is statutair gevestigd te Deventer en ingeschreven
> in het handelsregister van de Kamer van Koophandel onder het
> nummer 380 132 26.
>