Re: (anti)XMLProcessing : how to render a list of node as a comma separated list of their text ?
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Tuesday, June 17, 2008, 4:11:05 PM, thierry henrio wrote:
> Hi all
> I need to render something like
>
> data=
> <bill>
> <material>eggs</material>
> <material>milk</material>
> </bill>
>
> as
> output=
> "eggs,milk"
>
> at first, I though : "hey that does not look so difficult !!, that will be a matter of minutes" ...
> so I wrote a learning test : 2 minutes
> now, I must admit my learning test is still red after 2 hours :(
>
> so, is there anyone kind enough to teach me how to achieve this ??
>
> note 1:
> i rapidly produced the following output
> "eggs,
> milk
> "
>
> with template=
> <#assign x>
> <#list bill.material as x>
> ${x}<#if x_has_next>,</#if>
> </#list>
> </#assign>
> ${x}
>
> but these \n are killing my test !!
Well if your test fails with correct output then it is the test that
is bad. But, use <#t> to remove unwanted indentation and line-breaks.
And that #assign look like redundant.
> note 2:
> I'm angry to have to render in the xml output document something like that
> <property name="badDesignedDataModel" value="value1, value2, value3"/>
> where valueX are identified items in my xml data document
> but that is it :)
>
> Regards, Thierry
--
Best regards,
Daniel Dekany
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php