View stylesheet

XML schemas http://waste.eionet.europa.eu/schemas/sewagesludge/schema.xsd
Output type HTML
Description Directive 86/278 factsheet
XSL file dir86278factsheet.xsl (Last modified: 07 Apr 2008 10:42 )
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output 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"/>

	<!-- import labels xml file -->
	<xsl:param name="xml_folder_uri"/>
	<xsl:variable name="labels" select="document(concat($xml_folder_uri,'dir86278_labels.xml'))/labels/itemset[@id='86278' and @xml:lang='en']"/>

	<xsl:template match="Questionnaire">
		<html>
			<head>
				<title>
					<xsl:copy-of select="$labels/item[@id='h1']/text()"/>
				</title>
					<style type="text/css">
.tbl{
	width:100%;
	padding: 0.3em 0em;
	margin-top:0.4em;
}
.tbl th{
	text-align:left;
	border:1px solid #d3d3d3;;
}
.tbl td{
	align:left;
	border:1px solid #d3d3d3;
}
					</style>
			</head>
			<body>
				<h1>
					<xsl:copy-of select="$labels/item[@id='h1']/text()"/>
				</h1>
				<table border="1">
					<tr>
						<th colspan="2">
							<xsl:value-of select="$labels/item[@id='I-h2']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates select="*[starts-with(local-name(.),'Quest86278-I-')]"/>
				</table>
				<table border="1">
					<tr>
						<th colspan="2">
							<xsl:value-of select="$labels/item[@id='II-h2']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates select="*[starts-with(local-name(.),'Quest86278-II-')]"/>
				</table>
			</body>
		</html>
	</xsl:template>

		<!-- ##################################          PAGE 1           ############################################-->


	<xsl:template match="Quest86278-I-1a">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="true()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-I-1b-IfNo">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-I-2a">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="true()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-I-2b-IfNo">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-I-2c">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="true()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-I-2d-IfNo">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>

		<!-- ##################################         II           ############################################-->
	<xsl:template match="Quest86278-II-1">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>


<!-- ##################################      II   2a  table           ############################################-->
	
	<xsl:template match="Quest86278-II-2a-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="4">
							<xsl:copy-of select="$labels/item[@id='II-2a-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2a-row">
		<tr>
			<th rowspan="2">
				<xsl:copy-of select="$labels/item[@id='II-2a-IDSubstance']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2a-Conc-in-soil']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2a-Conc-in-sludges']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2a-Appl-in-agriculture']/text()"/>
			</th>
		</tr>
		<tr>
			<th><xsl:copy-of select="$labels/item[@id='II-2a-h2']/text()"/></th>
			<th><xsl:copy-of select="$labels/item[@id='II-2a-h2']/text()"/></th>
			<th><xsl:copy-of select="$labels/item[@id='II-2a-h2']/text()"/></th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDSubstance"/>
			</td>
			<td>
				<xsl:value-of select="Conc-in-soil"/>
			</td>
			<td>
				<xsl:value-of select="Conc-in-sludges"/>
			</td>
			<td>
				<xsl:value-of select="Appl-in-agriculture"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2a-Comments']/text()"/>
			</th>
			<td colspan="3">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2a">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-2b">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
<!-- ##################################      II   2c  table           ############################################-->
	
	<xsl:template match="Quest86278-II-2c-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="3">
							<xsl:copy-of select="$labels/item[@id='II-2c-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2c-row">
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-IDSubstance']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-Sites']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-SAC']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDSubstance"/>
			</td>
			<td>
				<xsl:value-of select="Sites"/>
			</td>
			<td>
				<xsl:value-of select="SAC"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-Soil-type']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-pH']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-NLV']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="Soil-type"/>
			</td>
			<td>
				<xsl:value-of select="pH"/>
			</td>
			<td>
				<xsl:value-of select="NLV"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2c-Comments']/text()"/>
			</th>
			<td colspan="2">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2c">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>

<!-- ##################################      II   2d  table           ############################################-->
	
	<xsl:template match="Quest86278-II-2d-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="3">
							<xsl:copy-of select="$labels/item[@id='II-2d-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2d-row">
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-IDSubstance']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-Sites']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-MQSA']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDSubstance"/>
			</td>
			<td>
				<xsl:value-of select="Sites"/>
			</td>
			<td>
				<xsl:value-of select="MQSA"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-Soil-type']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-pH']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-NLV']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="Soil-type"/>
			</td>
			<td>
				<xsl:value-of select="pH"/>
			</td>
			<td>
				<xsl:value-of select="NLV"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2d-Comments']/text()"/>
			</th>
			<td colspan="2">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2d">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>

