-
Notifications
You must be signed in to change notification settings - Fork 0
/
book.xsl
40 lines (37 loc) · 1.17 KB
/
book.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?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>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th style="text-align:left">Title</th>
<th style="text-align:left">Artist</th>
<th style="text-align:left">Year</th>
<th style="text-align:left">Price</th>
</tr>
<xsl:for-each select="catalog/cd[price>'10']">
<xsl:sort select="artist" order="descending" data-type="number"/>
<tr>
<td><xsl:value-of select="title"/>(<em><xsl:value-of select="count(.)"/> </em>)</td>
<xsl:choose>
<xsl:when test="@code = 'tr' ">
<td>
<a><xsl:attribute name="href"> <xsl:value-of select="artist"/> </xsl:attribute><xsl:value-of select="artist"/> </a>
</td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="artist"/></td>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="year"/></td>
<td><xsl:value-of select="price"/></td>
</tr>
</xsl:for-each>
</table>
<xsl:value-of select="count(catalog/cd[@code='tr'])"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>