Hi again guys, just to continue speaking about "core" transformer APIs, I just modified the transformer as you suggested, the showcase is:
VariableExpanderTransformer expander = new VariableExpanderTransformer(); expander.setProperty( "build.base", "/Users/cocoon" ); expander.setProperty( "build.home", "${build.base}/workspace" ); expander.setProperty( "dist.home", "${build.base}/downloads" ); expander.setProperty( "text.property", "Cocoon3 rocks!" ); newNonCachingPipeline().setURLGenerator( getClass().getResource( "/variables-expander.xml" ) ) .addComponent( expander ) .addSerializer() .withEmptyConfiguration() .setup( System.out ) .execute(); Moreover following VariableExpanderTransformer methods are available: loadAll(Map<String, String>) loadAll(Properties) loadEnvironmentVariables() // they are prefixed with 'env.' in the context loadSystemProperties() // Java system properties loadProperties(URL) loadXmlProperties(URL) Do you think could be useful inside a sitemap processing? Many thanks in advance, all the best!!! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Fri, Dec 16, 2011 at 4:06 PM, Simone Tripodi <simonetrip...@apache.org> wrote: > Hi Nathaniel! > > *terrific* feedback, you already put me in the condition I'm going to > modify the transformer adoption your suggestion! > Clear, simple, linear - priceless! > I'll let you know when terminated! > -Simo > > http://people.apache.org/~simonetripodi/ > http://simonetripodi.livejournal.com/ > http://twitter.com/simonetripodi > http://www.99soft.org/ > > > > On Fri, Dec 16, 2011 at 1:38 PM, Nathaniel, Alfred > <alfred.nathan...@six-group.com> wrote: >> Hi Simone, >> >> Why this special API call to add it to the pipeline? >> >> I think is should be a regular transformer you can add any number of time >> wherever you need it: >> >> VariableExpander expander = new VariableExpander(); >> expander.addProperty( "build.base", "/Users/cocoon" ); >> expander.addProperty( "build.home", "${build.base}/workspace" ); >> expander.addProperty( "dist.home", "${build.base}/downloads" ); >> expander.addProperty( "text.property", "Cocoon3 rocks!" ); >> >> then creating and run their pipeline adding the VariableExpander: >> >> newNonCachingPipeline().setURLGenerator( >> getClass().getResource( "/variables-expander.xml" ) ) >> .addTransformer( expander ) >> .addSerializer() >> .withEmptyConfiguration() >> .setup( System.out ) >> .execute(); >> >> That makes it also easier to add configuration to the expander, for example: >> >> * use other marker than ${}, in case you may want generate generate a file >> using that syntax for its own purposes >> * what to do if there if the property name is undefined: replace it by >> nothing / leave as is / throw exception >> >> Also by not just using a stupid property map, it is much easier to avoid >> infinite recursions such as >> setProperty("build.home","${build.home}/workspace"). >> >> Cheers, Alfred. >> >> -----Original Message----- >> From: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] On Behalf >> Of Simone Tripodi >> Sent: Donnerstag, 15. Dezember 2011 18:02 >> To: dev@cocoon.apache.org >> Subject: Re: [C3] new pipeline component: variabelExpander >> >> Hi Robby :) >> >> On Thu, Dec 15, 2011 at 5:56 PM, Robby Pelssers <robby.pelss...@nxp.com> >> wrote: >>> Would it be justified to say that it acts as some kind of transformer >>> (although non-xslt based) in this case which replaces all variable >>> references with the value from the Map or Properties provided? >> >> exactly, it just replaces plain text inside attributes/body elements :P >> >>> And I suppose it works on any text, not just XML?! >>> >> >> Not ATM, it works as XmlTransformer :( >> >>> Bring it on ;-) >>> >> >> I'll do, thanks! :) >> best; >> -Simo >> >> http://people.apache.org/~simonetripodi/ >> http://simonetripodi.livejournal.com/ >> http://twitter.com/simonetripodi >> http://www.99soft.org/ >> >> The content of this e-mail is intended only for the confidential use of the >> person addressed. >> If you are not the intended recipient, please notify the sender and delete >> this e-mail immediately. >> Thank you.