<!-- ##################################      II   2e  table           ############################################-->
	
	<xsl:template match="Quest86278-II-2e-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="3">
							<xsl:copy-of select="$labels/item[@id='II-2e-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2e-row">
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-IDSubstance']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-Sites']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-SAC']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDSubstance"/>
			</td>
			<td>
				<xsl:value-of select="Sites"/>
			</td>
			<td>
				<xsl:value-of select="SAC"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-Soil-type']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-pH']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-NLV']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="Soil-type"/>
			</td>
			<td>
				<xsl:value-of select="pH"/>
			</td>
			<td>
				<xsl:value-of select="NLV"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-2e-Comments']/text()"/>
			</th>
			<td colspan="2">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-2e">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-3a">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-3b">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="true()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-3c-IfYes">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-3d">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="true()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-3e-IfYes">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-4">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-5a">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="true()"/>
		</xsl:call-template>
	</xsl:template>

<!-- ##################################      II   5b  table           ############################################-->
	
	<xsl:template match="Quest86278-II-5b-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="3">
							<xsl:copy-of select="$labels/item[@id='II-5b-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-5b-row">
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-5b-IDSubstance']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-5b-RLV']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-5b-OM']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDSubstance"/>
			</td>
			<td>
				<xsl:value-of select="RLV"/>
			</td>
			<td>
				<xsl:value-of select="OM"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-5b-Comments']/text()"/>
			</th>
			<td colspan="2">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-5b">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-6a">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="Quest86278-II-6b">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>
<!-- ##################################      II   7 A  table           ############################################-->
	
	<xsl:template match="Quest86278-II-7-A-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="4">
							<xsl:copy-of select="$labels/item[@id='II-7-A-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-7-A-row">
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-A-IDYear']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-A-Sludge-produced']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-A-Sludge-agriculture']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-A-Surface-covered']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDYear"/>
			</td>
			<td>
				<xsl:value-of select="Sludge-produced"/>
			</td>
			<td>
				<xsl:value-of select="Sludge-agriculture"/>
			</td>
			<td>
				<xsl:value-of select="Surface-covered"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-A-Comments']/text()"/>
			</th>
			<td colspan="3">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-7-A">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>	
	
	<!-- ##################################      II   7 B  table           ############################################-->
	
	<xsl:template match="Quest86278-II-7-B-table">
		<tr>
			<td colspan="2">
				<table class="tbl">
					<tr>
						<th colspan="7">
							<xsl:copy-of select="$labels/item[@id='II-7-B-table']/text()"/>
						</th>
					</tr>
					<xsl:apply-templates/>
				</table>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-7-B-row">
		<tr>
			<th></th>
			<th colspan="6">
				<xsl:copy-of select="$labels/item[@id='II-7-B-h2']/text()"/>
			</th>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-IDSubstance']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-IDYear1']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-Sludge-agriculture1']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-IDYear2']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-Sludge-agriculture2']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-IDYear3']/text()"/>
			</th>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-Sludge-agriculture3']/text()"/>
			</th>
		</tr>
		<tr>
			<td>
				<xsl:value-of select="IDSubstance"/>
			</td>
			<td>
				<xsl:value-of select="IDYear1"/>
			</td>
			<td>
				<xsl:value-of select="Sludge-agriculture1"/>
			</td>
			<td>
				<xsl:value-of select="IDYear2"/>
			</td>
			<td>
				<xsl:value-of select="Sludge-agriculture2"/>
			</td>
			<td>
				<xsl:value-of select="IDYear3"/>
			</td>
			<td>
				<xsl:value-of select="Sludge-agriculture3"/>
			</td>
		</tr>
		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id='II-7-B-Comments']/text()"/>
			</th>
			<td colspan="6">
				<xsl:value-of select="Comments"/>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="Quest86278-II-7-B">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>	
	<xsl:template match="Quest86278-II-8">
		<xsl:call-template name="buildTR">
			<xsl:with-param name="yesno" select="false()"/>
		</xsl:call-template>
	</xsl:template>	
	
	
	<!-- buid html table TR for one question -->
	<xsl:template name="buildTR">
		<xsl:param name="yesno"/>
		<xsl:param name="label_id" select="substring(local-name(.),12)"/>

		<tr>
			<th>
				<xsl:copy-of select="$labels/item[@id=$label_id]/text()"/>
			</th>
			<td>
				<xsl:choose>
					<xsl:when test="$yesno=true()">
						<xsl:call-template name="YesNoUnknown">
							<xsl:with-param name="Param" select="."/>
						</xsl:call-template>
					</xsl:when>
					<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
				</xsl:choose>
			</td>
		</tr>
	</xsl:template>

	<!-- YesNoUnknown implementation -->
	<xsl:template name="YesNoUnknown">
		<xsl:param name="Param"/>
		<xsl:choose>
			<xsl:when test="$Param = '1' or $Param = 'true'">Yes</xsl:when>
			<xsl:when test="$Param = '0' or $Param = 'false'">No</xsl:when>
			<xsl:when test="$Param = ''">Unanswered</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="*"/>
</xsl:stylesheet>