Re: [xsl] XSLT vs Perl

Subject: Re: [xsl] XSLT vs Perl
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 5 Feb 2004 17:10:42 +0000
Hi David,

[snipping stuff on regular expressions and on grouping, since I mostly
agree with Mike's reply on those]

>> 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.
> THe most frequent questions are 'how can I modify a variable and how
> can I update the XML document'. Are assignments and updates in the
> draft? Have I missed something?

Your point is presumably that just because something is a FAQ doesn't
mean that XSLT 2.0 should support it.

Of course that's the case, and indeed XSLT 2.0 doesn't have support
for several things that are FAQs, where doing so would break the XSLT
processing model (such as assignments, updates, the ability to output
tags rather than elements). [Though note that 'tunnelling parameters'
go a certain way towards meeting the variable-assignment requirement.]

But I don't think that the designers of XSLT 2.0 should be berated for
trying to address as many FAQs as possible. Surely it's a good thing
for a language to be designed to address the requirements of its

> Do you really think that analyse-string is an appropriate tool for
> parsing dates?

I think it's better than using recursive templates. Would you prefer a
specialised parse-date() function that takes a similar argument to the
format-date() function? Or something else?

> My criticism is as much about XPath 2.0 as about XSLT 2.0. Why not
> just provide library mechanism, whith clearly separated domains, and
> describe a few standard library modules outside the core languages?

As you know, XSLT 2.0 supports function libraries: you construct a
stylesheet that includes <xsl:function> definitions, and then import
that into other stylesheets as appropriate. Hopefully libraries of
functions, such as those that already exist in EXSLT and FXSL, will be
constructed in this way.

The built-in function library has been gradually trimmed over time,
but if there are still functions that seem superfluous to you, I'd
encourage you to send a list of them (and arguments about why they're
superfluous) to public-qt-comments@xxxxxxx

> WHy does XPath 2.0 need to repeat a good half of perl flow control
> constructs?

I guess you're talking about 'for' and 'if'? The argument for these
control constructs is that XPath 2.0 needs to be usable as a
standalone language for accessing information from XML documents.
XPath 1.0 is not sufficient to do this in complex (primarily
data-oriented) documents, in particular where you need to do joins to
get the information that you're after. So "for" and the other
flow-control constructs are incorporated to meet that requirement.
(XSLT 2.0 and XQuery provide extra mechanisms for *constructing*
documents and for defining functions.)



Jeni Tennison

 XSL-List info and archive:

Current Thread