There are a lot of similarities between XSLT and XUpdate. There are also
some differences. (This is a summary of earlier discussions on this line)

For every XUpdate document that can be created, I propose that one could
always write an XSLT that would give the same result (if the result
overwrites the original).

The most used templates in such an XSLT would be the following two default
templates:

"<xsl:template match='@* | text()'>
"   <xsl:copy/>
"</xsl:template>

"<xsl:template match='*'>
"   <xsl:copy>
"      <xsl:apply-templates select='@*'/>
"      <xsl:apply-templates select='* | text()'/>
"  </xsl:copy>
"</xsl:template>

The templates for the nodes that are changed would look basically the same
except that the changes would be added at the appropriate point. Which means
that I could probably write a general XSL-transform that changes an XUpdate
into one or more XSL-transforms that would do the same thing (almost).

One reason to have an XUpdate language instead of doing XSLT is that XSLT
can produce anything, while an XUpdate should only produce results that are
structurally the same as the original. Also, to update, we should not have
to explicitly write what should be the same, rather we only wish to describe
what should be changed.

Another reason is that XSLT always produces all nodes in the result,
creating a new document, while XUpdate should only affect changed nodes.

XSLT at the moment works on XML documents, while I envisage that XUpdate
would work on XML node-sets, the context "document/db/other" being handled
by other layers (one never knows, perhaps XSLT will one day too).

The actual processors for XSLT and XUpdate would be different beasts,
optimized for different purposes.

The basic commands needed in XSLT and XUpdate are the same and the
syntax-structure can (should) be similar. That is, we need to create and
call templates with parameters, we need to select data from other nodes, we
need for-each loops and we need conditional processing. The functionality
provided by XPath is beneficial for both XSLT and XUpdate.

Then there are some additional commands needed in XUpdate because we "turn
the coin around". We need an insert-new-node command, we need a delete-node
command and we need a replace/modify-node command. We also need a command to
tell the processor which node-set we are modifying. Perhaps there is more,
but I do not think it needs to be much more complicated than that.


/tobe
----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact administrator:  mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to