[xquery-talk] replacing a node in in-memory XML

John Snelson john.snelson at oracle.com
Wed Nov 7 12:58:13 PST 2007


Andrew Welch wrote:
> On 06/11/2007, John Snelson <john.snelson at oracle.com> wrote:
>> Maybe there's not a lot of difference in the two examples given - but I
>> guess my preference will always be for a non-XML syntax for my code if I
>> have a choice.
> 
> that's interesting - even when the code contains XML fragments?
> 
> I there a reason behind your preference or is it just a personal
> preference?  I've always considered XSLT's XML syntax to be an
> advantage when you're adding XML to the result...

Or course it's just personal preference, but I think it's a preference 
shared by the majority of programmers in the world - otherwise people 
would be writing their Java or C++ in XML.

I think XQuery has it right in a lot of ways. You can use a nice human 
readable syntax for your code, but still embed XML (like) syntax when 
dealing with nodes.

If you compare any non-trivial logic written with XSLT instructions with 
that written in XQuery, I'm sure most people would find the XQuery 
easier to read.

Sam Wilmott wrote an interesting paper on this a while back [1], 
although I'm not sure I like the alternative XSLT syntax he proposes. I 
think something like XQuery extended with templates would be much nicer 
to read and write. In fact, I've got a prototype of that up and running 
at the moment - and I'm playing with it to see how little I need to add 
to XQuery to make it functional as a good alternative to XSLT.

John

[1] http://www.wilmott.ca/rxslt/rxslt.html

-- 
John Snelson, Oracle Corporation
Berkeley DB XML:        http://www.oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net


More information about the talk mailing list