xsl-list
[Top] [All Lists]

[xsl] Sorting, but then splitting into 5 <ul> columns

2008-08-06 06:36:23
I have figured out how to sort based on an attribute value.

But so far I can only get 1 UL list, and I really need to use the
columnCount variable to make 5 <UL> lists, that we will then float left.

Is there a way to do this possibly by using the results of the first
category template and processing it in a new template?

    <xsl:param name="paraCatagory"/>
    <xsl:param name="altRowBGColor"/>

    <xsl:template match="menu">
        <xsl:apply-templates
select="descendant::category[(_at_)name=$paraCatagory]"/>
    </xsl:template>

    <xsl:template match="category">
        <xsl:variable name="modelCount" select="count(category)"/>
        <xsl:variable name="columnCount" select="round($modelCount div
5) +1"/>
        <ul>
            <xsl:for-each select="child::category">
                <xsl:sort data-type="text" order="ascending"
select="@display_name"/>
                <xsl:choose>
                    <xsl:when test="position() mod 2 = 0">
                        <li
style="background-color:{$altRowBGColor};"><!-- Set this color in
includes/code/category_vb.asp -->
                            <a href="{descendant::link}">
                                <xsl:value-of select="@display_name"/>
                            </a>
                        </li>
                    </xsl:when>
                    <xsl:otherwise>
                        <li>
                            <a href="{descendant::link}">
                                <xsl:value-of select="@display_name"/>
                            </a>
                        </li>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
        </ul>
    </xsl:template>
</xsl:stylesheet>


Thank you,
Dan

~~~~~~~~~~~~~~~~~~
Dan Acuff
Developer
SureSource, Inc.
203.922.7546
dacuff(_at_)suresource(_dot_)com
~~~~~~~~~~~~~~~~~~


--~------------------------------------------------------------------
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>
--~--