View stylesheet

XML schemas http://rod.eionet.europa.eu/obligations/137?V200807
Output type XML
Depends on aqq_content.xslt
Description Generates Form 6
XSL file aqq_form06.xslt (Last modified: 28 Oct 2009 11:38 )
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="/">
		<form6 xsi:noNamespaceSchemaLocation="http://air-climate.eionet.europa.eu/schemas/AirQualityQuestionnaire/AirQualityQuestionnaire-form6.xsd"
				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en">
				<xsl:call-template name="TransposeA">
					<xsl:with-param name="Columns" select="count(//table:table[@table:name='6']/table:table-row[3]/table:table-cell)"/>
					<xsl:with-param name="Total" select="count(//table:table[@table:name='6']/table:table-row[3]/table:table-cell) + 2"/>
					<xsl:with-param name="TableName" select="'6'"/>
				</xsl:call-template>
			<form-comments/>
		</form6>
	</xsl:template>
	
<!--The template simulates a for from 1 to the total number of columns and fetches the values on the corresponding columns-->
	<xsl:template name="TransposeA">
		<xsl:param name="Columns">1</xsl:param>
		<xsl:param name="Total">1</xsl:param>
		<xsl:param name="TableName">"'6'"</xsl:param>
		<xsl:if test="$Columns &gt; 0">
			<xsl:if test="//table:table[@table:name=$TableName]/table:table-row[3]/table:table-cell[$Total - $Columns]/text:p or ($Total - $Columns=2)">
				<form6-row>
					<eoi-station-code>
						<xsl:value-of select="//table:table[@table:name=$TableName]/table:table-row[3]/table:table-cell[$Total - $Columns]/text:p"/>
					</eoi-station-code>
					<local-station-code>
						<xsl:value-of select="//table:table[@table:name=$TableName]/table:table-row[4]/table:table-cell[$Total - $Columns]/text:p"/>
					</local-station-code>
					<ozone-zone-code>
						<xsl:value-of select="//table:table[@table:name=$TableName]/table:table-row[5]/table:table-cell[$Total - $Columns]/text:p"/>
					</ozone-zone-code>
					<substances>
						<xsl:for-each select="//table:table[@table:name=$TableName]/table:table-row[position()=6 or (position() &gt; 6 and ./table:table-cell[$Total - $Columns]/text:p)]">
							<substance>
								<name>
									<xsl:value-of select="table:table-cell[1]/text:p"/>
								</name>
								<measurement-method>
									<xsl:value-of select="table:table-cell[$Total - $Columns]/text:p"/>
								</measurement-method>
							</substance>
						</xsl:for-each>
					</substances>
				</form6-row>
			</xsl:if>
			<xsl:call-template name="TransposeA">
				<xsl:with-param name="Columns" select="$Columns - 1"/>
				<xsl:with-param name="Total" select="count(//table:table[@table:name='6']/table:table-row[3]/table:table-cell) + 2"/>
				<xsl:with-param name="TableName" select="'6'"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

</xsl:stylesheet>