RE: [xsl] Using XSL to output 2 files

Subject: RE: [xsl] Using XSL to output 2 files
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 2 Feb 2009 12:15:36 -0000
In XSLT 2.0:

<xsl:template match="Catalog">
  <xsl:result-document href="cds.xml">
    <xsl:copy-of select="cds"/>
  </xsl:result-document>
  <xsl:result-document href="artists.xml">
    <xsl:copy-of select="artists"/>
  </xsl:result-document>
</xsl:template> 

In XSLT 1.0, you need to write two separate transformations, one to produce
each output file.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Mike Stroud [mailto:stroudmw@xxxxxxxxx] 
> Sent: 02 February 2009 11:56
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Using XSL to output 2 files
> 
> Hello All,
> 
> I have (another) question. I have an XML file that looks like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Catalog>
>   <cds>
>     <cd>
>       <number>000001</number>
>       <title>Empire Burlesque</title>
>     </cd>
>     <cd>
>       <number>000002</number>
>       <title>Hide Your Heart</title>
>     </cd>
>   </cds>
>   <artists>
>     <artist>
>       <number>000001</number>
>       <name>Bob Dylan</name>
>     </artist>
>     <artist>
>       <number>000002</number>
>       <name>Bonnie Tyler</name>
>     </artist>
>   </artists>
>  </Catalog>
> 
>  Can I use XSL to output 2 files: 1 for cds and another for atrists?
> 
> <?xml version="1.0" encoding="UTF-8"?>
>   <cds>
>     <cd>
>       <number>000001</number>
>       <title>Empire Burlesque</title>
>     </cd>
>     <cd>
>       <number>000002</number>
>       <title>Hide Your Heart</title>
>     </cd>
>   </cds>
> 
> <?xml version="1.0" encoding="UTF-8"?>
>   <artists>
>     <artist>
>       <number>000001</number>
>       <name>Bob Dylan</name>
>     </artist>
>     <artist>
>       <number>000002</number>
>       <name>Bonnie Tyler</name>
>     </artist>
>   </artists>
> 
> Thanks, Mike.

Current Thread