lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.0.3 vs lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.0.4

- old
+ new

@@ -55,12 +55,25 @@ <xsl:variable name="table_id" select="@id"/> <recommendation alt-text="{.//ogc:p[@class = 'RecommendationTitle'][1]/text()}"> <xsl:copy-of select="@id"/> <xsl:variable name="title"> <xsl:apply-templates select=".//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node()"/> + <xsl:if test=".//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node()"> + <xsl:text>: </xsl:text> + <xsl:variable name="recommendationLabel"> + <tt><xsl:copy-of select=".//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node()"/></tt> + </xsl:variable> + <xsl:apply-templates select="xalan:nodeset($recommendationLabel)/node()"/> + </xsl:if> </xsl:variable> - <xsl:variable name="bookmark" select="normalize-space(.//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node())"/> + <xsl:variable name="bookmark"> + <xsl:value-of select="normalize-space(.//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node())"/> + <xsl:if test=".//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node()"> + <xsl:text>: </xsl:text> + <xsl:value-of select="normalize-space(.//ogc:p[@class = 'RecommendationLabel'][ancestor::ogc:table[1][@id= $table_id]]/node())"/> + </xsl:if> + </xsl:variable> <xsl:variable name="regex_str" select="'^([^0-9]+) (\d+).*'"/> <xsl:variable name="class" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$1')"/> <xsl:variable name="num" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$2')"/> <xsl:variable name="class_lc" select="java:toLowerCase(java:java.lang.String.new($class))"/> <!-- <xsl:attribute name="class_str"> @@ -100,41 +113,15 @@ </xsl:for-each> </xsl:variable> <xsl:variable name="contents"> <contents> - <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters --> - <!-- <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/*" mode="contents"/> --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keywords']" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'security') and not(@type = 'submitting_orgs') and not(@type = 'keywords')]" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements" mode="contents"/> + <xsl:call-template name="processPrefaceSectionsDefault_Contents"/> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="contents"/> - <!-- Normative references --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="contents"/> - <!-- Terms and definitions --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="contents"/> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="contents"/> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="contents"/> - - <!-- Bibliography --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="contents"/> - - + <xsl:call-template name="processMainSectionsDefault_Contents"/> + <xsl:apply-templates select="//ogc:indexsect" mode="contents"/> </contents> </xsl:variable> <xsl:template match="/"> @@ -234,13 +221,26 @@ </fo:table-row> </fo:table-body> </fo:table> </fo:block> - <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm"> - <fo:block-container width="155mm"> + <!-- <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm"> --> + <fo:block-container absolute-position="fixed" left="16.5mm" top="40mm" height="170mm"> + <fo:block-container width="155mm" height="99%" display-align="center"> <fo:block font-size="33pt" role="H1"> + <xsl:variable name="length_title" select="string-length($doctitle)"/> + <xsl:variable name="fit_font-size"> + <xsl:choose> + <xsl:when test="$length_title &gt; 230">20</xsl:when> + <xsl:when test="$length_title &gt; 170">26</xsl:when> + <xsl:when test="$length_title &gt; 155">28</xsl:when> + <xsl:when test="$length_title &gt; 130">30</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="normalize-space($fit_font-size) != ''"> + <xsl:attribute name="font-size"><xsl:value-of select="$fit_font-size"/>pt</xsl:attribute> + </xsl:if> <xsl:call-template name="addLetterSpacing"> <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctitle))"/> <xsl:with-param name="letter-spacing" select="1.1"/> </xsl:call-template> </fo:block> @@ -440,11 +440,11 @@ <xsl:attribute name="margin-top">14pt</xsl:attribute> </xsl:if> <xsl:if test="@level = 1 or @parent = 'annex'"> <xsl:attribute name="font-size">12pt</xsl:attribute> </xsl:if> - <xsl:if test="@level &gt;= 2 and not(@parent = 'annex')"> + <xsl:if test="@level &gt;= 2"> <!-- and not(@parent = 'annex') --> <xsl:attribute name="font-size">10pt</xsl:attribute> </xsl:if> <xsl:choose> <xsl:when test="@level = 1"> @@ -627,65 +627,54 @@ <fo:block break-after="page"/> <fo:block line-height="125%"> <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'executivesummary']"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'keywords']"/> - <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:foreword"> - <fo:block break-after="page"/> - </xsl:if> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword"/> - <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']"> - <fo:block break-after="page"/> - </xsl:if> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'security']"/> + <xsl:for-each select="/*/*[local-name()='preface']/*"> + <xsl:sort select="@displayorder" data-type="number"/> + + <xsl:if test="local-name() = 'foreword' or (local-name() = 'clause' and @type = 'security') or (local-name() = 'clause' and @type = 'submitting_orgs') or local-name() = 'introduction'"> + <fo:block break-after="page"/> + </xsl:if> + + <xsl:apply-templates select="."/> + </xsl:for-each> - <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']"> - <fo:block break-after="page"/> - </xsl:if> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[@type = 'submitting_orgs']"/> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters"/> - <xsl:if test="/ogc:ogc-standard/ogc:preface/ogc:introduction"> - <fo:block break-after="page"/> - </xsl:if> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction"/> - - - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:clause[not(@type = 'executivesummary') and not(@type = 'security') and not(@type = 'submitting_orgs') and not(@type = 'keywords')]"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:acknowledgements"/> </fo:block> </fo:flow> </fo:page-sequence> <!-- Document Pages --> + <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']"> + <xsl:sort select="@displayorder" data-type="number"/> + <xsl:choose> + <xsl:when test="local-name() = 'clause' and @type='scope'"> + <xsl:apply-templates select="." mode="sections"> + <xsl:with-param name="initial-page-number" select="1"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="." mode="sections"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='scope']" mode="sections"> - <xsl:with-param name="initial-page-number" select="1"/> - </xsl:apply-templates> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@type='conformance']" mode="sections"/> + <xsl:for-each select="/*/*[local-name()='annex']"> + <xsl:sort select="@displayorder" data-type="number"/> + <xsl:apply-templates select="." mode="sections"/> + </xsl:for-each> - <!-- Normative references --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@normative='true']" mode="sections"/> - - <!-- Terms and definitions --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="sections"/> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:definitions" mode="sections"/> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[not(@type='scope') and not(@type='conformance')]" mode="sections"/> - - <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="sections"/> - <!-- Bibliography --> - <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[not(@normative='true')]" mode="sections"/> + <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]"> + <xsl:sort select="@displayorder" data-type="number"/> + <xsl:apply-templates select="." mode="sections"/> + </xsl:for-each> + <xsl:apply-templates select="//ogc:indexsect" mode="sections"/> + <!-- End Document Pages --> </fo:root> </xsl:template> @@ -1057,11 +1046,18 @@ </xsl:template> <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2"> + <xsl:variable name="ul_indent">6mm</xsl:variable> <fo:block-container margin-left="13mm"> + <xsl:if test="self::ogc:ul and not(ancestor::ogc:ul) and not(ancestor::ogc:ol)"> <!-- if first level --> + <xsl:attribute name="margin-left">4mm</xsl:attribute> + </xsl:if> + <xsl:if test="self::ogc:ul and ancestor::*[2][self::ogc:ul]"> <!-- ul/li/ul --> + <xsl:attribute name="margin-left"><xsl:value-of select="$ul_indent"/></xsl:attribute> + </xsl:if> <xsl:if test="ancestor::ogc:table"> <xsl:attribute name="margin-left">4mm</xsl:attribute> </xsl:if> <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol"> <xsl:attribute name="margin-top">10pt</xsl:attribute> @@ -1069,10 +1065,13 @@ <xsl:attribute name="margin-top">1mm</xsl:attribute> </xsl:if> </xsl:if> <fo:block-container margin-left="0mm"> <fo:list-block xsl:use-attribute-sets="list-style"> + <xsl:if test="self::ogc:ul"> + <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$ul_indent"/></xsl:attribute> + </xsl:if> <xsl:if test="ancestor::ogc:table"> <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute> </xsl:if> <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol"> <xsl:attribute name="margin-bottom">0pt</xsl:attribute> @@ -1510,10 +1509,14 @@ <title-edition lang="fr"> <xsl:text>Édition </xsl:text> </title-edition> + <title-edition lang="ru"> + <xsl:text>Издание </xsl:text> + </title-edition> + <!-- These titles of Table of contents renders different than determined in localized-strings --> <title-toc lang="en"> <xsl:text>Contents</xsl:text> @@ -1538,11 +1541,15 @@ </title-part> <title-part lang="fr"> - </title-part> + </title-part> + <title-part lang="ru"> + + + </title-part> <title-part lang="zh">第 # 部分:</title-part> <title-subpart lang="en">Sub-part #</title-subpart> <title-subpart lang="fr">Partie de sub #</title-subpart> @@ -1554,10 +1561,11 @@ <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations> <title-summary lang="en">Summary</title-summary> + <title-continued lang="ru">(продолжение)</title-continued> <title-continued lang="en">(continued)</title-continued> <title-continued lang="fr">(continué)</title-continued> </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata"> <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/> @@ -2381,17 +2389,23 @@ </xsl:attribute-set><xsl:variable name="color-added-text"> <xsl:text>rgb(0, 255, 0)</xsl:text> </xsl:variable><xsl:attribute-set name="add-style"> - <xsl:attribute name="color">red</xsl:attribute> - <xsl:attribute name="text-decoration">underline</xsl:attribute> - <!-- <xsl:attribute name="color">black</xsl:attribute> - <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute> - <xsl:attribute name="padding-top">1mm</xsl:attribute> - <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> --> - </xsl:attribute-set><xsl:variable name="color-deleted-text"> + + <xsl:attribute name="color">red</xsl:attribute> + <xsl:attribute name="text-decoration">underline</xsl:attribute> + <!-- <xsl:attribute name="color">black</xsl:attribute> + <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute> + <xsl:attribute name="padding-top">1mm</xsl:attribute> + <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> --> + + </xsl:attribute-set><xsl:variable name="add-style"> + <add-style xsl:use-attribute-sets="add-style"/> + </xsl:variable><xsl:template name="append_add-style"> + <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/> + </xsl:template><xsl:variable name="color-deleted-text"> <xsl:text>red</xsl:text> </xsl:variable><xsl:attribute-set name="del-style"> <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> <xsl:attribute name="text-decoration">line-through</xsl:attribute> </xsl:attribute-set><xsl:attribute-set name="mathml-style"> @@ -2831,18 +2845,46 @@ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents"> + <xsl:variable name="nodes_preface_"> + <xsl:for-each select="/*/*[local-name()='preface']/*"> + <node id="{@id}"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/> + <xsl:for-each select="/*/*[local-name()='preface']/*"> <xsl:sort select="@displayorder" data-type="number"/> + + <!-- process Section's title --> + <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/> + <xsl:if test="$preceding-sibling_id != ''"> + <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/> + </xsl:if> + <xsl:apply-templates select="." mode="contents"/> </xsl:for-each> </xsl:template><xsl:template name="processMainSectionsDefault_Contents"> + <xsl:variable name="nodes_sections_"> + <xsl:for-each select="/*/*[local-name()='sections']/*"> + <node id="{@id}"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/> + <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]"> <xsl:sort select="@displayorder" data-type="number"/> + + <!-- process Section's title --> + <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/> + <xsl:if test="$preceding-sibling_id != ''"> + <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/> + </xsl:if> + <xsl:apply-templates select="." mode="contents"/> </xsl:for-each> <xsl:for-each select="/*/*[local-name()='annex']"> <xsl:sort select="@displayorder" data-type="number"/> @@ -2999,11 +3041,11 @@ <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="table" select="$simple-table"/> </xsl:call-template> </xsl:if> </xsl:variable> - <!-- colwidths=<xsl:copy-of select="$colwidths"/> --> + <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> --> <xsl:variable name="margin-side"> <xsl:choose> <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when> @@ -3265,11 +3307,11 @@ </xsl:variable> <xsl:call-template name="tokenize"> <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> --> <!-- 2009 thinspace --> <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> --> - <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/> + <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space --> </xsl:call-template> </xsl:variable> <xsl:variable name="max_length"> <xsl:call-template name="max_length"> <xsl:with-param name="words" select="xalan:nodeset($words)"/> @@ -4905,10 +4947,13 @@ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name() = 'xref']"> <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style"> + <xsl:if test="parent::*[local-name() = 'add']"> + <xsl:call-template name="append_add-style"/> + </xsl:if> <xsl:apply-templates/> </fo:basic-link> </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula"> <fo:block-container margin-left="0mm"> <xsl:if test="parent::*[local-name() = 'note']"> @@ -5006,10 +5051,17 @@ <fo:inline xsl:use-attribute-sets="note-name-style"> + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> + <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> --> + <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> + <xsl:call-template name="append_add-style"/> + </xsl:if> + + <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name--> <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"> <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]"> <xsl:with-param name="skip">false</xsl:with-param> </xsl:apply-templates> @@ -5044,10 +5096,16 @@ <fo:inline xsl:use-attribute-sets="termnote-name-style"> + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> + <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> --> + <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> + <xsl:call-template name="append_add-style"/> + </xsl:if> + <xsl:apply-templates select="*[local-name() = 'name']"/> </fo:inline> <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> @@ -5097,10 +5155,11 @@ <fo:block id="{@id}"> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'term']"> <fo:block id="{@id}" xsl:use-attribute-sets="term-style"> + <xsl:apply-templates select="ogc:name"/> @@ -5535,11 +5594,15 @@ <xsl:value-of select="."/> </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2"> <xsl:value-of select="."/> </xsl:template><xsl:template match="node()" mode="contents"> <xsl:apply-templates mode="contents"/> - </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents"> + </xsl:template><xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" mode="contents_no_displayorder"> + <xsl:call-template name="contents_section-title"/> + </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause"> + <xsl:call-template name="contents_section-title"/> + </xsl:template><xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title']/@depth or ../*[local-name() = 'title']/@depth = 1)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents"> <xsl:variable name="level"> <xsl:call-template name="getLevel"> <xsl:with-param name="depth" select="@depth"/> </xsl:call-template> </xsl:variable> @@ -6935,11 +6998,11 @@ - + <xsl:apply-templates select="node()[not(local-name() = 'note')]"/> </fo:list-block> <!-- <xsl:for-each select="./iho:note"> <xsl:call-template name="note"/> </xsl:for-each> --> @@ -6953,10 +7016,15 @@ <fo:list-item-label end-indent="label-end()"> <fo:block xsl:use-attribute-sets="list-item-label-style"> + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> + <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> + <xsl:call-template name="append_add-style"/> + </xsl:if> + <xsl:call-template name="getListItemFormat"/> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style"> <fo:block> @@ -8164,57 +8232,157 @@ </xsl:template><xsl:template name="number-to-words"> <xsl:param name="number"/> <xsl:param name="first"/> <xsl:if test="$number != ''"> <xsl:variable name="words"> - <words> - <word cardinal="1">One-</word> - <word ordinal="1">First </word> - <word cardinal="2">Two-</word> - <word ordinal="2">Second </word> - <word cardinal="3">Three-</word> - <word ordinal="3">Third </word> - <word cardinal="4">Four-</word> - <word ordinal="4">Fourth </word> - <word cardinal="5">Five-</word> - <word ordinal="5">Fifth </word> - <word cardinal="6">Six-</word> - <word ordinal="6">Sixth </word> - <word cardinal="7">Seven-</word> - <word ordinal="7">Seventh </word> - <word cardinal="8">Eight-</word> - <word ordinal="8">Eighth </word> - <word cardinal="9">Nine-</word> - <word ordinal="9">Ninth </word> - <word ordinal="10">Tenth </word> - <word ordinal="11">Eleventh </word> - <word ordinal="12">Twelfth </word> - <word ordinal="13">Thirteenth </word> - <word ordinal="14">Fourteenth </word> - <word ordinal="15">Fifteenth </word> - <word ordinal="16">Sixteenth </word> - <word ordinal="17">Seventeenth </word> - <word ordinal="18">Eighteenth </word> - <word ordinal="19">Nineteenth </word> - <word cardinal="20">Twenty-</word> - <word ordinal="20">Twentieth </word> - <word cardinal="30">Thirty-</word> - <word ordinal="30">Thirtieth </word> - <word cardinal="40">Forty-</word> - <word ordinal="40">Fortieth </word> - <word cardinal="50">Fifty-</word> - <word ordinal="50">Fiftieth </word> - <word cardinal="60">Sixty-</word> - <word ordinal="60">Sixtieth </word> - <word cardinal="70">Seventy-</word> - <word ordinal="70">Seventieth </word> - <word cardinal="80">Eighty-</word> - <word ordinal="80">Eightieth </word> - <word cardinal="90">Ninety-</word> - <word ordinal="90">Ninetieth </word> - <word cardinal="100">Hundred-</word> - <word ordinal="100">Hundredth </word> + <words> + <xsl:choose> + <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers --> + <word cardinal="1">Une-</word> + <word ordinal="1">Première </word> + <word cardinal="2">Deux-</word> + <word ordinal="2">Seconde </word> + <word cardinal="3">Trois-</word> + <word ordinal="3">Tierce </word> + <word cardinal="4">Quatre-</word> + <word ordinal="4">Quatrième </word> + <word cardinal="5">Cinq-</word> + <word ordinal="5">Cinquième </word> + <word cardinal="6">Six-</word> + <word ordinal="6">Sixième </word> + <word cardinal="7">Sept-</word> + <word ordinal="7">Septième </word> + <word cardinal="8">Huit-</word> + <word ordinal="8">Huitième </word> + <word cardinal="9">Neuf-</word> + <word ordinal="9">Neuvième </word> + <word ordinal="10">Dixième </word> + <word ordinal="11">Onzième </word> + <word ordinal="12">Douzième </word> + <word ordinal="13">Treizième </word> + <word ordinal="14">Quatorzième </word> + <word ordinal="15">Quinzième </word> + <word ordinal="16">Seizième </word> + <word ordinal="17">Dix-septième </word> + <word ordinal="18">Dix-huitième </word> + <word ordinal="19">Dix-neuvième </word> + <word cardinal="20">Vingt-</word> + <word ordinal="20">Vingtième </word> + <word cardinal="30">Trente-</word> + <word ordinal="30">Trentième </word> + <word cardinal="40">Quarante-</word> + <word ordinal="40">Quarantième </word> + <word cardinal="50">Cinquante-</word> + <word ordinal="50">Cinquantième </word> + <word cardinal="60">Soixante-</word> + <word ordinal="60">Soixantième </word> + <word cardinal="70">Septante-</word> + <word ordinal="70">Septantième </word> + <word cardinal="80">Huitante-</word> + <word ordinal="80">Huitantième </word> + <word cardinal="90">Nonante-</word> + <word ordinal="90">Nonantième </word> + <word cardinal="100">Cent-</word> + <word ordinal="100">Centième </word> + </xsl:when> + <xsl:when test="$lang = 'ru'"> + <word cardinal="1">Одна-</word> + <word ordinal="1">Первое </word> + <word cardinal="2">Две-</word> + <word ordinal="2">Второе </word> + <word cardinal="3">Три-</word> + <word ordinal="3">Третье </word> + <word cardinal="4">Четыре-</word> + <word ordinal="4">Четвертое </word> + <word cardinal="5">Пять-</word> + <word ordinal="5">Пятое </word> + <word cardinal="6">Шесть-</word> + <word ordinal="6">Шестое </word> + <word cardinal="7">Семь-</word> + <word ordinal="7">Седьмое </word> + <word cardinal="8">Восемь-</word> + <word ordinal="8">Восьмое </word> + <word cardinal="9">Девять-</word> + <word ordinal="9">Девятое </word> + <word ordinal="10">Десятое </word> + <word ordinal="11">Одиннадцатое </word> + <word ordinal="12">Двенадцатое </word> + <word ordinal="13">Тринадцатое </word> + <word ordinal="14">Четырнадцатое </word> + <word ordinal="15">Пятнадцатое </word> + <word ordinal="16">Шестнадцатое </word> + <word ordinal="17">Семнадцатое </word> + <word ordinal="18">Восемнадцатое </word> + <word ordinal="19">Девятнадцатое </word> + <word cardinal="20">Двадцать-</word> + <word ordinal="20">Двадцатое </word> + <word cardinal="30">Тридцать-</word> + <word ordinal="30">Тридцатое </word> + <word cardinal="40">Сорок-</word> + <word ordinal="40">Сороковое </word> + <word cardinal="50">Пятьдесят-</word> + <word ordinal="50">Пятидесятое </word> + <word cardinal="60">Шестьдесят-</word> + <word ordinal="60">Шестидесятое </word> + <word cardinal="70">Семьдесят-</word> + <word ordinal="70">Семидесятое </word> + <word cardinal="80">Восемьдесят-</word> + <word ordinal="80">Восьмидесятое </word> + <word cardinal="90">Девяносто-</word> + <word ordinal="90">Девяностое </word> + <word cardinal="100">Сто-</word> + <word ordinal="100">Сотое </word> + </xsl:when> + <xsl:otherwise> <!-- default english --> + <word cardinal="1">One-</word> + <word ordinal="1">First </word> + <word cardinal="2">Two-</word> + <word ordinal="2">Second </word> + <word cardinal="3">Three-</word> + <word ordinal="3">Third </word> + <word cardinal="4">Four-</word> + <word ordinal="4">Fourth </word> + <word cardinal="5">Five-</word> + <word ordinal="5">Fifth </word> + <word cardinal="6">Six-</word> + <word ordinal="6">Sixth </word> + <word cardinal="7">Seven-</word> + <word ordinal="7">Seventh </word> + <word cardinal="8">Eight-</word> + <word ordinal="8">Eighth </word> + <word cardinal="9">Nine-</word> + <word ordinal="9">Ninth </word> + <word ordinal="10">Tenth </word> + <word ordinal="11">Eleventh </word> + <word ordinal="12">Twelfth </word> + <word ordinal="13">Thirteenth </word> + <word ordinal="14">Fourteenth </word> + <word ordinal="15">Fifteenth </word> + <word ordinal="16">Sixteenth </word> + <word ordinal="17">Seventeenth </word> + <word ordinal="18">Eighteenth </word> + <word ordinal="19">Nineteenth </word> + <word cardinal="20">Twenty-</word> + <word ordinal="20">Twentieth </word> + <word cardinal="30">Thirty-</word> + <word ordinal="30">Thirtieth </word> + <word cardinal="40">Forty-</word> + <word ordinal="40">Fortieth </word> + <word cardinal="50">Fifty-</word> + <word ordinal="50">Fiftieth </word> + <word cardinal="60">Sixty-</word> + <word ordinal="60">Sixtieth </word> + <word cardinal="70">Seventy-</word> + <word ordinal="70">Seventieth </word> + <word cardinal="80">Eighty-</word> + <word ordinal="80">Eightieth </word> + <word cardinal="90">Ninety-</word> + <word ordinal="90">Ninetieth </word> + <word cardinal="100">Hundred-</word> + <word ordinal="100">Hundredth </word> + </xsl:otherwise> + </xsl:choose> </words> </xsl:variable> <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/> @@ -8284,6 +8452,20 @@ <xsl:value-of select="$value"/> </xsl:when> <xsl:otherwise>_</xsl:otherwise> </xsl:choose> </xsl:attribute> + </xsl:template><xsl:template name="substring-after-last"> + <xsl:param name="value"/> + <xsl:param name="delimiter"/> + <xsl:choose> + <xsl:when test="contains($value, $delimiter)"> + <xsl:call-template name="substring-after-last"> + <xsl:with-param name="value" select="substring-after($value, $delimiter)"/> + <xsl:with-param name="delimiter" select="$delimiter"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value"/> + </xsl:otherwise> + </xsl:choose> </xsl:template></xsl:stylesheet> \ No newline at end of file