View stylesheet

XML schemas http://air-climate.eionet.europa.eu/databases/o3excess/ozonestations.xsd
Output type HTML
Description Show station list as HTML table
XSL file stations.xsl (Last modified: 02 Oct 2007 10:48 )
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="stations">
	<html>
		<head>
			<title>Current stations</title>
		</head>
		<body>
			<h1>Current stations</h1>
			<table border="1">
				<xsl:apply-templates select="station"/>
			</table>
		</body>
	</html>
</xsl:template>

<xsl:template match="station">
		<xsl:if test="position()=1">
			<xsl:call-template name="header"/>
		</xsl:if>
	<tr>
		<xsl:apply-templates />
	</tr>
</xsl:template>

<!--   template for building table cells with values -->

<xsl:template match="*">
	<td>
		<xsl:value-of select="." />
	</td>
</xsl:template>

<!--  a named template, which creates the table header row -->
<xsl:template name="header">
	<tr>
	<xsl:for-each select="*">
		<th bgcolor="#87CEFA"><xsl:value-of select="local-name()" /></th>
	</xsl:for-each>
	</tr>
</xsl:template>

</xsl:stylesheet>