XSLT to Python script conversion?

Mike C. Fletcher mcfletch at vrplumber.com
Mon Feb 13 11:28:49 EST 2012


On 12-02-13 06:20 AM, Matej Cepl wrote:
> Hi,
>
> I am getting more and more discouraged from using XSLT for a 
> transformation from one XML scheme to another one. Does anybody could 
> share any experience with porting moderately complicated XSLT 
> stylesheet 
> (https://gitorious.org/sword/czekms-csp_bible/blobs/master/CEP2OSIS.xsl) 
> into a Python script using ElementTree's interparse or perhaps xml.sax?
>
> Any tools for this? Speed differences (currently I am using xsltproc)? 
> Any thoughts?
>
> Thank you,
>
> Matěj
I wound up rewriting the Docbook to XSL transformation for PyOpenGL's 
docs in Python using lxml.etree and Kid (now reworked to use Genshi).  
However, that was a fairly direct translation, it has only a handful of 
strategies for transforming nodes from docbook to xhtml.  That said, it 
took our processing time down from 
so-long-I-just-didn't-want-to-work-on-the-docs down to 
regenerate-whenever-I-make-a-trivial-change.

http://bazaar.launchpad.net/~mcfletch/pyopengl/directdocs/files 
<http://bazaar.launchpad.net/%7Emcfletch/pyopengl/directdocs/files>

Is the repository where the project lives.  It *also* does a lot of 
other processing, but the generate.py, model.py and 
templates/section.kid files are all you need to look at to understand 
the docbook processing.

HTH,
Mike

-- 
________________________________________________
   Mike C. Fletcher
   Designer, VR Plumber, Coder
   http://www.vrplumber.com
   http://blog.vrplumber.com




More information about the Python-list mailing list