xsl-list
[Top] [All Lists]

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

2013-02-27 23:07:29
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>