xsl-list
[Top] [All Lists]

RE: [xsl] Using XSL to output 2 files

2009-02-02 07:16:05
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(_at_)gmail(_dot_)com] 
Sent: 02 February 2009 11:56
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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.

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