OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] XML-aware programming language?

[ Lists Home | Date Index | Thread Index ]

On Thu, 2 Dec 2004 23:41:18 -0000, Michael Kay <mike@saxonica.com> wrote:

> 14 lines of code (twice as much), and less scope for reuse. No great
> difference in the conceptual difficulty - both require an understanding of
> recursion - but I think XSLT emerges here as the winner. (And remember this
> is only XSLT 1.0).

Arguably the point is not to minimize the lines of code it takes to do
something  (remember APL anyone? ), but to maximize the clarity of the
code. I strongly suspect (and will stake the alcoholic beverage of
your choice the next time we meet if I can be persuaded that I'm wrong
<grin>) that if one gave the two fragments to randomly chosen software
developers who have some familiarity with XML, almost NOBODY who had
not worked with XSLT before would have a clue what it does, but almost
EVERYBODY who had some programming experience and knew enough about
XML to guess that '@secret' referred to an attribute would be able to
figure out what the XQuery fragment does.

That begs the question of whether that is simply a lack of education
that should be rectified or a fundamental problem limiting the
popularity of XSLT, of course.   Thinking back to the thread a couple
of weeks ago, it's not just a matter of people needing to understand
recursion.  As you note, BOTH are recursive.  It's a matter of getting
used to the fundamental XSLT design pattern of  applying templates to
get work done.

> But in fact there's a bigger issue - the XQuery code is wrong. It loses the
> namespaces from the source document. Perhaps I'm missing something, but I
> can't see any way to solve this. XQuery may be computationally complete, but
> it's not actually closed over the data model - there is no way of generating
> a namespace dynamically. 

That is just bizzarre to me.  (I hope you're missing something but I
have no clue what it might be)  Where does XSLT get namespace mojo
that XQuery doesn't have?  Since XSLT and XQuery are based on the same
data model, and neither fragment does anything explicit to preserve
the namespace from the source document, why is it that the XQuery
fragment loses the namespaces and the XSLT doesn't?


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS