Re: [xsl] Re-arranging an XML file

Subject: Re: [xsl] Re-arranging an XML file
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Tue, 13 Jan 2009 14:37:34 +0100 (CET)
Mike Stroud wrote:

  Hi,

>     <cd>
>       <number>000002</number>
>       <title>Hide Your Heart</title>
>     </cd>
>   </cds>
>   <artists>
>     <artist>
>       <number>000001</number>
>       <name>Bob Dylan</name>
>     </artist>

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

  If the current item is a cd element, the following expression will
give you the corresponding artist's name (note the use of current() to
refer to the item that "was the current item at the beginning of the
expression"):

    ../../artists/artist[number eq current()/number]/name

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/

Current Thread