View stylesheet

XML schemas http://rod.eionet.europa.eu/obligations/137?V200807
Output type XML
Depends on aqq_content.xslt
Description Generates Form 25
XSL file aqq_form25.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="/">
	    <form25 xsi:noNamespaceSchemaLocation="http://air-climate.eionet.europa.eu/schemas/AirQualityQuestionnaire/AirQualityQuestionnaire-form25.xsd"
					xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en">
			<form25a>
				<has-consulted>
					<xsl:call-template name="TrueFalse">
						<xsl:with-param name="Value" select="//table:table[@table:name='25a']/table:table-row[3]/table:table-cell[2]/text:p"></xsl:with-param>
					</xsl:call-template>
				</has-consulted>
			</form25a>
			<form25b>
				<xsl:call-template name="Transpose">
					<xsl:with-param name="Columns" select="25"/>
					<xsl:with-param name="Table" select="'25b'"/>
				</xsl:call-template>
			</form25b>
			<form-comments/>
		</form25>
		</xsl:template>
		
<!--The template simulates a for from 1 to 25 (the number of countries) and fetches the values on the corresponding columns-->		
		<xsl:template name="Transpose">
			<xsl:param name="Columns">1</xsl:param>
			<xsl:param name="Table">1</xsl:param>
			<xsl:if test="$Columns &gt; 0">
				<country>
					<code><xsl:value-of select="//table:table[@table:name=$Table]/table:table-row[3]/table:table-cell[27 - $Columns]"></xsl:value-of></code>
					<concerned>
						<xsl:call-template name="TrueFalse">
							<xsl:with-param name="Value" select="//table:table[@table:name=$Table]/table:table-row[4]/table:table-cell[27 - $Columns]/text:p"></xsl:with-param>
						</xsl:call-template>
					</concerned>
					<agenda>
						<xsl:call-template name="TrueFalse">
							<xsl:with-param name="Value" select="//table:table[@table:name=$Table]/table:table-row[5]/table:table-cell[27 - $Columns]/text:p"></xsl:with-param>
						</xsl:call-template>
					</agenda>
					<minutes>
						<xsl:call-template name="TrueFalse">
							<xsl:with-param name="Value" select="//table:table[@table:name=$Table]/table:table-row[6]/table:table-cell[27 - $Columns]/text:p"></xsl:with-param>
						</xsl:call-template>
					</minutes>
				</country>
				<xsl:call-template name="Transpose">
					<xsl:with-param name="Columns" select="$Columns - 1"/>
					<xsl:with-param name="Table" select="'25b'"/>
				</xsl:call-template>
			</xsl:if>
		</xsl:template>

<!--The template replaces "y" by 'true" and anything else by "false"-->		
		<xsl:template name="TrueFalse">
			<xsl:param name="Value">1</xsl:param>
				<xsl:choose>
					<xsl:when test="$Value = 'y'">
						<xsl:text>true</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text>false</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
		</xsl:template>
</xsl:stylesheet>