RE: [xsl] Transforming XML to multiple different versions (multiple files)

Subject: RE: [xsl] Transforming XML to multiple different versions (multiple files)
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Thu, 4 Mar 2004 22:01:22 +0100
> -----Original Message-----
> From: Richard Corfield
>
<snip />

Hi,

> I have worked out how to output the <chapter> elements to
> multiple files, but I'm having trouble copy ing the preceding and
> following parts of the xml. Here is a snippet of the XSL I have
> been working with: (I'm using XML::LibXSLT to do the transform)
>

Since it appears that the relevant data is always in the same position
relative to the chapter elements, I'd guess something like this would do it

...
<!-- global -->
<xsl:variable name="vmeta" select="book/metadata" />
<xsl:variable name="vbook" select="book/bookdata/*[not(name(.)='contents')]"
/>
...
<xsl:template match="chapter">
  <xsl:document href="...">
    <book ref="ancestor::book/@id">
      <xsl:copy-of select="$vmeta" />
      <bookdata>
        <xsl:copy-of select="$vbook" />
        <contents pdf="parent::contents/@pdf">
          <xsl:copy-of select="." />
        </contents>
      </bookdata>
    </book>
  </xsl:document>
</xsl:template>

However, last time I checked, XSLT 1.0 didn't support multidoc output unless
extensions are used..


Hope this helps!

Cheers,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread