I'm in the same boat (or will be before year's end) and I've been looking at this for awhile without diving in. I've seen some successful examples extending the package(s) with helpers like this (I think I klept this from some Japanese Perl hacker's blog a couple months back) one for working with Impress docs-
package OpenOffice::OODoc::Document; sub clone_page { my $self = shift; my ($source, $dest) = @_; my $p = $self->getElement(page_xpath($source)) or die; my $p2 = $p->copy(); $p2->paste(last_child => $self->getElement('//office:presentation' +)); $self->setAttributes($p2, 'draw:name' => "page$dest"); } sub page_xpath { my ($page) = @_; sprintf('//draw:page[@draw:name="page%d"]', $page); }
The lesson there being that it's XML::Twig underneath so you could use that directly with the OOD objects. You don't need to do any wrapping outside, just get into the guts of the objects directly with what's there already. Please submit patches back to the OOD author if you add anything generally functional.
A TT approach would be quite doable; perhaps by breaking pieces out into BLOCKs and MACROs so a given doc type could contain all its possible function/content in a glance. Any text munging can be done with TT if you come at it correctly. I like OOD though so the approach you (and I eventually) take should be based on the likelihood of OOD growing and getting better as more of us move away from MSFT-dependent packages... though a TT solution is certainly an interesting idea.
In reply to Re: OpenOffice, XML and templates
by Your Mother
in thread OpenOffice, XML and templates
by psini
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |