[NTG-context] A pdf-file per XML-node

Hans Hagen pragma at wxs.nl
Thu Nov 11 10:08:48 CET 2010


On 10-11-2010 10:58, Daniel Grycman wrote:
> Hi list,
>
> |<worker>
> |<surname>xxx</surname>
> |<name>xxx</name>
> |</worker>
> |<worker>
> |<surname>xxx</surname>
> |<name>xxx</name>
> |</worker>
> |<worker>
> |<surname>xxx</surname>
> |<name>xxx</name>
> |</worker>
> |<worker>
> |<surname>xxx</surname>
> |<name>xxx</name>
> |</worker>
> For every<worker>  a separate pdf is needed. It would be also nice to have
> the<name>-entry as a file-name. Any ideas?

you can make a worker.lua file that does it, something (untested) ...

local x = xml.load("workers.xml")

local i = 0
for e in xml.collected(x,"worker") do
   i = 1 + 1
   logs.simple("processing worker %s",i)
   os.execute("context worker --worker=" .. i)
end

and run that with

mtxrun --script worker.lua

where the worker.tex file looks like

... usual xml setups using workers.xml ...

\xmlfilter
   {main}
   {worker[position()==\getdocumentargument{worker}]}
   {xml:worker}

... special worker setup

\startxmlsetup xml:worker
...
\stopxmlsetup

etc etc

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list