-
1. Re: Smooks and Freemarker
ericcart Oct 25, 2007 10:50 AM (in response to ericcart)Ups, this is the example xml:
<CurrentWeather> <Location>Dalian, China (ZYTL) 38-54N 121-38E 97M</Location> <Time>Oct 25, 2007 - 10:00 AM EDT / 2007.10.25 1400 UTC</Time> <Wind> from the W (280 degrees) at 4 MPH (4 KT) (direction variable):0</Wind> <Visibility> less than 1 mile:0</Visibility> <SkyConditions> obscured</SkyConditions> <Temperature> 55 F (13 C)</Temperature> <DewPoint> 55 F (13 C)</DewPoint> <RelativeHumidity> 100%</RelativeHumidity> <Pressure> 30.15 in. Hg (1021 hPa)</Pressure> <Status>Success</Status> </CurrentWeather>
-
2. Re: Smooks and Freemarker
ericcart Oct 25, 2007 10:53 AM (in response to ericcart)Again:
XSL - WORKING OK<resource-config selector="CurrentWeather"> <resource type="xsl"> <![CDATA[<FONT FACE="MS Sans Serif"><FONT COLOR="#000000"><xsl:value-of select="./Temperature" /></FONT></FONT>]]> </resource> <param name="is-xslt-templatelet">true</param> </resource-config>
FLT - NOT WORKING<resource-config selector="CurrentWeather"> <resource type="ftl"> <![CDATA[<FONT FACE="MS Sans Serif"><FONT COLOR="#000000">${Temperature}</FONT></FONT>]]> </resource> <param name="action">replace</param> </resource-config
Thanks,
Eric -
3. Re: Smooks and Freemarker
tfennelly Oct 25, 2007 11:52 AM (in response to ericcart)Have you tried this sample on the Smooks website... download it and run it.
-
4. Re: Smooks and Freemarker
ericcart Oct 25, 2007 3:32 PM (in response to ericcart)
I reviewed it. I don't have an object model to populate.
I'm receving a XML and transforming it to a text.
It's related with:
freemarker - Part III. XML Processing Guide
http://freemarker.org/docs/xgui.html
freemarker - Putting the XML into the data model
http://freemarker.org/docs/xgui_expose_put.html/* Create a data model */ Map root = new HashMap(); root.put( "doc", freemarker.ext.dom.NodeModel.parse(new File("the/path/of/the.xml")));
But the XML comes from ESB, loaded by org.jboss.soa.esb.actions.converters.SmooksTransformer
So... where is the absolute reference to the data ? It seems selector is working, but not the variable Temperature reference.
Thank,
Eric -
5. Re: Smooks and Freemarker
tfennelly Oct 26, 2007 7:40 AM (in response to ericcart)OK, Smooks doesn't support this usage model at the moment... it only supports the normal java model based approach. See FreeMarkerContentDeliveryUnitCreator for details on how FreeMarker is integrated.
Smooks will (at some stage) have support for "virtual models", which means you won't actually require a physical java object model. -
6. Re: Smooks and Freemarker
ericcart Oct 26, 2007 9:46 AM (in response to ericcart)
Ok, I'll open a JIRA feature request.
In the meantime, I'll manage to use XSL transformation.
Thanks for you answer,
Eric