Вывод групп свойств с хотя бы одним заполненным свойством

#
Вывод групп свойств с хотя бы одним заполненным свойством
Собственно вопрос скорее по xslt. Задача такая, у товара свойства сгруппированы и нужно выводить только те группы свойств, где есть хотя бы одно заполненное свойство. Сейчас выводятся все подряд (http://iei.ru/shop/group_594/group_607/item_2519/ группа потребление).
В шаблоне есть вот такая строка
xsl:if test="count(/shop/item/property[@dir_id = $dir_id])"

я так понимаю ее нужно модифицировать каким-то образом, пробовала просто в count поставить проверку, но выдает ошибку, а делала я так
xsl:if test="count(/shop/item/property[@dir_id = $dir_id]/value != '')"
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
Неужели у вас нет каких-то решений?
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
Давайте начнем с того, что по указанной вами ссылке я не вижу не так - никаких пустых групп я там не наблюдаю.

Дайте ссылку на страницу с ошибкой, выложите xsl-шаблон и генерируемый для него xml от этой страницы.

Ну или с доступами постучитсь в аську.
Заказов не беру. Консультирую редко.
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
Ну как это нет. Я говорю про группы свойств а там один за другим идет 2 заголовка
Потребление
Условия эксплуатации
В Потреблении дальше ничего нет, а в Условиях эксплуатации дальше идут свойства. Нужно, чтобы Потребление не выводилось.
Шаблон самый что ни на есть стандартный, весь это слишком много и к делу отношения не имеет, вот куски
Это вызов свойств
<!-- Выбираем список групп свойств -->
<xsl:apply-templates select="/shop/properties_items_dir"/>

Вывод раздела для свойств
   <!-- Вывод раздела для свойств товара -->
   <xsl:template match="properties_items_dir">
      
      <xsl:variable name="dir_id" select="@id"/>
      
      <xsl:if test="count(/shop/item/property[@dir_id = $dir_id]/value) and $dir_id!=73">
         <!-- Название группы свойств -->
      <p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>
         <table border="0" width="100%" cellpadding="5" cellspasing="0">
            <xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id]"/>
         </table>
      </xsl:if>
      
      <xsl:if test="count(properties_items_dir) > 0">
         <blockquote>
            <xsl:apply-templates select="properties_items_dir"/>
         </blockquote>
      </xsl:if>
   </xsl:template>

