<?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>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<head>
			<title>	Library Collections </title>
			<style>
				body {background-color: #FFFFD0; font: lucinda grande 10pt; color: #660000;
				  line-height: 1.5;}
				table {text-align: center;}
				h1{color: #660000;} h2{font-size: 11pt; color: #FFE87C;}
				th {background-color:#660000; color: #FFE87C; font-size:11pt;}
				.EN {background-color:#FFCC00;}
			</style>
		</head>
		<body>
			<h1> Library Collection </h1>
			<p> The table shows the collection size of each library. The list is ordered by collection size.</p>
			<table border="1" cellpadding="5">
				<tr>
					<th><strong>Library Name</strong></th>
					<th><strong>Collection Size</strong></th>
					<th><strong>Rare Book Collection</strong></th>
				</tr>
				<!--<xsl:sort select="library/collectionSize" order="descending"/-->
				<xsl:apply-templates/>
			</table>
		</body>
	</html>
</xsl:template>

<xsl:template match="library">
	<tr>
		<td>
			<xsl:value-of select="name/nameEn"/> 
			<font size="2">(<xsl:value-of select="name/nameOther"/>)</font>
		</td>
		<td>
			<xsl:choose>
				<xsl:when test="count(collectionSize)>0">
					<xsl:value-of select="format-number(collectionSize, '#,###,###,###')"/>
				</xsl:when>
				<xsl:when test="count(collectionSize)=0">
					Data not available.
				</xsl:when>
			</xsl:choose>
		</td>
		<td>
			<xsl:choose>
				<xsl:when test="count(rareBooks)>0">
					<xsl:value-of select="format-number(rareBooks, '#,###,###,###')"/>
				</xsl:when>
				<xsl:when test="count(rareBooks)=0">
					Data not available.
				</xsl:when>
			</xsl:choose>
		</td>
	</tr>
	
</xsl:template>
</xsl:stylesheet>