<!-- +
| Template for results sort
+ -->
<xsl:template name="sorts">
<xsl:if test="count(/search/form/sorts/sort) > 0">
<div class="ametys-results-sort-wrapper float-right">
<span class="ametys-results-sort__title"><i18n:text i18n:key="PLUGINS_WEB_SERVICE_SEARCH_VIEW_SORT_BY" i18n:catalogue="plugin.web"/></span>
<xsl:call-template name="sorts-list"/>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="sorts-list">
<select class="ametys-results-sort__control" name="sort">
<xsl:attribute name="onchange">eval("function a(){" + this.options[this.selectedIndex].getAttribute('onselect') + "}"); try { a.call(this); } catch(e) { }; return true;</xsl:attribute>
<xsl:for-each select="/search/form/sorts/sort">
<option value="{@name}">
<xsl:attribute name="onselect"><xsl:call-template name="search-js-sort"/></xsl:attribute>
<xsl:call-template name="sort-element-selected-or-not"/>
</option>
</xsl:for-each>
</select>
<xsl:for-each select="/search/form/sorts/sort[@selected]">
<xsl:call-template name="sort-hidden-input-for-selected"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="sort-element-selected-or-not">
<xsl:if test="@selected"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
<xsl:value-of select="label"/>
</xsl:template>
Sample code.
Please note all the hacks required! (current sort, eval in js!)