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] XPath 2.0 - how much of XQuery should it include?

[ Lists Home | Date Index | Thread Index ]

Jeni,

Lisp provides loops and conditionals as expressions. They are incredibly
useful, since loops and conditionals can return values and be nested inside
other expressions.  All the C based languages (including Java) have
conditional expressions, written as (condition ? result-if-true :
result-if-false).  In Lisp, one can write things like:

(let ((x (loop for i from 1 to (length my-list) as item in my-list
            collect (+ i item))) ...)
which creates a new list made by adding the index of the item in the
original list to the item for each item and binds the local variable x to
the new list.
Conditionals can be written as (if condition result-if-true
result-if-false), and use it like this:
(some-function (if (> x 0) (f x) (g (- x)) ...)

Common Lisp may also be the origin of the names of the 'every' and 'some'
expressions in XPath 2.0.

Most Lisp programmers are unhappy to lose conditional and iterative
expressions when they switch to other languages.  In general, the statement
vs. expression distinction in languages is often more of a nuisance than a
help, particularly if you are trying to write a program to translate one
language into another.

Jeff


----- Original Message -----
From: "Jeni Tennison" <jeni@jenitennison.com>
To: "Jonathan Robie" <jonathan.robie@datadirect-technologies.com>
Cc: <xml-dev@lists.xml.org>
Sent: Thursday, May 09, 2002 4:44 PM
Subject: Re: [xml-dev] XPath 2.0 - how much of XQuery should it include?


> XPath 2.0 incorporates a number of *statements* that are already
> provided by XSLT 2.0. The for "expression" and the if "expression"
> would be classed as statements in any other language. XPath 2.0 also
> replicates other functionality that's already supported in XSLT:
> sorting, for example, and variable assignment (though obviously XPath
> 2.0 can only carry out variable assignment in limited contexts,
> something that in my opinion undermines the idea that for expressions
> can solve all the problems of sequence construction in XSLT 2.0).
> Obviously XQuery needs this -- it has to have statements because it
> isn't embedded in something that does -- but XPath 2.0 doesn't (or
> wouldn't if XSLT 2.0 was adjusted to enable it to create sequences of
> atomic values, something that I believe is entirely feasible).






 

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

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