xsl-list
[Top] [All Lists]

Re: XSLT vs Perl

2004-02-04 08:31:04
Hi David,

It's good to see some specific comments on XSLT 2.0's weaknesses.

But string manipulation is not convenient in XSLT 2.0. It is as
messy as in perl, just without the rest of perl to compensate for
the mess (I am only mentioning perl because the working draft for
XSLT 2.0 does).

String manipulation in XSLT 2.0 is certainly inadequate for some of
the up-translations that you might want to do, such as parsing
non-regular languages such as HTML or LaTeX (both of which might
reasonably appear embedded within an XML document). In these cases,
using Perl (or another language) to pre-parse the embedded language
into XML structures seems a very reasonable way to proceed.

Did you have any other tasks in mind where the string-manipulation
support in XSLT 2.0 is inadequate?

Grouping is not easy with XSLT 1.0; but XSLT 2.0 makes it better for
a pre-selected subset of grouping tasks; and my grouping problems do
not always match the tools XSLT 2.0 provides; instead of keeping the
semantic simple and developing optimization and collaboration
techniques, XSLT 2.0 forces the programmer to use algorithms
hardwired in the implementation.

Can you expand on the kinds of grouping problems that you have that
<xsl:for-each-group> can't handle? I'm not particularly enamoured with
<xsl:for-each-group> myself, and it sounds as if you have another
design in mind; what is it?

Dates are a problem. It is an open question whether non-XML data
should be processed by XSLT or by another tool colaborating with
XSLT; I admit there are can be various approaches. But for me
personally, it is not a question whether handling dates should be ad
hoc functionality fixed in the language. It should not. If stemming
of English words is not supported by XSLT, why parsing of English
dates does?

Pragmatically, I think XPath 2.0 does the right thing by having
date/duration arithmetic support built into the language. In EXSLT,
the date-related functions are among the most commonly used; "how do I
insert the current date/time into my document" is one of the most
frequent FAQs.

Note that XSLT 2.0's date support comes via XPath 2.0, which is itself
based on XML Schema, which is based on ISO 8601. ISO 8601 dates are
different from "English dates"; XSLT 2.0 has support for formatting
such dates using various calendars and languages, but you have to
write your own code (probably using <xsl:analyze-string>) to parse
them.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>