Declarative-Languages / Declarative Language Practical 2 / 3d.xslt
3d.xslt
Raw
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
	<xsl:output method="html" indent="yes"/>
	<xsl:template match="/africa">
		<html>
			<head>
				<title>Population Info in African Regions</title>
			</head>
			<body>
				<h1>Population Info in African Regions</h1>
				<ul>
					<xsl:for-each select="region">
						<xsl:sort select="count(country)" data-type="number"/>
						<li>
							There are <xsl:value-of select="count(country)"/> nations in <xsl:value-of select="@name"/> with a total population of <xsl:value-of select="sum(country/@population)"/>.
						</li>
					</xsl:for-each>
				</ul>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>