Begin forwarded message:

Date: Sat, 28 Sep 2002 23:43:54 +0200 (CEST)
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Sat, 28 Sep 2002 23:29:57 +0200
From: Nicolas Chauvat <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 
Debian/1.0.0-0.woody.1
X-Accept-Language: fr, en
MIME-Version: 1.0
To: [EMAIL PROTECTED]
Subject: Re: XUpdate via XSLT
References: <[EMAIL PROTECTED]>
Content-Type: multipart/mixed;
 boundary="------------030108050904000603050303"
X-Virus-Scanned: by amavisd-new amavisd-new-20020630

This is a multi-part message in MIME format.
--------------030108050904000603050303
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Crull, Torsten wrote:

>I just subscribed to this mailing list and first i want to say
>
>    " Hello! "
>
>to anybody. :-)
>
>I think, it should be possible to design an XSLT-File, which anybody can use
>to update an XML-File with an XUpdate-File using a standard XSLT-Processor.
>
>I made a little slide to show, what I mean:
>
> <<XUpdate_via_XSLT.gif>> 
>Does anybody have alredy tried this idea? Are there any comments?
>  
>
This is exactly what I began implementing a couple month ago as part of 
an xmlrevision tool meant to complement our xmldiff.

The xslt is attached. It is incomplete at the moment.

For xmldiff and xmlrev, see http://www.logilab.org/

Hope this helps :-)

-- 
Nicolas        |\      _,,,---,,_      
CHAUVAT  ZZzz /,`.-'`'    -.  ;-;;,_   
             |,4-  ) )-,_. ,\ (  `'-'  
            '---''(_/--'  `-'\_)       



      



--------------030108050904000603050303
Content-Type: text/plain;
 name="xmlrev.xslt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="xmlrev.xslt"

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!--
-
- (c) 2001-2002 Nicolas Chauvat <[EMAIL PROTECTED]> - License is GPL
-
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:x="http://www.w3.org/1999/XSL/Transform";
                xmlns:xupdate="http://www.xmldb.org/xupdate";
                exclude-result-prefixes="xsl x"
                version="1.0">

<xsl:output method="xml" indent="yes"/>

<!-- generique -->

<xsl:template match="/">
  <xsl:element name="x:stylesheet">
    <xsl:attribute name="xmlns:x">http://www.w3.org/1999/XSL/Transform</xsl:attribute>
    <xsl:attribute name="version">1.0</xsl:attribute>

    <xsl:element name="x:output">
      <xsl:attribute name="method">xml</xsl:attribute>
      <xsl:attribute name="indent">yes</xsl:attribute>
    </xsl:element>

    <xsl:element name="x:template">
       <xsl:attribute name="match">node()</xsl:attribute>
       <xsl:element name="x:copy">
         <xsl:element name="x:apply-templates">
           <xsl:attribute name="select">*|@*|text()</xsl:attribute>
         </xsl:element>
       </xsl:element>
    </xsl:element>

    <xsl:element name="x:template">
       <xsl:attribute name="match">@*|text()</xsl:attribute>
       <xsl:element name="x:copy-of">
         <xsl:attribute name="select">.</xsl:attribute>
       </xsl:element>
    </xsl:element>

    <xsl:apply-templates select="xupdate:modifications/*"/>

  </xsl:element>

</xsl:template>

<!-- XUPDATE:UPDATE -->

<xsl:template match="xupdate:update">
    <xsl:element name="x:template">
      <xsl:choose>
        <xsl:when test="contains(@select,'text()')">
          <xsl:attribute name="match"><xsl:value-of 
select="substring-before(@select,'/text()')"/></xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="match"><xsl:value-of 
select="substring-before(@select,'/text()')"/></xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
 
       <xsl:element name="x:copy">
         <xsl:element name="x:attribute">
           <xsl:attribute name="name">revisionflag</xsl:attribute>
           <xsl:text>changed</xsl:text>
         </xsl:element>

         <xsl:element name="x:apply-templates"/>

       </xsl:element>

    </xsl:element>
</xsl:template>

<!-- XUPDATE:REMOVE -->

<xsl:template match="xupdate:remove">
    <xsl:element name="x:template">
      <xsl:attribute name="match"><xsl:value-of select="@select"/></xsl:attribute>
       <xsl:element name="x:copy">
         <xsl:element name="x:attribute">
           <xsl:attribute name="name">revisionflag</xsl:attribute>
           <xsl:text>removed</xsl:text>
         </xsl:element>
       </xsl:element>

       <xsl:element name="x:apply-templates"/>

    </xsl:element>
</xsl:template>

<!-- XUPDATE:INSERT-BEFORE -->

  <xsl:template match="xupdate:insert-before">
    <!-- FIXME/TODO -->
    <xsl:message>FIXME/TODO: xupdate:insert-before is not implemented yet. Care to 
help ?</xsl:message>
  </xsl:template>

<!-- XUPDATE:INSERT-AFTER -->

  <xsl:template match="xupdate:insert-after">
    <!-- FIXME/TODO -->
    <xsl:message>FIXME/TODO: xupdate:insert-after is not implemented yet. Care to help 
?</xsl:message>
  </xsl:template>

<!-- XUPDATE:RENAME -->

  <xsl:template match="xupdate:rename">
    <xsl:element name="x:template">
      <xsl:attribute name="match"><xsl:value-of select="@select"/></xsl:attribute>
      <xsl:element name="x:element">
        <xsl:attribute name="name"><xsl:value-of select="text()"/></xsl:attribute>
        <xsl:element name="x:attribute">
          <xsl:attribute name="name">revisionflag</xsl:attribute>
          <xsl:text>removed</xsl:text>
        </xsl:element>
        <xsl:element name="x:copy-of">
          <xsl:attribute name="select"><xsl:text>@*|*|text()</xsl:text></xsl:attribute>
        </xsl:element>
      </xsl:element>

      <xsl:element name="x:apply-templates"/>

    </xsl:element>
  </xsl:template>

<!-- XUPDATE:APPEND -->

  <xsl:template match="xupdate:append">
    <!-- FIXME/TODO -->
    <xsl:message>FIXME/TODO: xupdate:append is not implemented yet. Care to help 
?</xsl:message>
  </xsl:template>

</xsl:stylesheet>

--------------030108050904000603050303--


--
______________________________________________________________________
Lars Martin                             mailto:[EMAIL PROTECTED]
SMB GmbH                                        http://www.smb-tec.com

----------------------------------------------------------------------
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