Created
December 21, 2010 13:18
-
-
Save greystate/749921 to your computer and use it in GitHub Desktop.
Dynamically determining sort order in XSLT (in Umbraco) with QueryString parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<xsl:stylesheet | |
version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:umb="urn:umbraco.library" | |
exclude-result-prefixes="umb" | |
> | |
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /> | |
<xsl:param name="currentPage" /> | |
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::Website" /> | |
<xsl:template match="/"> | |
<xsl:variable name="sortDirection" select="umb:RequestQueryString('dir')" /> | |
<xsl:apply-templates select="$currentPage/Textpage"> | |
<xsl:sort select="@createDate[$sortDirection = 'desc']" data-type="text" order="descending" /> | |
<xsl:sort select="@createDate[$sortDirection = 'asc']" data-type="text" order="ascending" /> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="Textpage"> | |
<xsl:value-of select="@nodeName" /> (<xsl:value-of select="@createDate" />)<xsl:text /> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment