View stylesheet

XML schemas http://air-climate.eionet.europa.eu/schemas/AirQualityQuestionnaire/AirQualityQuestionnaire-form5.xsd
Output type HTML
Description HTML
XSL file form5.xslt (Last modified: 15 Apr 2009 17:55 )
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" indent="yes"
		doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
		omit-xml-declaration="yes" />

	<xsl:param name="xml_folder_uri" />
	<xsl:variable name="lang">en</xsl:variable>

	<!-- Uncommment the lines below for production use
	-->
	<xsl:variable name="labels_xml" select="document(concat($xml_folder_uri,'aqq-labels.xml'))" />

	<!-- Uncomment the lines below for development use
	<xsl:variable name="labels_xml" select="document('../xml/aqq-labels.xml')" />
	-->

	<xsl:variable name="labels" select="$labels_xml/tmx/body" />

	<xsl:key name="element_name_5b" match="form5b/form5b-row/pah-elements-form5/element" use="name" />
	<xsl:key name="element_name_5c" match="form5c/form5c-row/pah-elements-form5/element" use="name" />
<xsl:template match="form5">
	<html>
		<head>
			<style type="text/css">
				table {
					border: 1px solid black;
					border-collapse: collapse;
					width: 100%;
				}
				table th {
					border: 1px solid black;
				}
				table td {
					border: 1px solid black;
				}
				.centered-text {
					text-align: center;
				}
			</style>
		</head>
		<body>
			<h1>
				<xsl:value-of select="$labels/tu[@tuid='lbl-form5']/tuv[@xml:lang=$lang]" />
				- <xsl:value-of select="$labels/tu[@tuid='lbl-form5-title']/tuv[@xml:lang=$lang]" />
			</h1>
			<xsl:apply-templates select="form5a"/>
			<xsl:apply-templates select="form5b"/>
			<xsl:apply-templates select="form5c"/>
			<h2><xsl:value-of select="$labels/tu[@tuid='lbl-form-comments']/tuv[@xml:lang=$lang]" /></h2>
			<p><xsl:value-of select="form-comments"/></p>
		</body>
	</html>
</xsl:template>

<xsl:template match="form5a">
	<h2><xsl:value-of select="$labels/tu[@tuid='lbl-form5a-title']/tuv[@xml:lang=$lang]" /></h2>
	<table>
		<thead>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-station-code']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-station-code-local']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ozone-zone-code']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ethane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ethylene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-acetylene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-propane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-propene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-nbutane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ibutane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-butene1']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-trans-2butene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-cis-2butene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-13butadiene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-npentane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ipentane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-pentene1']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-pentene2']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-isoprene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-nhexane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ihexane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-nheptane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-noctane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ioctane']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-benzene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-toluene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-ethyl-benzene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-mpxylene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-oxylene']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-124trimeth']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-123trimeth']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-135trimeth']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-formaldehyde']/tuv[@xml:lang=$lang]" /></th>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-total-non-methane']/tuv[@xml:lang=$lang]" /></th>
			</tr>
		</thead>
		<tbody>
			<xsl:for-each select="form5a-row">
				<tr>
					<td><xsl:value-of select="eoi-station-code"/></td>
					<td><xsl:value-of select="local-station-code"/></td>
					<td><xsl:value-of select="ozone-zone-code"/></td>
					<td><xsl:value-of select="elements/ethane"/></td>
					<td><xsl:value-of select="elements/ethylene"/></td>
					<td><xsl:value-of select="elements/acetylene"/></td>
					<td><xsl:value-of select="elements/propane"/></td>
					<td><xsl:value-of select="elements/propene"/></td>
					<td><xsl:value-of select="elements/n-butane"/></td>
					<td><xsl:value-of select="elements/i-butane"/></td>
					<td><xsl:value-of select="elements/butene-1"/></td>
					<td><xsl:value-of select="elements/trans-2butene"/></td>
					<td><xsl:value-of select="elements/cis-2butene"/></td>
					<td><xsl:value-of select="elements/butadiene13"/></td>
					<td><xsl:value-of select="elements/n-pentane"/></td>
					<td><xsl:value-of select="elements/i-pentane"/></td>
					<td><xsl:value-of select="elements/pentene-1"/></td>
					<td><xsl:value-of select="elements/pentene-2"/></td>
					<td><xsl:value-of select="elements/isoprene"/></td>
					<td><xsl:value-of select="elements/n-hexane"/></td>
					<td><xsl:value-of select="elements/i-hexane"/></td>
					<td><xsl:value-of select="elements/n-heptane"/></td>
					<td><xsl:value-of select="elements/n-octane"/></td>
					<td><xsl:value-of select="elements/i-octane"/></td>
					<td><xsl:value-of select="elements/benzene"/></td>
					<td><xsl:value-of select="elements/toluene"/></td>
					<td><xsl:value-of select="elements/ethyl-benzene"/></td>
					<td><xsl:value-of select="elements/mp-xylene"/></td>
					<td><xsl:value-of select="elements/o-xylene"/></td>
					<td><xsl:value-of select="elements/trimeth-benzene-124"/></td>
					<td><xsl:value-of select="elements/trimeth-benzene-123"/></td>
					<td><xsl:value-of select="elements/trimeth-benzene-135"/></td>
					<td><xsl:value-of select="elements/formaldehyde"/></td>
					<td><xsl:value-of select="elements/total-non-methane-hydrocarbons"/></td>
				</tr>
			</xsl:for-each>
		</tbody>
	</table>
</xsl:template>

<xsl:template match="form5b">
	<h2><xsl:value-of select="$labels/tu[@tuid='lbl-form5b-title']/tuv[@xml:lang=$lang]" /></h2>
	<table class="centered-text">
		<thead>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-station-code']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5b/form5b-row">
					<td colspan="2"><xsl:value-of select="./eoi-station-code" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-station-code-local']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5b/form5b-row">
					<td colspan="2"><xsl:value-of select="./local-station-code" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-zone-codes']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5b/form5b-row">
					<td colspan="2"><xsl:value-of select="./zone-code" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-compounds']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5b/form5b-row">
					<th><xsl:value-of select="$labels/tu[@tuid='lbl-sampling']/tuv[@xml:lang=$lang]" /></th>
					<th><xsl:value-of select="$labels/tu[@tuid='lbl-analysis']/tuv[@xml:lang=$lang]" /></th>
				</xsl:for-each>
			</tr>
		</thead>
		<tbody>
			<xsl:for-each select="form5b-row/pah-elements-form5/element[count(. | key('element_name_5b', name)[1]) = 1]">
				<xsl:variable name="compound_name" select="./name" />
				<tr>
					<td><xsl:value-of select="name" /></td>
					<xsl:for-each select="/form5/form5b/form5b-row">
						<xsl:variable name="station_code" select="eoi-station-code" />
						<td>
							<xsl:call-template name="find-sampling">
								<xsl:with-param name="compoundName" select="$compound_name" />
								<xsl:with-param name="stationCode" select="$station_code" />
								<xsl:with-param name="path" select="/form5/form5b/form5b-row" />
								<xsl:with-param name="factor" select="'sampling'" />
							</xsl:call-template>
						</td>
						<td>
							<xsl:call-template name="find-sampling">
								<xsl:with-param name="compoundName" select="$compound_name" />
								<xsl:with-param name="stationCode" select="$station_code" />
								<xsl:with-param name="path" select="/form5/form5b/form5b-row" />
								<xsl:with-param name="factor" select="'analysis'" />
							</xsl:call-template>
						</td>
					</xsl:for-each>
				</tr>
			</xsl:for-each>
		</tbody>
	</table>
</xsl:template>

<xsl:template name="find-sampling">
	<xsl:param name="stationCode" />
	<xsl:param name="compoundName" />
	<xsl:param name="path" />
	<xsl:param name="factor" />

	<xsl:for-each select="$path">
		<xsl:variable name="i" select="." />
		<xsl:variable name="sc" select="eoi-station-code" />
		<xsl:if test="$stationCode = $sc">
			<xsl:for-each select="$i/pah-elements-form5/element">
				<xsl:variable name="cn" select="name" />
				<xsl:if test="$compoundName = $cn">
					<xsl:if test="$factor = 'sampling'">
						<xsl:value-of select="sampling" />
					</xsl:if>
					<xsl:if test="$factor = 'analysis'">
						<xsl:value-of select="analysis" />
					</xsl:if>
				</xsl:if>
			</xsl:for-each>
		</xsl:if>
	</xsl:for-each>
</xsl:template>


<xsl:template match="form5c">
	<h2><xsl:value-of select="$labels/tu[@tuid='lbl-form5c-title']/tuv[@xml:lang=$lang]" /></h2>
	<table class="centered-text">
		<thead>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-station-code']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5c/form5c-row">
					<td colspan="2"><xsl:value-of select="./eoi-station-code" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-station-code-local']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5c/form5c-row">
					<td colspan="2"><xsl:value-of select="./local-station-code" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-zone-codes']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5c/form5c-row">
					<td colspan="2"><xsl:value-of select="./zone-code" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-air-monitoring']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5c/form5c-row">
					<td colspan="2"><xsl:value-of select="./monitoring-in-air-deposition" /></td>
				</xsl:for-each>
			</tr>
			<tr>
				<th><xsl:value-of select="$labels/tu[@tuid='lbl-compounds']/tuv[@xml:lang=$lang]" /></th>
				<xsl:for-each select="/form5/form5c/form5c-row">
					<th><xsl:value-of select="$labels/tu[@tuid='lbl-sampling']/tuv[@xml:lang=$lang]" /></th>
					<th><xsl:value-of select="$labels/tu[@tuid='lbl-analysis']/tuv[@xml:lang=$lang]" /></th>
				</xsl:for-each>
			</tr>
		</thead>
		<tbody>
			<xsl:for-each select="form5c-row/pah-elements-form5/element[count(. | key('element_name_5c', name)[1]) = 1]">
				<xsl:variable name="compound_name" select="./name" />
				<tr>
					<td><xsl:value-of select="name" /></td>
					<xsl:for-each select="/form5/form5c/form5c-row">
						<xsl:variable name="station_code" select="eoi-station-code" />
						<td>
							<xsl:call-template name="find-sampling">
								<xsl:with-param name="compoundName" select="$compound_name" />
								<xsl:with-param name="stationCode" select="$station_code" />
								<xsl:with-param name="path" select="/form5/form5c/form5c-row" />
								<xsl:with-param name="factor" select="'sampling'" />
							</xsl:call-template>
						</td>
						<td>
							<xsl:call-template name="find-sampling">
								<xsl:with-param name="compoundName" select="$compound_name" />
								<xsl:with-param name="stationCode" select="$station_code" />
								<xsl:with-param name="path" select="/form5/form5c/form5c-row" />
								<xsl:with-param name="factor" select="'analysis'" />
							</xsl:call-template>
						</td>
					</xsl:for-each>
				</tr>
			</xsl:for-each>
		</tbody>
	</table>
</xsl:template>
</xsl:stylesheet>