There's more than one way to do things | |
PerlMonks |
General Transformation APIby hanenkamp (Pilgrim) |
on Oct 23, 2003 at 16:52 UTC ( [id://301639]=perlquestion: print w/replies, xml ) | Need Help?? |
hanenkamp has asked for the wisdom of the Perl Monks concerning the following question: I've been discussing an idea of mine for a generalized Transformation API on the Module Author's list and wondered what the Monks might have to say about it. The idea is this: I would like to have a semi-intelligent way of translating files from one format to another. I would like this system to be able to, at least partially, detect some aspects of the source and intermediate format of the file to determine how to reach the eventual destination format. I envision the ability to (eventually) translate one or more source files (or file handles) into one or more sink files (or file handles). Example 1: Two-step Image ConversionThat's vague, so let me describe a couple examples (use-cases for you Software Engineers). First, let's say I want to convert a TGA file into a PDF. I have a converter that will translate the TGA into a PS file and a converter from PS to PDF. The user supplies the TGA file and says, "Make it a PDF." The system the finds a path from TGA to PDF using the available converters, runs the transformations, and returns the result. Example 2: Three-Step Document ConversionSecond, let's say I have an XML file in DocBook format that includes some other markup in custom namespaces for some specialized information. It also includes some TAL information (just read the latest TPJ) that needs to generate some info. I want it to be converted to HTML. So, the system looks at the configuration and determines that I am converting an XML file that contains the TAL and other custom namespaces. I have an XSL stylesheet that can translate the specialized markup into pure DocBook, the TAL can be evaluated using Petal, I can use the DocBook XSL stylesheets to generate HTML. The system should see a path like this:
Questions...So, does such an API sound interesting? Why? Why not? What caveats would you anticipate? I've thought of several, but I want to make sure I know the risks. Anyone have a suggestion for an API or utility that is similar in Perl or another language? (That is, metaconversion tools, not actual converters like XSLT or ImageMagick.) I honorably request the wisdom of the Monks. Thank you for your thoughts.
Back to
Seekers of Perl Wisdom
|
|