<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml" />

<xsl:template match="/">
    <xsl:apply-templates select="/document/item"/>
</xsl:template> 

<xsl:template match="/document/item">

<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/document/information_system/parent_group_id"/>

<h1><xsl:value-of disable-output-escaping="yes" select="item_name"/></h1>

<!-- ============= -->
<!-- Путь к группе -->
<!-- ============= -->
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>

<!-- Код ссылки -->
<p><xsl:value-of disable-output-escaping="yes" select="item_propertys/item_property/html_code" /></p>

<!-- Текст элемента информационного блока -->
<p><xsl:value-of disable-output-escaping="yes" select="item_text"/></p>

</xsl:template>

<!-- ======================================================== -->
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<!-- ======================================================== -->

<xsl:template match="group" mode="goup_path">
	<xsl:variable name="parent_id" select="@parent_id"/>

	<!-- Выбираем рекурсивно вышестоящую группу -->
	<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path" />

	<xsl:if test="@parent_id=0">
		<a href="{/document/information_system/url}"><xsl:value-of disable-output-escaping="yes" select="/document/information_system/name"/></a>
	</xsl:if>
	<img src="/images/arrow_path.gif" class="arrow_path"/>
	<a href="{/document/information_system/url}{fullpath}"><xsl:value-of disable-output-escaping="yes" select="name"/></a>
</xsl:template>

</xsl:stylesheet>