我有兩個單獨的代碼片段,我試圖結合。如何顯示「新數量」的子頁面Umbraco XSLT
第一計數子頁面的數量,並顯示一個數字:
例如8子頁面(或子頁面,如果只有1頁)
<xsl:choose>
<xsl:when test="count(child::DocTypeAlias) > 1">
<p><xsl:value-of select="count(child::DocTypeAlias)"/> child pages</p>
</xsl:when>
<xsl:otherwise>
<p><xsl:value-of select="count(child::DocTypeAlias)"/> child page</p>
</xsl:otherwise>
如果頁面是在過去30天內創建的代碼檢測:
<xsl:variable name="datediff" select="umbraco.library:DateDiff(umbraco.library:ShortDate(umbraco.library:CurrentDate()), umbraco.library:ShortDate(@createDate), 'm')" />
<xsl:if test="$datediff < (1440 * 30)">
<p>New</p>
</xsl:if>
我希望將它們組合所以我可以得到一些子頁面和一些「新」頁面。
例如8個頁面 - 2個新頁面
我試過以下,但它不返回正確的值:
<xsl:variable name="datediff" select="umbraco.library:DateDiff(umbraco.library:ShortDate(umbraco.library:CurrentDate()), umbraco.library:ShortDate(@createDate), 'm')" />
<xsl:choose>
<xsl:when test="$datediff < (1440 * 30) and count(child::DocTypeAlias) > 1">
<p><xsl:value-of select="$datediff < (1440 * 30) and count(child::DocTypeAlias)"/> new pages</p>
</xsl:when>
<xsl:otherwise>
<p><xsl:value-of select="$datediff < (1440 * 30) and count(child::DocTypeAlias)"/> new page</p>
</xsl:otherwise>
</xsl:choose>
它返回:「真正的新頁面」我不知道怎麼弄它顯示數字(2個新頁面)。
任何人都可以幫忙嗎?歡呼聲中,JV