對於每個循環的新聞項目節點,我都有一個值。在其他屬性中,這些新聞項目具有創建日期的兩個屬性。系統添加日期和用戶輸入創建日期(覆蓋系統日期)。我希望根據用戶輸入日期的偏好,按創建日期排序。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