Hi George,
Thanks very much for your help!
Regards,
Mike in SA
Date: Tue, 20 Jan 2009 10:41:51 +0200
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: George Cristian Bina <george(_at_)oxygenxml(_dot_)com>
Subject: Re: [xsl] Re: Re-arranging an XML file
Message-ID: <49758E4F(_dot_)8040904(_at_)oxygenxml(_dot_)com>
Hi Mike,
I do not understand what is the part you have difficulties with. You can
define a key to get the Author elements from their id and then just use
that, see below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes" />
<xsl:key name="artistById" match="Artist" use="Number"/>
<xsl:template match="/">
<xsl:apply-templates select="*/AddedAlbums"/>
</xsl:template>
<xsl:template match="AddedAlbums">
<AddedAlbums><xsl:apply-templates/></AddedAlbums>
</xsl:template>
<xsl:template match="Album">
<Album><xsl:apply-templates/></Album>
</xsl:template>
<xsl:template match="AlbumName">
<AlbumName><xsl:value-of select="."/></AlbumName>
</xsl:template>
<xsl:template match="ArtistNumber">
<Name><xsl:value-of select="key('artistById', .)/Name"/></Name>
</xsl:template>
<xsl:template match="*|text()"/>
</xsl:stylesheet>
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.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>
--~--