mardi 23 décembre 2014

Custom filter and sort using xslt



Is it possible to use a query string to select items from a list and order them?


For instance my page & query string


SortFilter.aspx?selection='i13o1,i5o2,i27o3,'


(i is for Item, O is for Order)


I know how to get the querystring, and create a variable the contains 'o' for each selected item 'i', but can't figure out how to use 'o' for sorting



<xsl:for-each select="/dsQueryResponse/Rows/Row[generate-id(.)=generate-id(key('myKey',@ID))]">


<xsl:variable name="articleNumber">
<xsl:text>i</xsl:text><xsl:value-of select="@ID" /><xsl:text>o</xsl:text>
</xsl:variable>

<xsl:variable name="elementLookUp" select= 'substring-before(substring-after($string, $articleNumber), ",")'/>

<xsl:if test="$elementLookUp">

<p><b><xsl:value-of select="@ID" /></b><xsl:text>&#160;</xsl:text><xsl:value-of select="@Title" /><xsl:text>&#160;</xsl:text> <xsl:value-of select="$elementLookUp"/></p>

</xsl:if>


</xsl:for-each>







0 commentaires:

Enregistrer un commentaire