Python or Perl for XML/XSL?

J

James Owens

I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

James said:
At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?

Look at your environment. What's already there ?
A Microsoft Windows environment has implications.
A Unix environment allows for cost effective options.

Why XSLT ? This has implications for CGI services.
How large are your files and how important is response time ?
 
A

Andy Dingley

James said:
At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?

Of those two, Python. It's a lot cleaner and (I hate to say it)
"fashionable".

If you're building bigger tools, then Java. If you're looking for web
back ends, then Ruby is worth a look too.

It's still hard to say "You shouldn't learn Perl" though. There's just
too much of it already in existence and you will keep meeting it.
 
K

Ken Starks

James said:
I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?

Python is my preference over Perl. Its a pleasure to work with.
Where xslt seems under-powered or awkward, I normally work with Python,
which provides a comforfable front-end to several xml parsers. It also
has built-in unicode support.

However, it was when I first got 'Cocoon' working that the whole
xml thing suddenly made sense to me. It is my choice when the
main task can be achieved with xslt or a sequence of xslt
transformations. It is much less fiddly and robust than a typical cgi
script, unless you want to put a lot of time and effort into testing it.

Cocoon requires NO programming language at all. You can get a very long
way using just xslt, with data-base access using ESQL which is also
xml-based. You get a complete Web-publishing framework, which sound like
what you want for a technical library. PDF, Postscript, and (X)HTML from
the one source, which might be DOCBOOK or TEI, among others.

Beyond the basics, in Cocoon, you may need to learn Java. That's the stage
I've got to, but I have yet to make the serious plunge.

On-line, the coml.lang.python newsgroup is very friendly to
beginners, by the way.
Unlike Cocoon, where your first steps are likely to be, shall we say,
'character building'.
 
P

Peter Flynn

James said:
I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?

Python. Or Tcl. Or even PHP. Perl is just modem noise :)

///Peter, ducking
 
U

uche.ogbuji

James said:
I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?

Well here's my plug for Python, using the Amara XML Toolkit for Python
[1].

XML = """<?xml version="1.0" encoding="utf-8"?>
<monty>
<python spam="eggs">
What do you mean "bleh"
</python>
<python ministry="abuse">
But I was looking for argument
</python>
</monty>"""

import amara
doc = amara.parse('monty.xml')
print doc.monty.python.spam #prints "eggs"
print doc.monty.python[1] #prints "But I was looking for argument"
doc.monty.python.spam = u"changed" #changes the attribute value
print doc.xml_xpath(u"//python[@spam='changed']") #use XPath query
print doc.monty.xml() #re-serialize to XML

[1] http://uche.ogbuji.net/tech/4Suite/amara/

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,255
Members
46,852
Latest member
CarlaDowle

Latest Threads

Top