View stylesheet

XML schemas http://converters.eionet.europa.eu/util/Art17/2012
Output type HTML
Description Converts lu_all.xml into XSL format to be used by art17 and art12 XSL.
XSL file art12_art17_lookups_converter.xsl (Last modified: 22 Oct 2013 23:14 )
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!--
    Converts Article 17 lu_all.xml into XSL templates to gain better performance, when converting large XML files.
-->
    <xsl:output  method="xml" indent="yes"/>

    <xsl:template match="/">
        <xsl:element name="xsl:stylesheet">
            <xsl:attribute name="version">1.0</xsl:attribute>
            <xsl:variable name="lookup_rows" select="dataroot/child::*"/>

            <xsl:element name="xsl:template">
                <xsl:attribute name="name">getLookupCodeLabel</xsl:attribute>
                <xsl:element name="xsl:param"><xsl:attribute name="name">lu_name</xsl:attribute></xsl:element>
                <xsl:element name="xsl:param"><xsl:attribute name="name">code</xsl:attribute></xsl:element>
                <xsl:element name="xsl:choose">
                    <xsl:for-each select="distinct-values(dataroot/child::*/name())">
                        <xsl:variable name="tbl_name" select="."/>
                        <xsl:element name="xsl:when">
                            <xsl:attribute name="test">$lu_name = '<xsl:value-of select="$tbl_name"/>'</xsl:attribute>
                            <xsl:element name="xsl:choose">
                                <xsl:for-each select="$lookup_rows">
                                    <xsl:if test="name(.)=$tbl_name">
                                        <xsl:element name="xsl:when">
                                            <xsl:attribute name="test">$code = '<xsl:value-of select="lower-case(code)"/>'</xsl:attribute>
                                            <xsl:choose><xsl:when test="$tbl_name='lu_habitattype_codes'"><xsl:value-of select="valide_name"/></xsl:when><xsl:otherwise><xsl:value-of select="name"/></xsl:otherwise></xsl:choose>
                                        </xsl:element>
                                    </xsl:if>
                                </xsl:for-each>
                            </xsl:element>
                        </xsl:element>
                    </xsl:for-each>
                </xsl:element>
            </xsl:element>

        </xsl:element>
    </xsl:template>

</xsl:stylesheet>