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
Hello
I sort my XSLT with
<xsl:sort select="./data [@alias = 'prize']" data-type="text" order="ascending" />
but i will that the user can choose the sort with
<select>
<option>...</option>
</select>
or something like that with these options
<xsl:sort select="./data [@alias = 'prize']" data-type="text" order="descending" />
<xsl:sort select="@nodeName" data-type="text" order="ascending" />
<xsl:sort select="umbraco.library:FormatDateTime(./data [@alias = 'date'], 'dd.MM.yyyy')" order="ascending" />
is that possible?
Best Regards
I have a solution, but it will not work perfectly
I get the sort by url parameters, for example:
http://yourdomain.com/categories/phones/xyz.aspx?sortby=[@alias = 'prize']&datatype=number&sortorder=ascending
http://yourdomain.com/categories/phones/xyz.aspx?sortby=@nodeName&datatype=number&sortorder=ascending
In the XSLT:
<xsl:param name="SortBy"> <xsl:choose> <xsl:when test="umbraco.library:RequestQueryString('sortby') != ''"> <xsl:value-of select="umbraco.library:RequestQueryString('sortby')" /> </xsl:when> <xsl:otherwise> <xsl:text>@sortOrder</xsl:text> </xsl:otherwise> </xsl:choose></xsl:param>
<xsl:variable name="DataType"> <xsl:choose> <xsl:when test="umbraco.library:RequestQueryString('datatype') != ''"> <xsl:value-of select="umbraco.library:RequestQueryString('datatype')" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="'text'" /> </xsl:otherwise> </xsl:choose></xsl:variable>
...
I will try to get [@alias = 'prize'] for <xsl:sort select="[@alias = 'prize']" ... /> with
<xsl:sort select="$SortBy" order="{$SortOrder}" data-type="{$DataType}"/>
but this doesn't work! Only
<xsl:sort select="data[@alias = $SortBy]" order="{$SortOrder}" data-type="{$DataType}"/>
works for me, but here is the $SortBy prize or date but I need @nodeName, prize and date!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
XSLT Sort With DropDownList (<select>)?
Hello
I sort my XSLT with
but i will that the user can choose the sort with
or something like that with these options
is that possible?
Best Regards
I have a solution, but it will not work perfectly
I get the sort by url parameters, for example:
In the XSLT:
I will try to get [@alias = 'prize'] for <xsl:sort select="[@alias = 'prize']" ... /> with
but this doesn't work! Only
works for me, but here is the $SortBy prize or date but I need @nodeName, prize and date!
is working on a reply...