对于每个循环的新闻项目节点,我都有一个值。在其他属性中,这些新闻项目具有创建日期的两个属性。系统添加日期和用户输入创建日期(覆盖系统日期)。我希望根据用户输入日期的偏好,按创建日期排序。XSLT如果第一个为空,则对第二个值应用排序
下面是我谦虚无效的尝试!
<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"/>
非常感谢
umbraco ftw。我有很多戏剧在xslt中进行条件排序。 – ChadT 2009-11-09 09:02:35