xsl-list
[Top] [All Lists]

Re: [xsl] Merging changes via ID

2009-06-26 06:15:58
Hi there.

Yes, definitely more pivo is needed.
Sorry for not replying eariler, had a hectic week at work - the folks
here are a bunch of 'artistic' types so not very good with planning or
version control, but quite good with going out and pivo, of course.

Have you got any particular plans for vacation already? We have a
spare bedroom here, in London, so you'd be very welcome to come over,
if you want

As for xsl, I still haven't resolved the problem as cleanly as I
should, the reason being the messy XML that I have to work with, I'll
probably prepare some more complex samples to show you if you're
really interested...

Lech


On Mon, Jun 22, 2009 at 10:47 PM, Michael Ludwig<milu71(_at_)gmx(_dot_)de> 
wrote:
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="/*/*[(_at_)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="/*/*[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>