Duwo
(Duwo)
December 2, 2004, 1:03am
1
Hi, I’m new to using XSLT and need some information. I have to convert one XML file to another. The source XML file looks something like this: <?xml version="1.0"?> ArtistStef Bos AlbumTussen de liefde en de leegte Track1 TitelPepermunt Tijd12345 ArtistEspen Lind AlbumRed Track1 TitelWhen Suzannah cries Tijd11111 This is what the target XML file should look like: <?xml version="1.0"?> Stef Bos Tussen de liefde en de leegte 1 Pepermunt 12345 Espen Lind Red 5 When Suzannah cries 11111 What would the XSLT file look like? I can’t seem to figure out how to look for the tracks “-node titel” and based on that node select the next node of the track (which hold the actual title). I don’t want to use fixed references like string[3] since not all nodes will be present for all tracks. Can anyone help me out here? TIA, Wouter.
Hi, The attached stylesheet worked for me; I hope it helps. It assumes that a ‘key’ element is always followed by a sibling element (such as your ‘string’ and ‘integer’ elements), and it uses the content of the assumed first sibling to populate the result element.
tracks.xsl (1.26 KB)