RE: Generating XProc/XSL with XProc/XSL

Hi Zearin,



I have faced a few similar cases:



One was a system in which we needed to do arbitrary document conversions.
These conversions would be based on mappings provided by content
specialists, without developer experience. We identified various typical
actions, like wrap, unwrap, group, suppress, things like that, and
specified an XML syntax to express that. We developed an XSLT that
generated another XSLT which was able to do conversions according to the
mapping expressed in XML. Was quite powerful, even despite the fact that it
was still in the 1.0 era. That mapping also allowed to derive another XSLT
that could do completeness checks.



Another system involved transforming potentially arbitrary Word documents
(saved as Word 2003 XML for instance) to pretty much arbitrary XML. Word
documents have distinct features, like paragraphs, styled character ranges,
hyperlinks, images, headings, etc. We had mappings expressed in XML that
provided instructions for each of such features (matching on
characteristics like font styling, style name, etc). This mapping was
converted to XSLT using XSLT as well, also all 1.0.



I spoke in past tense, but actually have used the latter for a new project.
Was quite general.



So, I suggest you try to identify the functional manipulations you actually
need. Find a syntax for that, then write XSLT (or something else) to
convert that into XSLT (and/or XQuery/XProc/...)..



Cheers,

Geert



*Van:* Tony R. [mailto:tony@gonk.net]
*Verzonden:* woensdag 15 februari 2012 16:07
*Aan:* XProc Dev
*Onderwerp:* Generating XProc/XSL with XProc/XSL



Let’s say I want to write some XSL templates that allow me to map arbitrary
XML grammars into SVG.  I know what I want the SVG to look like, and I know
that the intended XML grammar is guaranteed to have certain pieces of data
that I want to map to SVG using XSL.



I’ve been in similar situations many times, but even with Oxygen (and I
love Oxygen to bits—it’s a fantastic IDE!) it can get tedious.



I have occasionally stumbled into the DocBook XSL files and seen comments
stating “This is a generated XSL file—do not edit!”



…



How does one go about writing XProc or XSL to generate XSL?  I mean, how do
you do it *intelligently?*  I’m looking for:



   - human-friendly method of writing the “generator” code
   - human-friendly code produced by the “generator”
   - flexible, modular code produced by the “generator”



—Zearin (Tony)

Received on Wednesday, 15 February 2012 15:50:38 UTC