I'm not sure why you'd want this as umbraco greys out all unpublished nodes anyway... so, where should that message go? Bit more info on what you're trying to do may be helpful here.
I have this Client who wants us to display a message or even display an image if ever all the nodes are unpublished or if the folder is empty. We can do this in CSS but i was wondering how this can be achieve with XSLT.
Even more confused? you're talking about unpublished nodes and xslt in one sentence? It's just not clear to me what you're trying to do? Have an example or pic which could say more than 1000 words could ever do?
hmmmm....i have News Folder under which i can react news items and using XSLT to display the items. Now what i was wondering is, is there a way of displaying a message when all the nodes under the News Folder are unpublished or empty.
if you're using xslt, you're actually working with published content, so you can't know whether all nodes are unpublished, that info is just not available unless you start querying the site using the document api (which is not recommended). However, you can check whether a news folder has 0 zero nodes using the count() function.
So the best way for me to achieve this is by using Css instead....the count will not be good if the nodes are unpublished.....i will only get the right figure if the news folder is empty.
Unpublish Nodes
Is there a way of displaying a message when all nodes are unpublished in a folder??
//fuji
I'm not sure why you'd want this as umbraco greys out all unpublished nodes anyway... so, where should that message go? Bit more info on what you're trying to do may be helpful here.
Cheers,
/Dirk
Hi Dirk,
I have this Client who wants us to display a message or even display an image if ever all the nodes are unpublished or if the folder is empty. We can do this in CSS but i was wondering how this can be achieve with XSLT.
Thanks
//Fuji
Even more confused? you're talking about unpublished nodes and xslt in one sentence? It's just not clear to me what you're trying to do? Have an example or pic which could say more than 1000 words could ever do?
Cheers,
/Dirk
hmmmm....i have News Folder under which i can react news items and using XSLT to display the items. Now what i was wondering is, is there a way of displaying a message when all the nodes under the News Folder are unpublished or empty.
if you're using xslt, you're actually working with published content, so you can't know whether all nodes are unpublished, that info is just not available unless you start querying the site using the document api (which is not recommended). However, you can check whether a news folder has 0 zero nodes using the count() function.
Cheers,
/Dirk
Thanks Dirk,
So the best way for me to achieve this is by using Css instead....the count will not be good if the nodes are unpublished.....i will only get the right figure if the news folder is empty.
//fuji
Hey Fuji - can't you just do a count() in your XSLT and test for it being 0? Unpublished nodes will never be in the XML cache as Dirk said
<xsl:if test="count($currentPage/NewsFolder/NewsItem) = 0">
There are no news items
</xsl:if>
is working on a reply...