I have a for each which loops round news item nodes. Among other properties these news items have two attributes for created date. System added date and a user entered created date (to override the system date). I would like the list sorted by created date with the preference on the user entered date.
Below is my humble invalid attempt!
<xsl:for-each select="$currentPage/ancestor-or-self::node /node [@nodeTypeAlias = $documentTypeAlias and string(data [@alias='umbracoNaviHide']) != '1']">
<xsl:choose>
<xsl:when test="data [@alias = 'createdDate'] != ''">
<xsl:variable name="sort" select="string(data [@alias = 'createdDate'])"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="sort" select="string(@createDate)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:sort select="$sort" order="descending"/>
Many thanks