I have the code below. I would the for-each to stop running after the if-sentenses have returned true and executed the code block 4 times. As i have no idea when the code block has been executed 4 times i can't use position() which was my first idea.
Any help would be greatly appreciated.
<xsl:for-each select="$itm//item[@template='news item']">
<xsl:sort select="sc:fld('start date',.)" data-type="text" order="descending"/>
<xsl:if test="sc:formatdate($date,'yyyyMMddHHmm') > sc:formatdate(sc:fld('start date',.),'yyyyMMddHHmm')">
<xsl:if test="sc:formatdate($date,'yyyyMMddHHmm') < sc:formatdate(sc:fld('end date',.),'yyyyMMddHHmm')">
<!--EXECUTE A CODE BLOCK-->
</xsl:if>
</xsl:if>
</xsl:for-each>