xml опять таки самый стандартный, в след сообщении приведу его.
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
xml не могу опубликовать, наверно слишком большой. сейчас попробую подсократить немного
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
<?xml version="1.0" encoding="UTF-8"?>
<shop id="1" current_group_id="607">
   <user_id>0</user_id>
   <name>Каталог товаров</name>
   <description></description>
   <path>/shop/</path>
   <site_id>1</site_id>
   <shop_image_small_max_width>100</shop_image_small_max_width>
   <shop_image_big_max_width>800</shop_image_big_max_width>
   <shop_image_small_max_height>100</shop_image_small_max_height>
   <shop_image_big_max_height>800</shop_image_big_max_height>
   <structure_id>42</structure_id>
   <shop_country_id>175</shop_country_id>
   <shop_currency id="1">
      <shop_currency_name>руб.</shop_currency_name>
      <shop_currency_international_name>RUB</shop_currency_international_name>
      <shop_currency_value_in_basic_currency>1.000000</shop_currency_value_in_basic_currency>
      <shop_currency_is_default>1</shop_currency_is_default>
   </shop_currency>
   <all_currency>
      <shop_currency id="1">
         <shop_currency_name>руб.</shop_currency_name>
         <shop_currency_international_name>RUB</shop_currency_international_name>
         <shop_currency_value_in_basic_currency>1.000000</shop_currency_value_in_basic_currency>
         <shop_currency_is_default>1</shop_currency_is_default>
         <shop_currency_coefficient>1</shop_currency_coefficient>
      </shop_currency>
      <shop_currency id="2">
         <shop_currency_name>&amp;euro;</shop_currency_name>
         <shop_currency_international_name>EUR</shop_currency_international_name>
         <shop_currency_value_in_basic_currency>39.934700</shop_currency_value_in_basic_currency>
         <shop_currency_is_default>0</shop_currency_is_default>
         <shop_currency_coefficient>0.0250408792354</shop_currency_coefficient>
      </shop_currency>
      <shop_currency id="3">
         <shop_currency_name>$</shop_currency_name>
         <shop_currency_international_name>USD</shop_currency_international_name>
         <shop_currency_value_in_basic_currency>28.664000</shop_currency_value_in_basic_currency>
         <shop_currency_is_default>0</shop_currency_is_default>
         <shop_currency_coefficient>0.0348869662294</shop_currency_coefficient>
      </shop_currency>
   </all_currency>
   <shop_order_status id="0">
   </shop_order_status>
   <shop_mesures id="29">
      <shop_mesures_name>г</shop_mesures_name>
      <shop_mesures_description>грамм</shop_mesures_description>
   </shop_mesures>
   <shop_shops_send_order_mail_admin>1</shop_shops_send_order_mail_admin>
   <shop_shops_send_order_mail_user>1</shop_shops_send_order_mail_user>
   <shop_shops_admin_mail>diana@nnz.ru</shop_shops_admin_mail>
   <shop_list_of_prices>
      <shop_list_of_price id="1" name="Дилер (золотой)">
         <site_users_group id="8">Дилеры</site_users_group>
         <percent>65</percent>
      </shop_list_of_price>
      <shop_list_of_price id="2" name="Дилер (серебряный)">
         <site_users_group id="8">Дилеры</site_users_group>
         <percent>80</percent>
      </shop_list_of_price>
      <shop_list_of_price id="3" name="Дилер (яхонтовый)">
         <site_users_group id="8">Дилеры</site_users_group>
         <percent>95</percent>
      </shop_list_of_price>
   </shop_list_of_prices>
   <warehouses>
      <warehouse id="1">
         <shop_warehouse_name>Основной</shop_warehouse_name>
         <shop_warehouse_activity>1</shop_warehouse_activity>
         <shop_warehouse_address></shop_warehouse_address>
         <shop_warehouse_order>0</shop_warehouse_order>
         <shop_warehouse_default>1</shop_warehouse_default>
      </warehouse>
   </warehouses>
   <properties_items_dir id="15" parent_id="0">
      <shop_shops_id>1</shop_shops_id>
      <shop_properties_items_dir_name>Потребление</shop_properties_items_dir_name>
      <shop_properties_items_dir_description></shop_properties_items_dir_description>
      <shop_properties_items_dir_order>0</shop_properties_items_dir_order>
   </properties_items_dir>
   <properties_items_dir id="16" parent_id="0">
      <shop_shops_id>1</shop_shops_id>
      <shop_properties_items_dir_name>Шины расширения</shop_properties_items_dir_name>
      <shop_properties_items_dir_description></shop_properties_items_dir_description>
      <shop_properties_items_dir_order>0</shop_properties_items_dir_order>
   </properties_items_dir>
   <properties_items_dir id="17" parent_id="0">
      <shop_shops_id>1</shop_shops_id>
      <shop_properties_items_dir_name>Условия эксплуатации</shop_properties_items_dir_name>
      <shop_properties_items_dir_description></shop_properties_items_dir_description>
      <shop_properties_items_dir_order>0</shop_properties_items_dir_order>
   </properties_items_dir>
   <sallers>
   </sallers>
   <properties_for_group>
      <property id="221" parent_id="15" xml_name="config_test">
         <name>Тестовая конфигурация</name>
         <property_name>Тестовая конфигурация</property_name>
         <shop_list_of_properties_type>0</shop_list_of_properties_type>
         <shop_list_of_properties_description></shop_list_of_properties_description>
         <property_show_kind>0</property_show_kind>
      </property>
      <property id="222" parent_id="15" xml_name="5v">
         <name>5 В</name>
         <property_name>5 В</property_name>
         <shop_list_of_properties_type>0</shop_list_of_properties_type>
         <shop_list_of_properties_description></shop_list_of_properties_description>
         <property_show_kind>0</property_show_kind>
      </property>
      <property id="223" parent_id="15" xml_name="12v">
         <name>12 В</name>
         <property_name>12 В</property_name>
         <shop_list_of_properties_type>0</shop_list_of_properties_type>
         <shop_list_of_properties_description></shop_list_of_properties_description>
         <property_show_kind>0</property_show_kind>
      </property>
      <property id="224" parent_id="15" xml_name="5v_sb">
         <name>5 В SB</name>
         <property_name>5 В SB</property_name>
         <shop_list_of_properties_type>0</shop_list_of_properties_type>
         <shop_list_of_properties_description></shop_list_of_properties_description>
         <property_show_kind>0</property_show_kind>
      </property>
      <property id="225" parent_id="15" xml_name="33v">
         <name>3.3 В</name>
         <property_name>3.3 В</property_name>
         <shop_list_of_properties_type>0</shop_list_of_properties_type>
         <shop_list_of_properties_description></shop_list_of_properties_description>
         <property_show_kind>0</property_show_kind>
      </property>
      <property id="226" parent_id="15" xml_name="-12v">
         <name>-12 B</name>
         <property_name>-12 B</property_name>
         <shop_list_of_properties_type>0</shop_list_of_properties_type>
         <shop_list_of_properties_description></shop_list_of_properties_description>
         <property_show_kind>0</property_show_kind>
      </property>
   </properties_for_group>
   <item id="2519" group="607">
      <captcha_key>23107</captcha_key>
      <name>PCIE-G41A2</name>
      <show_count>39</show_count>
      <saller>0</saller>
      <marking_of_goods>6038912</marking_of_goods>
      <description>Полноразмерная плата формата PICMG 1.3 с двумя GbE, 4 x SATA II ( RAID 0, 1, 5, 10 ), 8 x USB 2.0 и 8-битным цифровым входом/выходом.</description>
      <date>30.03.2011</date>
      <datetime>30.03.2011 01:48:56</datetime>
      <time>01:48:56</time>
      <putoff_date>00.00.0000 00:00:00</putoff_date>
      <putend_date>00.00.0000 00:00:00</putend_date>
      <text></text>
      <type>0</type>

      <weight>0</weight>
      <weight_mesure>г</weight_mesure>
      <rest>0.00</rest>
      <mesure></mesure>
      <shop_tax_id>0</shop_tax_id>
      <price>0.00</price>
      <price_tax>0.00</price_tax>
      <price_discount>0.00</price_discount>
      <item_currency>руб.</item_currency>
      <currency>руб.</currency>
      <is_active>1</is_active>
      <order>0</order>
      <path>item_2519</path>
      <fullpath>group_594/group_607/</fullpath>
      <seo_title>PCIE-G41A2</seo_title>
      <seo_description></seo_description>
      <seo_keywords></seo_keywords>
      <indexation>1</indexation>
      <vendorCode></vendorCode>
      <shop_items_cml_id>8C90A66F-CFA0-64E9-4DCF-D7E872856084</shop_items_cml_id>
      <user_id>0</user_id>
      <site_users_id>0</site_users_id>
      <property id="220" dir_id="14" xml_name="voltage">
         <name>Требуемые напряжения</name>
         <xml_name>voltage</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>5 В, 12 В, 3.3 В</value>
      </property>
      <property id="225" dir_id="15" xml_name="33v">
         <name>3.3 В</name>
         <xml_name>33v</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="238" dir_id="17" xml_name="temperat">
         <name>Температура эксплуатации</name>
         <xml_name>temperat</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>-10°C ~+60°C</value>
      </property>
      <property id="239" dir_id="17" xml_name="humidity">
         <name>Влажность</name>
         <xml_name>humidity</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>5% ~ 95% (без конденсата)</value>
      </property>
      <property id="240" dir_id="18" xml_name="width_height">
         <name>Размер (Ш x В)</name>
         <xml_name>width_height</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>338 x 126 мм</value>
      </property>
      <property id="241" dir_id="18" xml_name="weight">
         <name>Вес (брутто / нетто)</name>
         <xml_name>weight</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>1.1 кг (брутто)</value>
      </property>
      <property id="252" dir_id="20" xml_name="rohs">
         <name>RoHS</name>
         <xml_name>rohs</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>Да</value>
      </property>
      <property id="253" dir_id="20" xml_name="ros_test">
         <name>РосТест</name>
         <xml_name>ros_test</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>Да</value>
      </property>
      <property id="218" dir_id="14" xml_name="powers">
         <name>Поддерживаемые блоки питания</name>
         <xml_name>powers</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>ATX</value>
      </property>
      <property id="223" dir_id="15" xml_name="12v">
         <name>12 В</name>
         <xml_name>12v</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="222" dir_id="15" xml_name="5v">
         <name>5 В</name>
         <xml_name>5v</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="193" dir_id="8" xml_name="mouse_keypad">
         <name>Клавиатура / Мышь</name>
         <xml_name>mouse_keypad</xml_name>
         <type>2</type>
         <order>0</order>
         <prefics></prefics>
         <value>1 x KB/MS ( 6-конт. штыревой разъем )</value>
      </property>
      <property id="516" dir_id="73" xml_name="image1">
         <name>Изображение 1</name>
         <xml_name>image1</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value>/upload/shop_1/nnz_img/1871188/1276242258.jpg</value>
      </property>
      <property id="521" dir_id="73" xml_name="link">
         <name>Ссылка на товар</name>
         <xml_name>link</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value>http://www.nnz-ipc.ru/good/show/607/1871188/</value>
      </property>
      <property id="166" dir_id="0" xml_name="soft">
         <name>Программное обеспечение</name>
         <xml_name>soft</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="167" dir_id="0" xml_name="docs">
         <name>Документация</name>
         <xml_name>docs</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="224" dir_id="15" xml_name="5v_sb">
         <name>5 В SB</name>
         <xml_name>5v_sb</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="226" dir_id="15" xml_name="-12v">
         <name>-12 B</name>
         <xml_name>-12v</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="254" dir_id="20" xml_name="sea_reg">
         <name>Морской Регистр</name>
         <xml_name>sea_reg</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <property id="255" dir_id="20" xml_name="explosiveness">
         <name>Взрывобезопасность</name>
         <xml_name>explosiveness</xml_name>
         <type>0</type>
         <order>0</order>
         <prefics></prefics>
         <value></value>
      </property>
      <shop_special_prices>
      </shop_special_prices>
      <warehouses>
         <warehouse id="1">0.00</warehouse>
      </warehouses>
   </item>
</shop>
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
nnz-ipc, в вашем случае надо вот так:
<!-- Вывод раздела для свойств товара -->
   <xsl:template match="properties_items_dir">
      <xsl:variable name="dir_id" select="@id"/>
      <xsl:if test="count(/shop/item/property[@dir_id = $dir_id and value != ''])">
         <!-- Название группы свойств -->
         <p>
            <b>
               <xsl:value-of select="shop_properties_items_dir_name"/>
            </b>
         </p>
         <table border="0">
            <xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id and value != '']"/>
         </table>
      </xsl:if>
      <xsl:if test="count(properties_items_dir) &gt; 0">
         <blockquote>
            <xsl:apply-templates select="properties_items_dir"/>
         </blockquote>
      </xsl:if>
   </xsl:template>
Заказов не беру. Консультирую редко.
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
Большое спасибо! Все заработало.
#
Re: Вывод групп свойств с хотя бы одним заполненным свойством
Пожалуйста!
Заказов не беру. Консультирую редко.
Авторизация