> I would like to create a loop which iterates through each letter of
> the (English) alphabet.
>
> This approach prints each letter of the alphabet:
>
> <xsl:variable name="letters"
> select="'a','b','c','d','e','f','g','h','i','j','k','l','m','n
> ','o','p','q','r','s','t','u','v','w','x','y','z'"/>
> <xsl:for-each select="1 to 26">
> <xsl:variable name="idx" select="."/>
> <xsl:value-of select="$letters[$idx]"/> </xsl:for-each>
>
> On the other hand, this approach prints the entire alphabet 26 times:
>
> <xsl:variable name="letters"
> select="'a','b','c','d','e','f','g','h','i','j','k','l','m','n
> ','o','p','q','r','s','t','u','v','w','x','y','z'"/>
> <xsl:for-each select="1 to 26">
> <xsl:value-of select="$letters[.]"/> </xsl:for-each>
>
> I am baffled. Both versions are indexing the $letters sequence
> variable with the (integer) loop iteration value, right?
A predicate changes the context. Inside a predicate [], "." refers to the
item in the sequence being tested.