<xsl:if test="count(shop_item) > 0 or /shop/filter = 1">
<!-- дополнение пути для action, если выбрана метка -->
<xsl:variable name="form_tag_url"><xsl:if test="count(tag) = 1">tag/<xsl:value-of select="tag/urlencode"/>/</xsl:if></xsl:variable>
<xsl:variable name="path"><xsl:choose>
<xsl:when test="/shop//shop_group[@id=$group]/node()"><xsl:value-of select="/shop//shop_group[@id=$group]/url"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/url"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<form method="get" action="{$path}{$form_tag_url}">
<div class="shop_filter">
<div class="sorting">
<select name="sorting" onchange="$(this).parents('form:first').submit()">
<option disabled="disabled">Сортировать</option>
<option value="1">
<xsl:if test="/shop/sorting = 1"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
По цене (сначала дешевые)
</option>
<option value="2">
<xsl:if test="/shop/sorting = 2"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
По цене (сначала дорогие)
</option>
<option value="3">
<xsl:if test="/shop/sorting = 3"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
По названию
</option>
</select>
</div>
<div class="priceFilter">
<xsl:text>ЦЕНА ОТ: </xsl:text>
<input name="price_from" size="5" type="text" style="width: 60px;">
<xsl:if test="/shop/price_from != 0">
<xsl:attribute name="value"><xsl:value-of select="/shop/price_from"/></xsl:attribute>
</xsl:if>
</input>
<xsl:text> ДО: </xsl:text>
<input name="price_to" size="5" type="text" style="width: 60px;">
<xsl:if test="/shop/price_to != 0">
<xsl:attribute name="value"><xsl:value-of select="/shop/price_to"/></xsl:attribute>
</xsl:if>
</input>
</div>
<!-- Фильтр по дополнительным свойствам товара: -->
<xsl:if test="count(shop_item_properties//property[filter != 0 and (type = 0 or type = 1 or type = 3 or type = 7)]) > 0 and count(shop_item_properties//property[filter != 0 and (type = 0 or type = 1 or type = 3 or type = 7)])">
<span class="table_row"></span>
<xsl:apply-templates select="shop_item_properties//property[filter != 0 and (type = 0 or type = 1 or type = 3 or type = 7)]" mode="propertyList"/>
</xsl:if>
<input name="filter" class="button" value="ПРИМЕНИТЬ" type="submit"/>
<div style="margin-top: 16px;">
<!-- Если есть доступные производители -->
<xsl:if test="count(producers/shop_producer) > 0">
ФИЛЬТР ПО ПРОИЗВОДИТЕЛЯМ: 
<select onchange="$(this).parents('form:first').submit()" name="producer_id">
<option value="0">…</option>
<xsl:apply-templates select="producers/shop_producer"/>
</select> 
</xsl:if>
</div>
</div>
<!-- Таблица с элементами для сравнения -->
<xsl:if test="count(/shop/compare_items/compare_item) > 0">
<table cellpadding="5px" cellspacing="0" border="0">
<tr>
<td>
<input type="checkbox" onclick="SelectAllItemsByPrefix(this.checked, 'del_compare_id_')" />
</td>
<td>
<b>Сравниваемые элементы</b>
</td>
</tr>
<xsl:apply-templates select="compare_items/compare_item"/>
</table>
<!-- <div class="nofloat" style="height: 47px; padding: 5px 0;">
<div class="gray_button left">
<div>
<input name="apply_compare" value="Сравнить" type="button" onclick="javascript:location='{/shop/url}compare_items/';"/>
</div>
</div>
<div class="gray_button right">
<div>
<input name="delete_compare" value="Удалить" type="submit"/>
</div>
</div>
</div> -->
</xsl:if>
<br />
<br />
<div class="shop_block">
<!-- Выводим товары магазина -->
<xsl:apply-templates select="shop_item" />
</div>
<div class="clearing"></div>
<p class="button" id="compareButton">
<xsl:if test="count(/shop/comparing/shop_item) = 0">
<xsl:attribute name="style">display: none</xsl:attribute>
</xsl:if>
<a href="{/shop/url}compare_items/">Сравнить товары</a>
</p>
<xsl:if test="total > 0 and limit > 0">
<xsl:variable name="count_pages" select="ceiling(total div limit)"/>
<xsl:variable name="visible_pages" select="5"/>
<xsl:variable name="real_visible_pages"><xsl:choose>
<xsl:when test="$count_pages < $visible_pages"><xsl:value-of select="$count_pages"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$visible_pages"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Считаем количество выводимых ссылок перед текущим элементом -->
<xsl:variable name="pre_count_page"><xsl:choose>
<xsl:when test="page - (floor($real_visible_pages div 2)) < 0">
<xsl:value-of select="page"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - ($count_pages - page - 1) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($real_visible_pages div 2) = $real_visible_pages div 2">
<xsl:value-of select="floor($real_visible_pages div 2) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="floor($real_visible_pages div 2)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Считаем количество выводимых ссылок после текущего элемента -->
<xsl:variable name="post_count_page"><xsl:choose>
<xsl:when test="0 > page - (floor($real_visible_pages div 2) - 1)">
<xsl:value-of select="$real_visible_pages - page - 1"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:variable name="i"><xsl:choose>
<xsl:when test="page + 1 = $count_pages"><xsl:value-of select="page - $real_visible_pages + 1"/></xsl:when>
<xsl:when test="page - $pre_count_page > 0"><xsl:value-of select="page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<p>
<xsl:call-template name="for">
<xsl:with-param name="limit" select="limit"/>
<xsl:with-param name="page" select="page"/>
<xsl:with-param name="items_count" select="total"/>
<xsl:with-param name="i" select="$i"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="visible_pages" select="$real_visible_pages"/>
</xsl:call-template>
</p>
<div style="clear: both"></div>
</xsl:if>
</form>
</xsl:if>
Вот эта проверка?