Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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: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" />
How can I do it dynamic?
Thanks,
kukuwka
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
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
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.