hi there i am a newbie to XML & what i want to do is to be able to take the cd example where there are a number of cds by various artists in a catalog & I then want to be able to extract all of the bob dylan cds and display them in a table ignoring the rest of the cds in the catalog.
So far I have been able to extract all the cds and display the Artist, Album, Company, country, Year etc in a table but so far have been unable to figure out how to solve this problem. I have included my XSL below & also the xml which i am trying to extract the info from. I hope i have supplied enough info! Thanks for your help..
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<catalog>
<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>
<cd>
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
<cd>
<title>Still got the blues</title>
<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
</catalog>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<xsl:variable name="XSLTEST" select="catalog/cd"/>
<tr>
count:<xsl:value-of select= "count($XSLTEST)"/>
</tr>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
<th>country</th>
<th>Company</th>
<th>price</th>
<th>year</th>
</tr>
<xsl:for-each select="$XSLTEST">
<!--<xsl:sort select="Bee Gees"/>-->
<xsl:variable name="XSLTEST101" select="."/>
<xsl:variable name="this_title" select="$XSLTEST101/title"/>
<xsl:variable name="this_artist" select="$XSLTEST101/artist"/>
<xsl:variable name="this_country" select="$XSLTEST101/country"/>
<xsl:variable name="this_company" select="$XSLTEST101/company"/>
<xsl:variable name="this_price" select="$XSLTEST101/price"/>
<xsl:variable name="this_year" select="$XSLTEST101/year"/>
<tr>
<td><xsl:value-of select="$this_title"/></td>
<td><xsl:value-of select="$this_artist"/></td>
<td><xsl:value-of select="$this_country"/></td>
<td><xsl:value-of select="$this_company"/></td>
<td><xsl:value-of select="$this_price"/></td>
<td><xsl:value-of select="$this_year"/></td>
</tr>
</xsl:for-each select>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>