1
Шаблоны XSLT / Re:Модуль новостей xslt
« : 24 Октября 2013, 15:14:52 »
Сделал так
главный шаблон default.xsl
файл news.xml
Так выводит и все вроде бы работет, но так ли нужно похорошему делать?
В default.xsl, используется конструкцию <xsl:if (нельзя ли здесь применить
//так не работет
И в news.xml, можно ли улучшить?
главный шаблон default.xsl
Код: [Выделить]
<div class="mydiv">
<xsl:value-of select="//property[and @type='wysiwyg']/value" disable-output-escaping="yes" />
<xsl:if test="/result/@pageId='11'">
<p>Текст </p>
<xsl:apply-templates select="document('udata://news/lastlist/(/namePageAllNews/)/')//item"/>
</xsl:if>
файл news.xml
Код: [Выделить]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:umi="http://www.umi-cms.ru/TR/umi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="item">
<xsl:value-of select="document(concat('upage://',@id))/udata/page/properties/group/property[@name='anons']/value" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
В default.xsl, используется конструкцию <xsl:if (нельзя ли здесь применить
Код: [Выделить]
<xsl:template match
//так не работет
Код: [Выделить]
<xsl:template match="result[@pageId='11]" > //в этой строке [quote]compilation error[/quote]
<h2>Новости</h2>
<xsl:apply-templates select="document('udata://news/lastlist/(/namePageAllNews/)/')//item"/>
</xsl:template> -->
И в news.xml, можно ли улучшить?