Skip to content

Instantly share code, notes, and snippets.

@nathanhornby
Forked from greystate/airports.xslt
Created July 30, 2014 13:42
Show Gist options
  • Save nathanhornby/bc2f2832aa715d538990 to your computer and use it in GitHub Desktop.
Save nathanhornby/bc2f2832aa715d538990 to your computer and use it in GitHub Desktop.
<!-- Start -->
<xsl:apply-templates select="airports/airport">
<xsl:with-param name="position" select="'start'" />
</xsl:apply-templates>
<!-- End -->
<xsl:apply-templates select="airports/airport">
<xsl:with-param name="position" select="'end'" />
</xsl:apply-templates>
<xsl:template match="airports/airport">
<xsl:param name="position" />
<option value="{@iata}" data-alternative-spellings="{.},{@iata}">
<xsl:if test="(@iata = 'LGW' and $position = 'start') or (@iata = 'LAX' and $position = 'end')">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:value-of select="@iata"/> - <xsl:value-of select="." />
</option>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment