Добрый день.
Может кто-нибудь подскажет, как ограничить вывод дополнительных свойств у элемента информационной системы по типам. Например, по типам:
● строка (type = 1)
● целое число (type = 0)
● число с плавающей точкой (type = 11)
Чтобы эти доп. свойства выводились, а остальные – нет!
Сейчас код XSL-шаблона такой:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:hostcms="http://www.hostcms.ru/" exclude-result-prefixes="hostcms">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml" />
<xsl:template match="/"><xsl:apply-templates select="/informationsystem/informationsystem_item" /></xsl:template>
<xsl:template match="/informationsystem/informationsystem_item">
<xsl:variable name="link_path" select="/informationsystem/url" />
<xsl:variable name="prev_item" select="/informationsystem/neighboring_items/prev_item" />
<xsl:variable name="next_item" select="/informationsystem/neighboring_items/next_item" />
<xsl:variable name="prev_item_name" select="/informationsystem/neighboring_items/prev_item_name" />
<xsl:variable name="next_item_name" select="/informationsystem/neighboring_items/next_item_name" />
<!-- Б Л О К - окружающие элементы - Предыдущий-Следующий -->
<nav><ul class="pagination">
<xsl:choose>
<xsl:when test="$prev_item != ''"><li class="w-50 page-item text-right"><a class="page-link" href="{$link_path}{$prev_item}/">
<i class="fa fa-lg fa-arrow-circle-left mx-2" aria-hidden="true"></i><xsl:value-of select="$prev_item_name" /></a></li></xsl:when>
<xsl:otherwise><li class="w-50 page-item text-right disabled"><span class="page-link"><i class="fa fa-lg fa-arrow-circle-left mx-2" aria-hidden="true"></i>Начало</span></li></xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$next_item != ''"><li class="w-50 page-item"><a class="page-link" href="{$link_path}{$next_item}/">
<xsl:value-of select="$next_item_name" /><i class="fa fa-lg fa-arrow-circle-right mx-2" aria-hidden="true"></i></a></li></xsl:when>
<xsl:otherwise><li class="w-50 page-item disabled"><span class="page-link">Конец<i class="fa fa-lg fa-arrow-circle-right mx-2" aria-hidden="true"></i></span></li></xsl:otherwise>
</xsl:choose>
</ul></nav>
<h1 class="h2"><xsl:value-of select="name" /></h1>
<xsl:if test="text != ''"><xsl:value-of disable-output-escaping="yes" select="text" /></xsl:if>
<h5 class="font-narrow">Галерея</h5>
<div class="row">
<xsl:if test="count(property_value[tag_name!='foto']) > 0">
<xsl:apply-templates select="property_value[file_small/node()]" mode="foto" />
</xsl:if>
</div>
<h5 class="font-narrow">Механические свойства и характеристики древесины <sup>(при сухой древесине – влажность 12%)</sup></h5>
<table class="table table-sm w-100"><tbody>
<xsl:apply-templates select="/informationsystem/informationsystem_item_properties//property" />
</tbody></table>
</xsl:template>
<!-- Вывод фото из дополнительных свойств -->
<xsl:template match="property_value" mode="foto">
<xsl:variable name="property_id" select="property_id" />
<xsl:variable name="property" select="/informationsystem/informationsystem_item_properties//property[@id=$property_id]" />
<xsl:if test="value/node() and value != '' or file/node() and file != ''">
<figure class="col-6 col-sm-4 col-lg-3 col-xl-2">
<a rel="tag" href="{../dir}{file}">
<img class="img-thumbnail" src="{../dir}{file_small}" alt="{file_description}" /></a>
<figcaption><xsl:value-of select="file_description" /></figcaption></figure>
</xsl:if>
</xsl:template>
<xsl:template match="property">
<xsl:variable name="property_id" select="@id" />
<xsl:if test="/informationsystem/informationsystem_item/property_value[property_id = $property_id]/value/node() and
/informationsystem/informationsystem_item/property_value[property_id = $property_id]/value != '' or
/informationsystem/informationsystem_item/property_value[property_id = $property_id]/type != 2">
<tr>
<td class="text-right w-50"><xsl:value-of select="name" /><xsl:text> –</xsl:text></td>
<td class="w-50"><xsl:apply-templates select="/informationsystem/informationsystem_item/property_value[property_id = $property_id]" />
<xsl:value-of select="value" disable-output-escaping="yes" /><xsl:text> </xsl:text>
<xsl:value-of select="description" />
</td>
</tr>
</xsl:if>
</xsl:template>
<xsl:template match="/informationsystem/informationsystem_item/property_value">
<xsl:variable name="property_id" select="property_id" />
<xsl:variable name="property" select="/informationsystem/informationsystem_item_properties//property[@id=$property_id]" />
<xsl:value-of disable-output-escaping="yes" select="value" />
</xsl:template>
</xsl:stylesheet>
Вот как сейчас выводится (последняя строчка в табл. "
Механические свойства и характеристики древесины " не нужная):
https://www.mebelib.ru/wood-tree/avodire/