Wednesday, 24 September 2014

xsl compare count of elements to 0



I'm trying to compare the count of an list of elements to 0, this is how I get the elements:



<xsl:variable name="elments" select="/Elements/ElementList[@IstImportant='true']"></xsl:variable>


and this is how I try to compare the count of the elements:



<xsl:choose>
<xsl:when test="count($elments) &gt; 0">
<xsl:attribute name="Num">1500</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="Num">1501</xsl:attribute>
</xsl:otherwise>
</xsl:choose>


But I get allways "1501" as the num attribute, even if the count of elements with IstImportant='true' is greater than 0. What have I done wrong.


No comments:

Post a Comment