[xsl] repeatedly calling a template triggered by data within a parameter

Subject: [xsl] repeatedly calling a template triggered by data within a parameter
From: Mark Wilson <mark@xxxxxxxxxxxx>
Date: Wed, 27 Feb 2013 22:07:09 -0700
Hello,
I want to write a template that would, for each letter in some specified alphabet, call the following template to create a cell for an HTML table in the output document. Is there a way to set up something that would select each letter from an alphabet stored in a stylesheet parameter and call the 'keyboard' template? Since various alphabets have differing lengths and content, I was thinking of perhaps a string as the parameter. It would be very helpful to be able to trigger the template in groups of six to accommodate the <tr> elements.


I looked at XPath 'for' but could not see a means of triggering the 'keyboard' template.

Thanks,
Mark

<xsl:template name="keyboard">
<xsl:param name="letter"/>
<xsl:param name="this-page-name"/>
<xsl:choose>
<xsl:when test="not($this-page-name eq $letter)">
<xsl:variable name="file-name" select="concat(lower-case($letter),'.htm')"/>
<td>
<a href="{$file-name}">
<xsl:value-of select="$letter"/>
</a>
</td>
</xsl:when>
<xsl:otherwise>
<td class="current">
<xsl:value-of select="$letter"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


--
Mark Wilson
Knihtisk Publishing

Current Thread