RE: [transquery-discuss] XSLT as an XML update language

From: Chris Bayes (chris@bayes.co.uk)
Date: Fri Jan 04 2002 - 10:04:08 CET


Evan,
I think you meant

<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:tq="http://www.xmlportfolio.com/transquery">

  <xsl:param name="tq:input"/>

  <!-- Apply templates in the tq:update mode to each
       document in the TransQuery input collection -->
  <xsl:template match="/">
   <tq:documents>
    <xsl:apply-templates select="$tq:input" mode="tq:update"/>
   </tq:documents>
  </xsl:template>

  <!-- For each document in the TransQuery input
       collection, create a new document with the
       same generated id (effectively replacing it).
       Recursively apply templates in the tq:update
       mode to all descendants. -->
  <xsl:template match="/" mode="tq:update">
    
      <tq:document id="{generate-id()}">
        <xsl:apply-templates mode="tq:update"/>
      </tq:document>
    
  </xsl:template>

  <!-- The default rule for all elements,
       attributes, comments, PIs, and text
       nodes is to copy the node as is
       (and recursively apply templates to
       children of elements). -->
  <xsl:template match="@*|node()" mode="tq:update">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" mode="tq:update"/>
    </xsl:copy>
  </xsl:template>

</xsl:transform>

Unfortunately I can't see any way of matching a generated id to a
document for my implementation without doing 2 transforms and then there
is no guarantee that the id will be the same each time. So I'll stick
with the href route and tq:baseURI.

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml



This archive was generated by hypermail 2.1.4 : Fri Feb 22 2002 - 11:35:58 CET