James H. writes "If you had to programatically output a list of HTML <a> tags linking to anchors for the Alphabet like this:

<a href="#A">A</a> <a href="#B">B</a> ...

"How would you do it? A for loop through the relevant ASCII code numbers so you can use Asc(i) to output the letter or something similar? Oh no, apparently this is the right way:

1) Create an XML file to define the alphabet (calling the root tag "root" and each node "node," since hey, that's what they are after all:


"2) Use XSLT to render the <a> tags (full implementation details omitted for sanity pusposes):

<xsl:for-each select="document($alpha)/root/node">
<xsl:variable name="alpha" select="."/>
<xsl:variable name="found_alpha">
<xsl:for-each select="document($staff)/staff">
<xsl:for-each select="profile">
<xsl:if test="starts-with(surname, $alpha)">
<xsl:if test="$found_alpha = 'true'"><xsl:value-of select="$found_alpha"/></xsl:if>
<xsl:attribute name="href">
                                        <xsl:text>/staff.cfm#</xsl:text><xsl:value-of select="$alpha" />
<xsl:attribute name="title">
<xsl:text>Jump to the listing of staff with surnames beginning with </xsl:text><xsl:value-of select="$alpha" />
<xsl:value-of select="$alpha"/>

"Yes, that's all much simpler than three line for loop."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!