psini has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I'm stuck on a problem that I know how to solve but I'm sure that it can be done much better.
The task: use OpenOffice to generate a doc that can be used as a template for generating other docs, using perl. Think of it as a fill-in form, but with parts of it that can be removed (conditional) or repeated (iterating on an array/hash) or both. I don't need to programmatically edit the style of the doc, only the text.
The problem is that I want the template editable with OO, so its contents has to be a well-formed XML file and every metadata or command has to be in the text part. So, if I want a line in a table - say the header - removed, I need to specify the conditional command in the text, but the template processor has to remove the entire <table-row> tag from the XML stream.
I *could* do it in perl, opening the zipped doc, extracting and parsing the XML content, and proceesing it with XML::Twig. I don't want to reinvent the wheel, but I don't see how this can be done using TT or other template processor I heard of.
Any idea?
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: OpenOffice, XML and templates
by Your Mother (Archbishop) on Jun 29, 2009 at 21:33 UTC | |
by psini (Deacon) on Jun 30, 2009 at 08:18 UTC | |
by Corion (Patriarch) on Jun 30, 2009 at 08:36 UTC | |
by psini (Deacon) on Jun 30, 2009 at 09:00 UTC | |
by psini (Deacon) on Jul 05, 2009 at 22:39 UTC | |
|
Re: OpenOffice, XML and templates
by zwon (Abbot) on Jun 29, 2009 at 19:48 UTC | |
by psini (Deacon) on Jun 29, 2009 at 19:52 UTC | |
|
Re: OpenOffice, XML and templates
by grantm (Parson) on Jul 01, 2009 at 02:16 UTC |