<office code="ВТ">
<lesson no="2" complex="BT">
<?xml-stylesheet type='text/xsl' href='/time.xsl'?>
<timeTable>
<offices>
<office code="КУ">
<name>Курская</name>
<address>Костомаровский пер., дом 3, стр 4, Москва, 105120</address>
</office>
<office code="BT">
<name>ВДНХ Техноград</name>
<address>пр-т Мира, 119 строение 63, Москва, 129223</address>
</office>
</offices>
<lessons>
<lesson no="1" complex="КУ">
<thema>Обзор XML технологий</thema>
<date>2021-01-19</date>
<time>10:00</time>
</lesson>
<lesson no="2" complex="BT">
<thema>Введение в XML</thema>
<date>2021-01-23</date>
<time>17:20</time>
</lesson>
<lesson no="3" complex="BT">
<thema>Правила XML</thema>
<date>2021-01-26</date>
<time>15:30</time>
</lesson>
<lesson no="4" complex="КУ">
<thema>Пространства имён XML</thema>
<date>2021-01-29</date>
<time>10:00</time>
</lesson>
<lesson no="5" complex="BT">
<thema>DTD: Описание структуры документа</thema>
<date>2021-02-03</date>
<time>17:20</time>
</lesson>
<lesson no="6" complex="BT">
<thema>DTD: определение сущностей</thema>
<date>2021-02-08</date>
<time>15:30</time>
</lesson>
<lesson no="7" complex="КУ">
<thema>Введение в XML Схемы</thema>
<date>2021-02-12</date>
<time>10:00</time>
</lesson>
<lesson no="8" complex="BT">
<thema>XML Схема: типы данных</thema>
<date>2021-02-17</date>
<time>17:20</time>
</lesson>
<lesson no="9" complex="BT">
<thema>Атрибуты типов</thema>
<date>2021-02-21</date>
<time>15:30</time>
</lesson>
<lesson no="10" complex="КУ">
<thema>XML Схема: Расширение сложных типов</thema>
<date>2021-02-25</date>
<time>10:00</time>
</lesson>
</lessons>
</timeTable>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="timeTable"/>
</xsl:template>
<xsl:template match="timeTable">
<html>
<head>
<title>page</title>
</head>
<body>
<xsl:apply-templates select="offices"/>
</body>
</html>
</xsl:template>
<xsl:template match="offices">
<div>
<xsl:apply-templates select="office"/>
</div>
</xsl:template>
<xsl:template match="office">
<xsl:variable name="office_code" select="@code"/>
<div>
<xsl:text>Комплекс </xsl:text>
<xsl:value-of select="name"/>
<xsl:text>: всего занятий </xsl:text>
<xsl:value-of select="count(/timeTable/lessons/lesson[@complex = $office_code])"/>
<xsl:text>, занятий в 10:00 </xsl:text>
<xsl:value-of select="count(/timeTable/lessons/lesson[@complex = $office_code and time = '10:00'])"/>
</div>
</xsl:template>
</xsl:stylesheet>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>page</title>
</head>
<body>
<div>
<div>Комплекс Курская: всего занятий 4, занятий в 10:00 4</div>
<div>Комплекс ВДНХ Техноград: всего занятий 6, занятий в 10:00 0</div>
</div>
</body>
</html>
<documentRecipientAddressData>
<street>Centroallee 1000
Einfahrt Parkhaus 7 an der "Alten Waltz" gegenüber Tryp Hotel ...</street>
<street>Centroallee
1000
Einfahrt
Parkhaus 7 an der
"Alten Waltz" gegenüber Tryp Hotel ...</street>
<street>Centroallee 1000 Einfahrt Parkhaus 7 an der "Alten Waltz" gegenüber Tryp Hotel ...</street>
</documentRecipientAddressData>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/documentRecipientAddressData/street">
<xsl:variable name="street">
<xsl:call-template name="replace-line-breaks">
<xsl:with-param name="text">
<xsl:call-template name="normalize-line-breaks">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="normalize-space($street)"/>
<xsl:text>
</xsl:text>
<xsl:variable name="street">
<xsl:call-template name="normalize-line-breaks">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="replace($street, '\n', ', ')"/>
<xsl:text>

</xsl:text>
</xsl:template>
<xsl:template name="replace-line-breaks">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="not(contains($text, '
'))">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($text, '
')"/>
<xsl:text>, </xsl:text>
<xsl:call-template name="replace-line-breaks">
<xsl:with-param name="text" select="substring-after($text, '
')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="normalize-line-breaks">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="not(contains($text, '

'))">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="text">
<xsl:value-of select="substring-before($text, '

')"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="substring-after($text, '

')"/>
</xsl:variable>
<xsl:call-template name="normalize-line-breaks">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Centroallee 1000, Einfahrt Parkhaus 7 an der "Alten Waltz" gegenüber Tryp Hotel ...
Centroallee 1000, Einfahrt Parkhaus 7 an der "Alten Waltz" gegenüber Tryp Hotel ...
Centroallee, 1000, Einfahrt, Parkhaus 7 an der, "Alten Waltz" gegenüber Tryp Hotel ...
Centroallee, 1000, Einfahrt, Parkhaus 7 an der, "Alten Waltz" gegenüber Tryp Hotel ...
Centroallee 1000 Einfahrt Parkhaus 7 an der "Alten Waltz" gegenüber Tryp Hotel ...
Centroallee 1000 Einfahrt Parkhaus 7 an der "Alten Waltz" gegenüber Tryp Hotel ...