Since I don´t know your XSLT could I will try to help you with some psdo code.
You could make an choose statement in your XSLT file.
If your events are children of your currentpage you could count on them to see if there are any.
You can have so many when tests that you needs <xsl:when test="></xsl:when> but only one otherwise.
<xsl:choose> <xsl:when test="count($currentPage/Events) > 0"> <!-- Do your code for events --> </xsl:when> <xsl:otherwise> No events </xsl:otherwise> </xsl:choose>
If you are working on multilingual sites, you could use a dictionary item for the No events text, by using the Umbraco library extension GetDictionaryItem()
i can't use this, because i have got another check in my loop that if the event is checked for being visible then show it. this check will show there is event eventhough the even it not visible.
I wanted to put a flag but again the variable's value cannot be changes.
When Macro (xslt file) returns null
Hello,
How can i say that if the macro returns nothing show a message. for example if there is no event write there are no events.
is there anything to set for this like how we put useIfEmpty for items?
Thanks,
Mitra
Hi Mitra,
Since I don´t know your XSLT could I will try to help you with some psdo code.
You could make an choose statement in your XSLT file.
If your events are children of your currentpage you could count on them to see if there are any.
You can have so many when tests that you needs <xsl:when test="></xsl:when> but only one otherwise.
If you are working on multilingual sites, you could use a dictionary item for the No events text, by using the Umbraco library extension GetDictionaryItem()
I hope something like this can help you get what you are after.
/Dennis
i can't use this, because i have got another check in my loop that if the event is checked for being visible then show it. this check will show there is event eventhough the even it not visible.
I wanted to put a flag but again the variable's value cannot be changes.
<xsl:for-each select="$eventItems">
<xsl:sort select="uNewsDate" order="descending"/>
<xsl:if test="position() <= $MaxItems">
<xsl:variable name="Visible" select="eventVisible" />
<xsl:if test="$Visible = '1'" >
<ul>
....
</ul>
</xsl:if>
</xsl:if>
</xsl:for-each>
Hi Mitra,
Maybe you could try something like that.
Maybe you don´t need the count.
/Dennis
Sorry Dennis, I just realised that i didn't thank you for your reply.
It was a great trick which i didn't know.
Thanks a lot again
Mitra
That's okay Mitra.
So you did managed to resolve your case with the code I provide to you?
/Dennis
Yes, it worked. thanks again - I'm just about posting another question :P
is working on a reply...