XML to plain text conversion

I’m working on a project that’s performs some XML-to-text conversions.  Although the output is “text” (as far as XML processors are concerned), it must still follow a specific structure.  

I’m striving for modular, reusable code.  I’ve split up my XSL into 2 libraries: 

an “API” library, providing a bunch of callable templates and functions; these accept parameters and output text
a “client” library, which makes use of the “API” stylesheets to convert XML serializations of the plain text format back to original form

By this separation, I hope that the first library (of callable things) might be useful in ways I never imagined—rather than limiting it to the specific XML transformation I’m covering in the second library.  I realize this might be unconventional, but I’m convinced it’s the best choice for the project’s future.

However, I have found very few resources about XSL transformation to plain text.  I have some questions…

Are there any guidelines or best practices?  
For the callable items, are named templates or functions preferred?  (Accept parameters, output the text)
As my first XML library, any advice for writing XSL (and XProc) intended for re-use by others?


—Zearin (Tony)

Received on Wednesday, 26 September 2012 19:19:27 UTC