I tried to use the built in xslt template/macro for displaying the most recent pages in the node, but nothing is showing up. I added the macro with the numberOfItems parameter, but nothing doing. The code (straight from the umbraco built in template, I have changed nothing):
<!-- Don't change this but create a 'number' element in your --> <!-- macro with the alias of 'numberOfItems' --> <xsl:variable name="numberOfItems" select="/macro/numberOfItems"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']"> <xsl:sort select="@updateDate" order="descending"/> <xsl:if test="position() <= $numberOfItems"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:if> </xsl:for-each> </ul>
</xsl:template>
</xsl:stylesheet>
When I dropped the macro onto the page, I specified the number "3", which I assume means it should display the 3 most recent pages in the node? Maybe it's getting messed up because the child pages are all a different document type than the page where the macro is? Sorry, I really can't get the hang of xslt, I don't know what my block is about it..
I don't know what was wrong but it definitely was something to do with the parameter. Once I removed it, it worked like a charm. Thanks again for your help.
Xslt template listing descendant nodes by date?
Hi, complete xslt newcomer here.
I tried to use the built in xslt template/macro for displaying the most recent pages in the node, but nothing is showing up. I added the macro with the numberOfItems parameter, but nothing doing. The code (straight from the umbraco built in template, I have changed nothing):
When I dropped the macro onto the page, I specified the number "3", which I assume means it should display the 3 most recent pages in the node? Maybe it's getting messed up because the child pages are all a different document type than the page where the macro is? Sorry, I really can't get the hang of xslt, I don't know what my block is about it..
Have you checked child pages have 'umbracoNaviHide' property set to false?
Also make it sure that you have created a parameter ''numberOfItems' (integer type) in macro definition (developer section).
Where would I check this? The pages are published, but have role-based permissions (the entire node and child has the same permission)..
Have you created parameter 'numberOfItems in macro (umbraco developer section)?
I did create the numberOfItems parameter in the macro..
Does it work without macro parameter? xslt looks ok
I removed the macro parameter but it still doesn't work. The output is an empty <ul>
Thanks Masood, You figured it out. It was the parameter, like you thought. I removed it from the macro and the xslt file and now it works.
Hi Laura,
I have tested your macro and it works fine. Not sure what is the issue, may be permissions?
I don't know what was wrong but it definitely was something to do with the parameter. Once I removed it, it worked like a charm. Thanks again for your help.
is working on a reply...