473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Python or Perl for XML/XSL?

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?

Feb 10 '06 #1
5 2410
James Owens wrote:
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 ?
Feb 10 '06 #2
James Owens wrote:
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.

Feb 10 '06 #3
James Owens wrote:
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'.
Feb 10 '06 #4
James Owens wrote:
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

Feb 10 '06 #5
James Owens wrote:
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

--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/

Feb 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Roy Smith | last post by:
I'm working on a prototype of a new application in Python. At some point, if this ever turns into a product, the powers that be will almost certainly demand that it be done in Perl. My job will...
42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
46
by: Reinhold Birkenfeld | last post by:
Hello, another Perl/Python question: the subject says it all. Perl is going to change dramatically to become a more powerful and easier to (read|write) language. Is Python taking a similar...
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
68
by: Lad | last post by:
Is anyone capable of providing Python advantages over PHP if there are any? Cheers, L.
9
by: Dieter Vanderelst | last post by:
Dear all, I'm currently comparing Python versus Perl to use in a project that involved a lot of text processing. I'm trying to determine what the most efficient language would be for our...
13
by: squash | last post by:
I am a little annoyed at why such a simple program in Perl is causing so much difficulty for python, i.e: $a += 200000 * 140000; print $a;
12
by: rurpy | last post by:
Is there an effcient way (more so than cgi) of using Python with Microsoft IIS? Something equivalent to Perl-ISAPI?
21
by: Roy Smith | last post by:
I'm working on a product which for a long time has had a Perl binding for our remote access API. A while ago, I wrote a Python binding on my own, chatted it up a bit internally, and recently had a...
8
by: Palindrom | last post by:
Hi everyone ! I'd like to apologize in advance for my bad english, it's not my mother tongue... My girlfriend (who is a newbie in Python, but knows Perl quite well) asked me this morning why...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.