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 have a Ultimate Picker Listbox called subtopics and I need to be able to sort the values ascending. Here is my code:
<xsl:template name="column"> <xsl:param name="start"/> <xsl:param name="end"/> <xsl:variable name="i" select="0"/> <ul> <xsl:for-each select="$currentPage/ancestor-or-self::root//node [@nodeTypeAlias='SpeakersByTopicListPage']/node"> <xsl:sort select="@nodeName" order="ascending"/> <xsl:variable name="subtopicsList" select="data[@alias = 'Subtopics']"/> <xsl:if test="$i >= $start and $i <= $end and normalize-space($subtopicsList) != ''"> <xsl:variable name="parentName"> <xsl:choose> <xsl:when test="string(data[@alias = 'TopicName']) = ''"> <xsl:if test="@template != 5187"> <xsl:value-of select="@nodeName"/> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="@template != 5187"> <xsl:value-of select="data[@alias = 'TopicName']"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$parentName != ''"> <li> <a class="parent" href="{umbraco.library:NiceUrl(@id)}/"> <xsl:value-of select="$parentName"/> </a> </li> </xsl:if> <xsl:variable name="subtopics" select="umbraco.library:Split($subtopicsList,',')"/> <xsl:for-each select="$subtopics/value"> <xsl:sort select="$subtopics/value" order="ascending"/> <xsl:variable name="subtopic" select="umbraco.library:GetXmlNodeById(.)"/> <xsl:variable name="name"> <xsl:choose> <xsl:when test="string($subtopic/data[@alias = 'TopicName']) = ''"> <xsl:value-of select="$subtopic/@nodeName"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$subtopic/data[@alias = 'TopicName']"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$subtopic/data[@alias = 'MoreSports'] = 0"> <li> <a href="{umbraco.library:NiceUrl($subtopic/@id)}/"> <xsl:value-of select="$name"/> </a> </li> </xsl:if> </xsl:for-each> </xsl:if> </xsl:for-each> </ul> </xsl:template>
The code
<xsl:sort select="$subtopics/value" order="ascending"/>
is not working. Any help would be greatly appreciated thanks.
Gerald
Figured it out. It was sorting by the Node ID's and thats why it was not working. Here is the correct code:
<xsl:sort select="umbraco.library:GetXmlNodeById(.)/data[@alias = 'TopicName']" order="ascending" />
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Sorting Ultimate Picker Listbox data
Hi,
I have a Ultimate Picker Listbox called subtopics and I need to be able to sort the values ascending. Here is my code:
The code
is not working. Any help would be greatly appreciated thanks.
Gerald
Figured it out. It was sorting by the Node ID's and thats why it was not working. Here is the correct code:
is working on a reply...