xsl-list
[Top] [All Lists]

Re: [xsl] The fundamental differences between XPath and XSLT?

2008-04-09 04:43:35


1. An XPath expression operates on one or more in-memory node trees.

The Xpath language is defined to work on a particular data model (with
no particular name in xpath1, called XDM in xpath 2). Some
implementations may model that datamodel with an in memory
implementation, and some may not.

so:    (b) False


2. An XPath expression cannot change an in-memory node tree.  (More
precisely, "Evaluating an XPath expression cannot result in changes to
any in-memory node trees.")

No standard Xpath functions change the source data, but extension
functions might, and there is a standard (namespace) mechanism in Xpath
for calling extension functions . Xpath results need to be returned
somewhere, and that may possibly be a new in memory tree, so teh result
tree may be mosified 9(r created, which is a kind of moddification)

so:    (b) False


3. XPath can only be used to:
     - navigate through an in-memory node tree
     - retrieve values from the in-memory node tree
     - operate on the values it retrieves (the result of an operation
does not modify the in-memory node tree)

This is the same as question 1 and 2 combined, so the same comments
apply, the tree need not be in memory (I can sometimes evaluate Xpath,
in my head, based on the linear serialisation of an XML document on a
piece of paper) Relational databases my offer Xpath APi to data that
internally isn't stored as a tree at all, ...

so:  (b) False


5. An XSLT element can change an in-memory node tree.  (More precisely,
"Evaluating an XSLT element can result in changes to one or more
in-memory node trees.")

XSLT is essentially the same as XPath in this regard (especially for
XSLT2/Xpath2) it is written assuming a read only view of its data, which
need not be "in memory", but extension functions may break that
assumption (but results are then not defined (by the xslt spec)

so:    (b) False



6. The "in-memory node tree" referenced above is always a "DOM tree."
Thus, for example, (1) is more precisely phrased as: An XPath
expression operates on one or more DOM trees.

XDM trees could be modelled as a separate API over a W3C DOM
implementation (and some systems do this) but there are a lot of
differences between the W3C DOM and XDM and so it's often more efficient
just to unpack the DOM tree and rebuild to an XSLT engine's native tree
structure rather than have the implementation "layer" the Xpath
interface over the DOM,

so:    (b) False

David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>