Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • kukuwka 75 posts 96 karma points
    Oct 13, 2010 @ 09:39
    kukuwka
    0

    How to make dynamic sort

    Hi,

    I want to make dynamic sort.

    I get sort from  query string:

    <xsl:variable name="sort" select="umbraco.library:RequestQueryString('sort')"/>

     

    <xsl:param name="sortBy">

    <xsl:choose>
          <xsl:when test="$sort = 'createDate'">

                  <xsl:value-of select="@createDate" />

        </xsl:when>

        <xsl:when test="$sort = 'name'">

                  <xsl:value-of select="   ./data [@alias = 'title']" />

        </xsl:when>

    </xsl:choose>

    </xsl:param>

     

    This code works:

    <xsl:for-each select="umbraco.library:Split($Items, ',')/value">
             <xsl:sort select="umbraco.library:GetXmlNodeById(.)/@createDate" />

    </xsl:for-each>

    But I need something like:

    <xsl:for-each select="umbraco.library:Split($Items, ',')/value">
           <xsl:variable name="item"  select="umbraco.library:GetXmlNodeById(.)" />

           <xsl:sort select="$item/$sort" />

    </xsl:for-each>

    How can I do it dynamic?

    Thanks,

    kukuwka

Please Sign in or register to post replies

Write your reply to:

Draft