Re: XSLT to Python script conversion?

2012-02-17 Thread Ross Ridge
Ross Ridge writes:
> The XSLT language is one of the worst misuses of XML, which puts it way
> beyond bad.

Stefan Behnel   wrote:
>Clearly a matter of opinion.

No.  There's no excuse for using XML as the syntax of a language like
XLST.

Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rri...@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: XSLT to Python script conversion?

2012-02-17 Thread Stefan Behnel
Ross Ridge, 17.02.2012 21:37:
> Matej Cepl wrote:
>> No, the strangness is not that bad (well, it is bad ... almost anything 
>> feels bad comparing to Python, to be honest, but not the reason I would 
>> give up; after all I spent couple of years with Javascript).
> 
> The XSLT language is one of the worst misuses of XML, which puts it way
> beyond bad.

Clearly a matter of opinion.

Stefan

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: XSLT to Python script conversion?

2012-02-17 Thread Ross Ridge
Matej Cepl   wrote:
>No, the strangness is not that bad (well, it is bad ... almost anything 
>feels bad comparing to Python, to be honest, but not the reason I would 
>give up; after all I spent couple of years with Javascript).

The XSLT language is one of the worst misuses of XML, which puts it way
beyond bad.

>The terrible debugging is one thing, and even worse, I just still cannot 
>get over rules around spaces: whitespace just jumps at me randomly in 
>random places and is erased in others.

I use explicit  nodes exclusively to avoid this problem.

Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rri...@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: XSLT to Python script conversion?

2012-02-16 Thread Matej Cepl

On 15.2.2012 18:48, Tim Arnold wrote:

Just a note to encourage you to stick with XSLT. I also use lxml for
creating and postprocessing my DocBook documents and it is great. But I
use the DocBook XSL stylesheets to convert to html; if you're like me,
you got discouraged at the strangeness of the XSLT language.


No, the strangness is not that bad (well, it is bad ... almost anything 
feels bad comparing to Python, to be honest, but not the reason I would 
give up; after all I spent couple of years with Javascript).


The terrible debugging is one thing, and even worse, I just still cannot 
get over rules around spaces: whitespace just jumps at me randomly in 
random places and is erased in others.


Matěj
--
http://mail.python.org/mailman/listinfo/python-list


Re: XSLT to Python script conversion?

2012-02-15 Thread Tim Arnold

On 2/13/2012 6: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


Just a note to encourage you to stick with XSLT. I also use lxml for 
creating and postprocessing my DocBook documents and it is great.  But I 
use the DocBook XSL stylesheets to convert to html; if you're like me, 
you got discouraged at the strangeness of the XSLT language.


I'm no expert with it by any means, but I'm amazed at some of the things 
it does. It is a great tool to add to your programming toolbox.


Also, I used xsltproc for a while but bogged down in processing time. 
Now I use SAXON which is much faster for my documents.


Good luck,
--Tim


--
http://mail.python.org/mailman/listinfo/python-list


Re: XSLT to Python script conversion?

2012-02-13 Thread Mike C. Fletcher

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 



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

--
http://mail.python.org/mailman/listinfo/python-list


Re: XSLT to Python script conversion?

2012-02-13 Thread Stefan Behnel
Matej Cepl, 13.02.2012 12:20:
> I am getting more and more discouraged from using XSLT for a transformation
> from one XML scheme to another one.

Could you explain what it is that discourages you about it? That would
allow us to come up with better alternatives for your specific problem.


> 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?

You could try switching to lxml. It would at least allow you to do a part
of the processing in Python and only use XSLT when it seems more
appropriate and/or easier.

Stefan

-- 
http://mail.python.org/mailman/listinfo/python-list


XSLT to Python script conversion?

2012-02-13 Thread Matej Cepl

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
--
http://mail.python.org/mailman/listinfo/python-list