我有两个单独的代码片段,我试图结合。如何显示“新数量”的子页面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