[xsl] Re-arranging an XML file

Subject: [xsl] Re-arranging an XML file
From: "Mike Stroud" <stroudmw@xxxxxxxxx>
Date: Tue, 13 Jan 2009 15:24:50 +0200
Hello from a newbie to this list!

I am new to XSL and have a query that I hope someone will help me with.

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>

Is there an easy way for an XSL rookie to transform  it to look more like this?

<?xml version="1.0" encoding="UTF-8"?>
 <Catalog>
   <cd>
     <title>Empire Burlesque</title>
     <artist>Bob Dylan</artist>
    </cd>
    <cd>
      <title>Hide Your Heart</title>
    <artist>Bonnie Tyler></artist>
  </cd>
</Catalog>

I realise that I'll have to link cd/number 000001 with artist/number
000001, but I have no idea how to go about it.

Many thanks,

Mike in SA

Current Thread