Created
July 30, 2014 13:36
-
-
Save greystate/69639edd5107cbbe43c6 to your computer and use it in GitHub Desktop.
Using with-param with apply-templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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