[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] how with xPath 1


Subject: [xsl] how with xPath 1
From: Leo Studer <leo.studer@xxxxxxxxxxx>
Date: Sat, 14 Apr 2012 09:05:24 +0200

Hello

in xPath 2.0 I retrieve the newest CDs for each artist like that

for $i in distinct-values(//artist) return (//cd[artist eq $i and year=
max(//cd[artist eq $i ]/year)])

How can I do that with xPath 1?

Here a snippet of the xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
<cdcatalog>
   <cd>
      <title>Empire Burlesque</title>
      <artist>Bob Dylan</artist>
      <country>USA</country>
      <company>Columbia</company>
      <price>10.90</price>
      <year>1985</year>
   </cd>
   <cd>
      <title>Hide your heart</title>
      <artist>Bonnie Tyler</artist>
      <country>UK</country>
      <company>CBS Records</company>
      <price>9.90</price>
      <year>1988</year>
   </cd>
.
.
.
.
.
</cdcatalog>


Current Thread
Keywords