You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Bernard Giannetti <th...@hotmail.com> on 2013/10/03 00:23:36 UTC

RE: Processing selected nodes...

FYI, I posted a question (and solution) at http://www.tek-tips.com/viewthread.cfm?qid=1719206.

From: thebernmeister@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Processing selected nodes...
Date: Sun, 29 Sep 2013 16:23:24 +1000




Hi,
I'm using FOP, embedded in a desktop application, to create PDFs from a single data XML file using an XSLT file.
Say the data XML file is a list of items, for example:
<items>  <item>    apple  </item>  <item>    orange  </item>  <item>    water melon  </item>...</items>
I want to be able to tell the XSLT to only process specific items (say "apple" and "orange").
I've created a java.util.ArrayList and passed that to the transformer using setParameter( "theList", theList ).  In the XSLT, when I use <xsl:value-of select="$theList" />, I'll get in the output  [apple, orange].  Fair enough.
However, what I really want (I think) is to take the array and iterate over it, calling a template for each item.  Is this possible?
>From what I've managed to deduce from a lot of searching/reading is that it's possible even to pass in a Java object and somehow get XSLT to access that Java object.  I'm not sure if that is overkill for what I want to do, but I cannot even achieve processing a list of items one by one.

Thanks in advance,
Bernard.