Суть в том что, я пытаюсь посредством xslt шаблона в ИС выводить список товаров в обрамление
<div class="catalog_list"></div>
по условию, если в текущей группе есть товары, то к выводу добавляем дивы. Но что то идёт не так и условие не срабатывает

Выводит в группе где нет товаров, и в группе где есть товары.
Вариант 1
<!-- Отображение записи информационной системы -->
<xsl:variable name="div_open">
<xsl:choose>
<xsl:when test="count(.//informationsystem_group[@id=$group]/items_count) = 0"></xsl:when>
<xsl:otherwise><div class="catalog_list"></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of disable-output-escaping="yes" select="$div_open"/>
<xsl:apply-templates select="informationsystem_item[active=1]"/>
<xsl:variable name="div_close">
<xsl:choose>
<xsl:when test="count(.//informationsystem_group[@id=$group]/items_count) = 0"></xsl:when>
<xsl:otherwise></div></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of disable-output-escaping="yes" select="$div_close"/>
Вариант 2
<!-- Отображение записи информационной системы -->
<xsl:variable name="div_open">
<div class="catalog_list">
</xsl:variable>
<xsl:if test="count(.//informationsystem_group[@id=$group]/items_count) != 0">
<xsl:value-of disable-output-escaping="yes" select="$div_open"/>
</xsl:if>
<xsl:apply-templates select="informationsystem_item[active=1]"/>
<xsl:variable name="div_close">
</div>
</xsl:variable>
<xsl:if test="count(.//informationsystem_group[@id=$group]/items_count) != 0">
<xsl:value-of disable-output-escaping="yes" select="$div_close"/>
</xsl:if>