[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Merging changes via ID

Subject: Re: Merging changes via ID
From: Michael Ludwig <milu71@xxxxxx>
Date: Mon, 22 Jun 2009 23:47:57 +0200
Re:  Merging changes via ID
Michael Ludwig schrieb am 22.06.2009 um 23:37:04 (+0200):

> I'm not sure I understand all of this. Take a look at the following,
> maybe this is helpful, maybe not:

>   <!-- elements with ID below document element -->
>   <xsl:template match="/*/*[@xml:id]">
>     <xsl:copy>
>       <xsl:copy-of select="@*"/>
>       <xsl:copy-of select="document( concat( $doc2, '#', @xml:id))"/>
>     </xsl:copy>
>   </xsl:template>

> <article xmlns="http://docbook.org/ns/docbook" version="5.0"
> xml:id="SAMPLE_EN">
>     <info xml:id="intro"><info xml:id="intro">                                                    
>         <title>Wprowadzenie do Docbook</title>
>     </info></info>
>     <section xml:id="s01"><section xml:id="s01">

Alright, this is obviously wrong. I meant to write this differently, of
course, avoiding the duplication of <info> and <section>, and also
avoiding unmatched elements:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:param name="doc2" select="'lech-xmlid.pl.xml'"/>

  <!-- elements with ID below document element -->
  <xsl:template match="/*/*[@xml:id]">
    <xsl:copy-of select="document( concat( $doc2, '#', @xml:id))"/>
  </xsl:template>

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

</xsl:stylesheet>

Output is:

<article xmlns="http://docbook.org/ns/docbook" version="5.0"
xml:id="SAMPLE_EN">
    <info xml:id="intro">                                                    
        <title>Wprowadzenie do Docbook</title>
    </info>
    <section xml:id="s01">
        <title>Formatowanie i Obrazki</title>
        <para>Oto przyklad ze &lt;oXygen/&gt; moze byc uzwany do
edycji dokumentow zgodnych z dockbookx.dtd.</para>
        <para>Aby obejrzec te instrukcje w przegladarce WWW, wybierz
nastepujacy scenariusz transformacji:
            <code>Docbook HTML</code>.
        </para>
    </section> 
    
    <section xml:id="s04"><title>Przyklad zagniezdzania</title>
        <para>Aby zilustrowac problemy z zagniezdzaniem.</para>
    </section>                                   
</article>

Michael Ludwig

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.