[
Lists Home |
Date Index |
Thread Index
]
> I was just glancing at XPath 2.0 (after a long time !!), I
> find a "ForExpr" as part of XPath 2.0. This was surprising,
> can you provide me a reasoning behind this?
XPath is an expression language over the data model. The data model is
based on sequences. The core operator on sequences is a mapping operator
that applies a function to each item in a sequence to produce a new
sequence. This mapping operator is implemented in XPath in the form of
the "for" expression. Without the ability to map sequences, XPath would
be very limited in its ability to manipulate values in the data model.
I'm not convinced that we have actually got the For expression right -
it's designed as a subset of the XQuery FLWR expression, whereas
arguably a mapping operator designed specifically for XPath would look
rather different. But the functionality is definitely needed.
>
> My reasoning: I was under the impression that XPath will
> provide expressions that will allow us to get nodes and
> values from XML documents, I thought this will be serve as
> the basis for most operations on XML. I felt XQuery/XSLT etc
> can sit on top of XPath.
>
Not all XPath users will be using it within XSLT or XQuery, and in any
case, in you don't want to have to keep calling back from XPath
expressions to execute XSLT functions.
Michael Kay
|