enable displaying a subset of countries, firstly all EEA countries

This commit is contained in:
2020-07-23 14:47:08 +02:00
parent 803e73921f
commit 21ac449844
7 changed files with 237 additions and 208 deletions
+27 -10
View File
@@ -6,6 +6,7 @@
<xsl:template name="country-list">
<xsl:param name="required" select="'no'" />
<xsl:param name="class" select="''" />
<xsl:param name="subset" select="''" />
<xsl:element name="select">
<xsl:attribute name="id">country</xsl:attribute>
<xsl:attribute name="name">country</xsl:attribute>
@@ -24,18 +25,34 @@
</xsl:when>
</xsl:choose>
<!-- loop over all countries in countries.**.xml -->
<xsl:for-each select="/buildinfo/document/set/country">
<xsl:sort select="." lang="en" />
<!-- will output: <option value="ZZ">Fooland</option> -->
<xsl:element name="option">
<xsl:attribute name="value">
<xsl:value-of select="@id" />|<xsl:value-of select="." />
</xsl:attribute>
<xsl:value-of select="." />
</xsl:element> <!-- /option -->
</xsl:for-each>
<xsl:choose>
<!-- if subset is defined, only display those that have as attribute: $subset="yes" -->
<xsl:when test="$subset != ''">
<xsl:for-each select="/buildinfo/document/set/country[@*[name() = $subset] = 'yes']">
<xsl:sort select="." lang="en" />
<xsl:call-template name="country-list-options" />
</xsl:for-each>
</xsl:when>
<!-- otherwise, just display all countries -->
<xsl:otherwise>
<xsl:for-each select="/buildinfo/document/set/country">
<xsl:sort select="." lang="en" />
<xsl:call-template name="country-list-options" />
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:element> <!-- /select -->
</xsl:template>
<xsl:template name="country-list-options">
<!-- will output: <option value="ZZ">Fooland</option> -->
<xsl:element name="option">
<xsl:attribute name="value">
<xsl:value-of select="@id" />|<xsl:value-of select="." />
</xsl:attribute>
<xsl:value-of select="." />
</xsl:element> <!-- /option -->
</xsl:template>
</xsl:stylesheet>