XSL шаблоны
Как заставить работать данную конструкцию в данной ситуации:
<xsl:variable name="background_color">
<xsl:choose>
<xsl:when test="(position() + 1) mod 2 > 0">#333333</xsl:when> <xsl:otherwise>#ffffff</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<table border="0" width="100%">
<xsl:if test="producer/name != ''">
<tr style="background-color: {$background_color};"><td><strong>Производитель: </strong></td><td width="60%"><xsl:value-of disable-output-escaping="yes" select="producer/name"/></td></tr>
</xsl:if>
<xsl:if test="marking_of_goods != ''">
<tr style="background-color: {$background_color};"><td><strong>Артикул: </strong></td><td><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></td></tr>
</xsl:if>
<!-- Показываем скидки
<xsl:if test="count(discount) > 0">
<xsl:apply-templates select="discount"/>
</xsl:if> -->
<!-- Показываем количество на складе, если больше нуля -->
<xsl:if test="rest > 0">
<tr style="background-color: {$background_color};"><td><strong>В наличии: </strong></td><td><xsl:value-of disable-output-escaping="yes" select="rest"/> <xsl:value-of disable-output-escaping="yes" select="mesure"/></td></tr>
</xsl:if>
<xsl:if test="count(//property) > 0">
<!-- Свойства в корневой группе -->
<xsl:if test="count(property[@dir_id = 9])">
<xsl:apply-templates select="property[@dir_id = 9]"/>
</xsl:if>
<!-- Выбираем список групп свойств
<xsl:apply-templates select="/shop/properties_items_dir"/>-->
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<tr style="background-color: {$background_color};"><td><strong>Вес товара: </strong></td><td><xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></td></tr>
</xsl:if>
</table>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<xsl:if test="value != '' or (type = 1 and file_path != '')">
<tr>
<td>
<b><xsl:value-of select="name"/></b>
</td>
<td>
<xsl:choose>
<xsl:when test="type = 1">
<a href="{file_path}">Скачать файл</a>
</xsl:when>
<xsl:when test="type = 7">
<xsl:choose>
<xsl:when test="value = 1">
<input type="checkbox" checked="" disabled="" />
</xsl:when>
<xsl:otherwise>
<input type="checkbox" disabled="" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:if>
</xsl:template>
2. Как вставить значение доп свойства в данную конструкцию вместо 9:
<!-- Свойства в корневой группе -->
<xsl:if test="count(property[@dir_id = 9])">
<xsl:apply-templates select="property[@dir_id = 9]"/>
</xsl:if>
<xsl:variable name="background_color">
<xsl:choose>
<xsl:when test="(position() + 1) mod 2 > 0">#333333</xsl:when> <xsl:otherwise>#ffffff</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<table border="0" width="100%">
<xsl:if test="producer/name != ''">
<tr style="background-color: {$background_color};"><td><strong>Производитель: </strong></td><td width="60%"><xsl:value-of disable-output-escaping="yes" select="producer/name"/></td></tr>
</xsl:if>
<xsl:if test="marking_of_goods != ''">
<tr style="background-color: {$background_color};"><td><strong>Артикул: </strong></td><td><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></td></tr>
</xsl:if>
<!-- Показываем скидки
<xsl:if test="count(discount) > 0">
<xsl:apply-templates select="discount"/>
</xsl:if> -->
<!-- Показываем количество на складе, если больше нуля -->
<xsl:if test="rest > 0">
<tr style="background-color: {$background_color};"><td><strong>В наличии: </strong></td><td><xsl:value-of disable-output-escaping="yes" select="rest"/> <xsl:value-of disable-output-escaping="yes" select="mesure"/></td></tr>
</xsl:if>
<xsl:if test="count(//property) > 0">
<!-- Свойства в корневой группе -->
<xsl:if test="count(property[@dir_id = 9])">
<xsl:apply-templates select="property[@dir_id = 9]"/>
</xsl:if>
<!-- Выбираем список групп свойств
<xsl:apply-templates select="/shop/properties_items_dir"/>-->
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<tr style="background-color: {$background_color};"><td><strong>Вес товара: </strong></td><td><xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></td></tr>
</xsl:if>
</table>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<xsl:if test="value != '' or (type = 1 and file_path != '')">
<tr>
<td>
<b><xsl:value-of select="name"/></b>
</td>
<td>
<xsl:choose>
<xsl:when test="type = 1">
<a href="{file_path}">Скачать файл</a>
</xsl:when>
<xsl:when test="type = 7">
<xsl:choose>
<xsl:when test="value = 1">
<input type="checkbox" checked="" disabled="" />
</xsl:when>
<xsl:otherwise>
<input type="checkbox" disabled="" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:if>
</xsl:template>
2. Как вставить значение доп свойства в данную конструкцию вместо 9:
<!-- Свойства в корневой группе -->
<xsl:if test="count(property[@dir_id = 9])">
<xsl:apply-templates select="property[@dir_id = 9]"/>
</xsl:if>
Skype:ferdinant1988 ICQ:311960596 E-mail: ferdinant@i.ua
Авторизация