5. Публикация новостей
Для публикации новостей на сайте необходимо выполнить несколько этапов.
Создание информационной системы
Первоначально создадим информационную систему. Назовём её "Новости". В разделе Контент → Информационные системы выберите пункт меню Информационная система → Добавить и заполните форму
Обратите внимание, что после выполнения пункта 2 вам нужно будет вернуться к информационной системе и в списке "Узел структуры" выбрать узел который будет создан в пункте 2.
Создание узла структуры
В левом меню выберите раздел Структура сайта → Структура сайта. После перехода в список узлов структуры сайта в меню Раздел выбираете пункт Добавить.
XSL-шаблоны
В данном примере у узла выбраны уже предустановленные в системе XSL-шаблоны.Вы можете также использовать их, либо написать свою реализацию. Примеры основы XSL-шаблонов списка новостей и самой новости:
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="https://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"/>
</xsl:template>
<xsl:variable name="n" select="number(3)"/>
<xsl:template match="/informationsystem">
<!-- Store parent id in a variable -->
<xsl:variable name="group" select="group"/>
<xsl:choose>
<xsl:when test="$group = 0">
<div class="page-title category-title">
<h1 hostcms:id="{@id}" hostcms:field="name" hostcms:entity="informationsystem">
<i class="fa fa-newspaper-o"></i><xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
</div>
</xsl:when>
<xsl:otherwise>
<!-- Breadcrumbs -->
<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
<xsl:apply-templates select=".//informationsystem_group[@id=$group]" mode="breadCrumbs"/>
</div>
</xsl:otherwise>
</xsl:choose>
<!-- Show informationsystem_item -->
<xsl:if test="informationsystem_item">
<dl class="news_list">
<div class="row">
<xsl:apply-templates select="informationsystem_item"/>
</div>
</dl>
</xsl:if>
<!-- Pagination -->
<xsl:if test="ОтображатьСсылкиНаСледующиеСтраницы=1">
<div>
<xsl:if test="total > 0 and limit > 0">
<xsl:variable name="count_pages" select="ceiling(total div limit)"/>
<xsl:variable name="visible_pages" select="5"/>
<xsl:variable name="real_visible_pages"><xsl:choose>
<xsl:when test="$count_pages < $visible_pages"><xsl:value-of select="$count_pages"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$visible_pages"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Links before current -->
<xsl:variable name="pre_count_page"><xsl:choose>
<xsl:when test="page - (floor($real_visible_pages div 2)) < 0">
<xsl:value-of select="page"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - ($count_pages - page - 1) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($real_visible_pages div 2) = $real_visible_pages div 2">
<xsl:value-of select="floor($real_visible_pages div 2) - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="floor($real_visible_pages div 2)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Links after current -->
<xsl:variable name="post_count_page"><xsl:choose>
<xsl:when test="0 > page - (floor($real_visible_pages div 2) - 1)">
<xsl:value-of select="$real_visible_pages - page - 1"/>
</xsl:when>
<xsl:when test="($count_pages - page - 1) < floor($real_visible_pages div 2)">
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:variable name="i"><xsl:choose>
<xsl:when test="page + 1 = $count_pages"><xsl:value-of select="page - $real_visible_pages + 1"/></xsl:when>
<xsl:when test="page - $pre_count_page > 0"><xsl:value-of select="page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<nav>
<ul class="pagination">
<xsl:call-template name="for">
<xsl:with-param name="limit" select="limit"/>
<xsl:with-param name="page" select="page"/>
<xsl:with-param name="items_count" select="total"/>
<xsl:with-param name="i" select="$i"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="visible_pages" select="$real_visible_pages"/>
</xsl:call-template>
</ul>
</nav>
</xsl:if>
</div>
</xsl:if>
<div style="clear: both"></div>
</xsl:template>
<!-- Breadcrumb -->
<xsl:template match="informationsystem_group" mode="breadCrumbs">
<xsl:variable name="parent_id" select="parent_id"/>
<xsl:apply-templates select="//informationsystem_group[@id=$parent_id]" mode="breadCrumbs"/>
<xsl:if test="parent_id=0">
<span typeof="v:Breadcrumb">
<a title="{/informationsystem/name}" href="{/informationsystem/url}" hostcms:id="{/informationsystem/@id}" hostcms:field="name" hostcms:entity="informationsystem" class="root" property="v:title" rel="v:url">
<xsl:value-of disable-output-escaping="yes" select="/informationsystem/name"/>
</a>
</span>
</xsl:if>
<i class="fa fa-angle-right"></i>
<span typeof="v:Breadcrumb">
<a title="{name}" href="{url}" hostcms:id="{@id}" hostcms:field="name" hostcms:entity="informationsystem_group" property="v:title" rel="v:url">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</span>
</xsl:template>
<!-- informationsystem_item template -->
<xsl:template match="informationsystem_item">
<div class="col-12 col-md-12 col-lg-12">
<div class="thumbnail">
<!-- Text representation of a date -->
<div class="box clearfix">
<div>
<strong>
<xsl:value-of select="substring-before(date, '.')"/>
</strong>
<xsl:variable name="month_year" select="substring-after(date, '.')"/>
<xsl:variable name="month" select="substring-before($month_year, '.')"/>
<span>
<xsl:choose>
<xsl:when test="$month = 1"> января </xsl:when>
<xsl:when test="$month = 2"> февраля </xsl:when>
<xsl:when test="$month = 3"> марта </xsl:when>
<xsl:when test="$month = 4"> апреля </xsl:when>
<xsl:when test="$month = 5"> мая </xsl:when>
<xsl:when test="$month = 6"> июня </xsl:when>
<xsl:when test="$month = 7"> июля </xsl:when>
<xsl:when test="$month = 8"> августа </xsl:when>
<xsl:when test="$month = 9"> сентября </xsl:when>
<xsl:when test="$month = 10"> октября </xsl:when>
<xsl:when test="$month = 11"> ноября </xsl:when>
<xsl:otherwise> декабря </xsl:otherwise>
</xsl:choose>
</span>
<!-- <span><xsl:value-of select="substring-after($month_year, '.')"/><xsl:text> г.</xsl:text></span>-->
</div>
<hr/>
<a href="{url}" hostcms:id="{@id}" hostcms:field="name" hostcms:entity="informationsystem_item">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</div>
<div class="caption">
<p><xsl:value-of disable-output-escaping="yes" select="description"/></p>
<xsl:if test="count(tag) > 0 or count(comment) > 0 or count(siteuser) > 0">
<p class="item-comment is-list">
<xsl:if test="count(tag)">
<span><i class="fa fa-tags"></i><xsl:apply-templates select="tag"/></span>
</xsl:if>
<!-- Review was added an authorized user -->
<xsl:if test="count(siteuser) > 0">
<span><i class="fa fa-user"></i><a href="/users/info/{siteuser/login}/"><xsl:value-of select="siteuser/login"/></a></span>
</xsl:if>
<xsl:if test="count(comment)">
<span><i class="fa fa-comments"></i><a href="{url}#comments"><xsl:value-of select="comments_count"/><xsl:text> </xsl:text><xsl:call-template name="declension"> <xsl:with-param name="number" select="comments_count"/></xsl:call-template></a></span>
</xsl:if>
</p>
</xsl:if>
</div>
</div>
</div>
</xsl:template>
<!-- Pagination -->
<xsl:template name="for">
<xsl:param name="limit"/>
<xsl:param name="page"/>
<xsl:param name="pre_count_page"/>
<xsl:param name="post_count_page"/>
<xsl:param name="i" select="0"/>
<xsl:param name="items_count"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="ceiling($items_count div $limit)"/>
<xsl:variable name="start_page"><xsl:choose>
<xsl:when test="$page + 1 = $n"><xsl:value-of select="$page - $visible_pages + 1"/></xsl:when>
<xsl:when test="$page - $pre_count_page > 0"><xsl:value-of select="$page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:if test="$i = $start_page and $page != 0">
<li>
<span aria-hidden="true"><i class="fa fa-angle-double-left"></i></span>
</li>
</xsl:if>
<xsl:if test="$i = ($page + $post_count_page + 1) and $n != ($page+1)">
<li>
<span aria-hidden="true"><i class="fa fa-angle-double-right"></i></span>
</li>
</xsl:if>
<xsl:if test="$items_count > $limit and ($page + $post_count_page + 1) > $i">
<!-- Store in the variable $group ID of the current group -->
<xsl:variable name="group" select="/informationsystem/group"/>
<!-- Tag Path -->
<xsl:variable name="tag_path">
<xsl:choose>
<xsl:when test="count(/informationsystem/tag)">tag/<xsl:value-of select="/informationsystem/tag/urlencode"/>/</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Choose Group Path -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- If the group is not root -->
<xsl:when test="$group != 0">
<xsl:value-of select="/informationsystem//informationsystem_group[@id=$group]/url"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="/informationsystem/url"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Set $link variable -->
<xsl:variable name="number_link">
<xsl:choose>
<xsl:when test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- First pagination item -->
<xsl:if test="$page - $pre_count_page > 0 and $i = $start_page">
<li>
<a href="{$group_link}{$tag_path}" class="page_link" style="text-decoration: none;">←</a>
</li>
</xsl:if>
<!-- Pagination item -->
<xsl:if test="$i != $page">
<xsl:if test="($page - $pre_count_page) <= $i and $i < $n">
<li>
<!-- Pagination item -->
<a href="{$group_link}{$number_link}{$tag_path}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</li>
</xsl:if>
<!-- Last pagination item -->
<xsl:if test="$i+1 >= ($page + $post_count_page + 1) and $n > ($page + 1 + $post_count_page)">
<li>
<!-- Last pagination item -->
<a href="{$group_link}page-{$n}/{$tag_path}" class="page_link" style="text-decoration: none;">→</a>
</li>
</xsl:if>
</xsl:if>
<!-- Ctrl+left link -->
<xsl:if test="$page != 0 and $i = $page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<xsl:when test="$page > 1">page-<xsl:value-of select="$i"/>/</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{$group_link}{$prev_number_link}{$tag_path}" id="id_prev"></a>
</xsl:if>
<!-- Ctrl+right link -->
<xsl:if test="($n - 1) > $page and $i = $page">
<a href="{$group_link}page-{$page+2}/{$tag_path}" id="id_next"></a>
</xsl:if>
<!-- Current pagination item -->
<xsl:if test="$i = $page">
<span class="current">
<xsl:value-of select="$i+1"/>
</span>
</xsl:if>
<!-- Recursive Template -->
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="limit" select="$limit"/>
<xsl:with-param name="page" select="$page"/>
<xsl:with-param name="items_count" select="$items_count"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="visible_pages" select="$visible_pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Declension of the numerals -->
<xsl:template name="declension">
<xsl:param name="number" select="number"/>
<!-- Nominative case / Именительный падеж -->
<xsl:variable name="nominative">
<xsl:text>комментарий</xsl:text>
</xsl:variable>
<!-- Genitive singular / Родительный падеж, единственное число -->
<xsl:variable name="genitive_singular">
<xsl:text>комментария</xsl:text>
</xsl:variable>
<xsl:variable name="genitive_plural">
<xsl:text>комментариев</xsl:text>
</xsl:variable>
<xsl:variable name="last_digit">
<xsl:value-of select="$number mod 10"/>
</xsl:variable>
<xsl:variable name="last_two_digits">
<xsl:value-of select="$number mod 100"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$last_digit = 1 and $last_two_digits != 11">
<xsl:value-of select="$nominative"/>
</xsl:when>
<xsl:when test="$last_digit = 2 and $last_two_digits != 12
or $last_digit = 3 and $last_two_digits != 13
or $last_digit = 4 and $last_two_digits != 14">
<xsl:value-of select="$genitive_singular"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$genitive_plural"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
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="https://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="/">
<div class="row">
<xsl:apply-templates select="/informationsystem/informationsystem_item"/>
</div>
</xsl:template>
<xsl:template match="/informationsystem/informationsystem_item">
<!-- Store parent id in a variable -->
<xsl:variable name="group" select="informationsystem_group_id"/>
<!-- Breadcrumbs -->
<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
<xsl:if test="$group = 0">
<span typeof="v:Breadcrumb">
<a title="{/informationsystem/name}" href="{/informationsystem/url}" property="v:title" rel="v:url">
<xsl:value-of disable-output-escaping="yes" select="/informationsystem/name"/>
</a>
</span>
</xsl:if>
<xsl:apply-templates select="//informationsystem_group[@id=$group]" mode="breadCrumbs"/>
<i class="fa fa-angle-right"></i>
<span typeof="v:Breadcrumb">
<a title="{name}" href="{url}" hostcms:id="{@id}" hostcms:field="name" hostcms:entity="informationsystem_item" property="v:title" rel="v:url">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</span>
</div>
<h1 hostcms:id="{@id}" hostcms:field="name" hostcms:entity="informationsystem_item" class="item_title"><xsl:value-of disable-output-escaping="yes" select="name"/></h1>
<!-- Show Message -->
<xsl:if test="/informationsystem/message/node()">
<xsl:value-of disable-output-escaping="yes" select="/informationsystem/message"/>
</xsl:if>
<div class="col-12 col-sm-6 col-md-8 col-lg-9">
<!-- Text -->
<xsl:choose>
<xsl:when test="parts_count > 1">
<div class="item-text"><xsl:value-of disable-output-escaping="yes" select="text"/></div>
</xsl:when>
<xsl:otherwise>
<div hostcms:id="{@id}" hostcms:field="text" hostcms:entity="informationsystem_item" hostcms:type="wysiwyg" class="item-text">
<xsl:value-of disable-output-escaping="yes" select="text"/>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<!-- Breadcrumb -->
<xsl:template match="informationsystem_group" mode="breadCrumbs">
<xsl:variable name="parent_id" select="parent_id"/>
<!-- Call recursively parent group -->
<xsl:apply-templates select="//informationsystem_group[@id=$parent_id]" mode="breadCrumbs"/>
<xsl:if test="parent_id=0">
<span typeof="v:Breadcrumb">
<a title="{/informationsystem/name}" href="{/informationsystem/url}" class="root" property="v:title" rel="v:url">
<xsl:value-of disable-output-escaping="yes" select="/informationsystem/name"/>
</a>
</span>
</xsl:if>
<i class="fa fa-angle-right"></i>
<span typeof="v:Breadcrumb">
<a title="{name}" href="{url}" property="v:title" rel="v:url">
<xsl:value-of select="name"/>
</a>
</span>
</xsl:template>
<!-- Pagination -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="prefix">page</xsl:param>
<xsl:param name="link"/>
<xsl:param name="limit"/>
<xsl:param name="page"/>
<xsl:param name="items_count"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="$items_count div $limit"/>
<!-- Links before current -->
<xsl:variable name="pre_count_page">
<xsl:choose>
<xsl:when test="$page > ($n - (round($visible_pages div 2) - 1))">
<xsl:value-of select="$visible_pages - ($n - $page)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($visible_pages div 2) - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Links after current -->
<xsl:variable name="post_count_page">
<xsl:choose>
<xsl:when test="0 > $page - (round($visible_pages div 2) - 1)">
<xsl:value-of select="$visible_pages - $page"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
<xsl:value-of select="$visible_pages div 2"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($visible_pages div 2) - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="start_page"><xsl:choose>
<xsl:when test="$page + 1 = $n"><xsl:value-of select="$page - $visible_pages + 1"/></xsl:when>
<xsl:when test="$page - $pre_count_page > 0"><xsl:value-of select="$page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:if test="$i = $start_page and $page != 0">
<li>
<span aria-hidden="true"><i class="fa fa-angle-double-left"></i></span>
</li>
</xsl:if>
<xsl:if test="$i = ($page + $post_count_page + 1) and $n != ($page+1)">
<li>
<span aria-hidden="true"><i class="fa fa-angle-double-right"></i></span>
</li>
</xsl:if>
<!-- Store in the variable $group ID of the current group -->
<xsl:variable name="group" select="/informationsystem/group"/>
<xsl:if test="$items_count > $limit and $n > $i">
<!-- Pagination item -->
<xsl:if test="$i != $page">
<!-- Определяем адрес тэга -->
<xsl:variable name="tag_link">
<xsl:choose>
<xsl:when test="count(/informationsystem/tag)">tag/<xsl:value-of select="/informationsystem/tag/urlencode"/>/</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Set $link variable -->
<xsl:variable name="number_link">
<xsl:choose>
<xsl:when test="$i != 0">
<xsl:value-of select="$prefix"/>-<xsl:value-of select="$i + 1"/>/</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- First pagination item -->
<xsl:if test="$page - $pre_count_page > 0 and $i = 0">
<li>
<a href="{$link}" class="page_link" style="text-decoration: none;">←</a>
</li>
</xsl:if>
<xsl:choose>
<xsl:when test="$i >= ($page - $pre_count_page) and ($page + $post_count_page) >= $i">
<li>
<!-- Pagination item -->
<a href="{$link}{$tag_link}{$number_link}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</li>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<!-- Last pagination item -->
<xsl:if test="$i+1 >= $n and $n > ($page + 1 + $post_count_page)">
<xsl:choose>
<xsl:when test="$n > round($n)">
<li>
<!-- Last pagination item -->
<a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">→</a>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">→</a>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
<!-- Current pagination item -->
<xsl:if test="$i = $page">
<span class="current">
<xsl:value-of select="$i+1"/>
</span>
</xsl:if>
<!-- Recursive Template -->
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="link" select="$link"/>
<xsl:with-param name="limit" select="$limit"/>
<xsl:with-param name="page" select="$page"/>
<xsl:with-param name="items_count" select="$items_count"/>
<xsl:with-param name="visible_pages" select="$visible_pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Declension of the numerals -->
<xsl:template name="declension">
<xsl:param name="number" select="number"/>
<!-- Nominative case / Именительный падеж -->
<xsl:variable name="nominative"><xsl:text>просмотр</xsl:text></xsl:variable>
<!-- Genitive singular / Родительный падеж, единственное число -->
<xsl:variable name="genitive_singular"><xsl:text>просмотра</xsl:text></xsl:variable>
<xsl:variable name="genitive_plural"><xsl:text>просмотров</xsl:text></xsl:variable>
<xsl:variable name="last_digit"><xsl:value-of select="$number mod 10"/></xsl:variable>
<xsl:variable name="last_two_digits"><xsl:value-of select="$number mod 100"/></xsl:variable>
<xsl:choose>
<xsl:when test="$last_digit = 1 and $last_two_digits != 11">
<xsl:value-of select="$nominative"/>
</xsl:when>
<xsl:when test="$last_digit = 2 and $last_two_digits != 12
or $last_digit = 3 and $last_two_digits != 13
or $last_digit = 4 and $last_two_digits != 14">
<xsl:value-of select="$genitive_singular"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$genitive_plural"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>