[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] The fundamental differences between XPath and XSLT?
Subject: Re: [xsl] The fundamental differences between XPath and XSLT? From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 9 Apr 2008 12:42:22 +0100 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] The fundamental differenc, Michael Kay | Thread | Re: [xsl] The fundamental differenc, Colin Adams |
RE: [xsl] The fundamental differenc, Michael Kay | Date | Re: [xsl] The fundamental differenc, Colin Adams |
Month |