[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re-arranging an XML file

Subject: Re: Re-arranging an XML file
From: Mike Stroud <stroudmw@xxxxxxxxx>
Date: Wed, 21 Jan 2009 09:05:18 +0200
 Re: Re-arranging an XML file
Hi George,

Thanks very much for your help!

Regards,

Mike in SA

> Date: Tue, 20 Jan 2009 10:41:51 +0200
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> From: George Cristian Bina <george@xxxxxxxxxxxxx>
> Subject: Re:  Re: Re-arranging an XML file
> Message-ID: <49758E4F.8040904@xxxxxxxxxxxxx>
>
> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.