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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.