Stewart Heckenberg wrote:
>> I need to produce both a PDF and a HTML document from the same
>>
>> template.
>> Is there are reason you cannot use two separate templates? You can call both
>> from one CGI script or perl script.
>
> Well I could, but basically I've got a really long document containing
> blanks that are populated by answers to a questionnaire, and so when
> it comes time for changes to be made to the document and/or
> questionnaire it'd be nicer to maintain one single document.
The way i did this was i template a docbook file. I then process this
via one of two XSLT stylesheets to produce XHTML output, or LaTeX output
that I then run through pdflatex as normal. I used XML::LibXSLT which
uses the gnome C lib.
I prolly could have by-passed the docbook step and just transformed the
HTML into LaTeX.
I am unsure of how this rates on the 'eww evil' scale, but it Works For
Me. Let me know if you want the exact details of how i did it/the
stylesheets etc.
>
> Perhaps I could use wrappers and blocks for things like headings, and
> get the format (latex or html) from a CGI query param, and set the
> various wrappers accordingly, e.g.
>
> [% BLOCK html_section %]<h2>[% content %]</h2>[% END %]
> [% BLOCK latex_section %]\section{[% content %]}[% END %]
> ...
> [% USE q = CGI %]
> [% format = q.param('format') %]
> [% IF format == 'html' %]
> [% section = html_section %]
> [% ELSE %]
> [% section = latex_section %]
> [% END %]
> ...
> [% WRAPPER section %]Some Section Title[% END %]
>
> I'll have to try this when I'm back in the office... I just thought of
> it now while reading the docs. Please let me know if I'm too
> sleep-deprived to make any sense ;)
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://lists.template-toolkit.org/mailman/listinfo/templates
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates