Created
December 2, 2016 15:18
-
-
Save witoong623/cb3162a4538358727b143068f594d936 to your computer and use it in GitHub Desktop.
lab_w5 homework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template match="/"> | |
<html> | |
<head> | |
<style> | |
table,th, td { | |
border: 1px solid black; | |
} | |
</style> | |
</head> | |
<body> | |
<table> | |
<tr> | |
<th>title</th> | |
<th>artist</th> | |
<th>country</th> | |
<th>company</th> | |
<th>price</th> | |
<th>year</th> | |
</tr> | |
<xsl:for-each select="catalog/cd[year < 1989 and year > 1980]"> | |
<xsl:sort select="artist"/> | |
<tr> | |
<td><xsl:value-of select="title"/></td> | |
<xsl:choose> | |
<xsl:when test="country = 'USA'"> | |
<td bgcolor="#ff0000"><xsl:value-of select="artist"/></td> | |
<td bgcolor="#ff0000"><xsl:value-of select="country"/></td> | |
</xsl:when> | |
<xsl:when test="country = 'UK'"> | |
<td bgcolor="#00ff00"><xsl:value-of select="artist"/></td> | |
<td bgcolor="#00ff00"><xsl:value-of select="country"/></td> | |
</xsl:when> | |
<xsl:otherwise> | |
<td><xsl:value-of select="artist"/></td> | |
<td><xsl:value-of select="country"/></td> | |
</xsl:otherwise> | |
</xsl:choose> | |
<td><xsl:value-of select="company"/></td> | |
<td style="text-align: right; width: 100px">$<xsl:value-of select="price"/></td> | |
<td><xsl:value-of select="year"/></td> | |
</tr> | |
</xsl:for-each> | |
</table> | |
</body> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment