more useful options | |
PerlMonks |
Re: one script, not twelve nearly identical ones!by bronto (Priest) |
on Aug 25, 2004 at 17:12 UTC ( [id://385750]=note: print w/replies, xml ) | Need Help?? |
If I well understand what your needs are, and you like perl (I believe so :-), you could consider using XML::XPathScript. XPathScript is a stylesheet language based on Perl and (guess that!) XPath. You can write different declarative templates a-la-XSLT for each XML "dialect" you use, or do more complex elaborations with perl subroutines, and let the xpathscript program to the job. For (stupid) example, if you have an XML file like this:
and this stylesheet:
you must simply run xpathscript temp.xml temp.xps to get:
Anyway, you can do much, much more with XPathScript. I recommend to take a peek at the documentation on CPAN and give it a try! PS: Of course, XPathScript stylesheets are modular, so that you could import common HTML parts (like headers and footers) from subsheets into all the ones that are specific for a certain job Ciao! The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
In Section
Seekers of Perl Wisdom
|
|