lib/isodoc/itu/itu.technical-report.xsl in metanorma-itu-1.4.5 vs lib/isodoc/itu/itu.technical-report.xsl in metanorma-itu-2.0.0

- old
+ new

@@ -538,10 +538,11 @@ <fo:block text-align="left"> <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Fond-Rec))}" width="43.6mm" content-height="299.2mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Cover Page"/> </fo:block> </fo:block-container> <fo:block-container font-family="Arial"> + <xsl:variable name="annexid" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid)"/> <fo:table width="100%" table-layout="fixed"> <!-- 175.4mm--> <fo:table-column column-width="25.2mm"/> <fo:table-column column-width="44.4mm"/> <fo:table-column column-width="35.8mm"/> <fo:table-column column-width="67mm"/> @@ -636,20 +637,19 @@ <xsl:text>OF ITU</xsl:text> </fo:block> </fo:block-container> </fo:table-cell> <fo:table-cell text-align="right"> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"> + <xsl:if test="$annexid != ''"> <fo:block-container> - <xsl:call-template name="setWritingMode"/> + <xsl:call-template name="setWritingMode"/> <fo:block font-size="18pt" font-weight="bold"> - <xsl:variable name="title-annex"> - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-annex'"/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">annex</xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:value-of select="$annexid"/> </fo:block> </fo:block-container> </xsl:if> <xsl:if test="$isAmendment != ''"> <fo:block-container> @@ -886,17 +886,17 @@ <xsl:text>  </xsl:text> <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/> </xsl:otherwise> </xsl:choose> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"> - <xsl:variable name="title-annex"> - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-annex'"/> - </xsl:call-template> - </xsl:variable> - <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/> + <xsl:if test="$annexid != ''"> + <xsl:text> — </xsl:text> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">annex</xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:value-of select="$annexid"/> </xsl:if> </fo:block> </fo:block-container> </fo:table-cell> </fo:table-row> @@ -961,16 +961,13 @@ <fo:block font-size="12pt"> <xsl:value-of select="$linebreak"/> <xsl:value-of select="$linebreak"/> </fo:block> <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt"> - <xsl:variable name="title-keywords"> - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-keywords'"/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select="$title-keywords"/> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">keywords</xsl:with-param> + </xsl:call-template> </fo:block> <fo:block> <xsl:call-template name="insertKeywords"/> </fo:block> </xsl:if> @@ -1296,14 +1293,11 @@ </xsl:template> <xsl:template match="itu:br" mode="contents_item" priority="2"> <fo:inline> </fo:inline> </xsl:template> - - - <xsl:template match="itu:bibitem" mode="contents"/> <xsl:template match="itu:references" mode="contents"> <xsl:apply-templates mode="contents"/> </xsl:template> @@ -1510,28 +1504,28 @@ <xsl:value-of select="itu:docidentifier[@type = 'metanorma']"/> </xsl:when> <xsl:otherwise> <fo:inline padding-right="5mm"> <xsl:text>[</xsl:text> - <xsl:value-of select="itu:docidentifier"/> + <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/> <xsl:text>] </xsl:text> </fo:inline> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="bibitem_body"> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="itu:docidentifier[@type = 'metanorma']"> - <xsl:if test="itu:docidentifier[not(@type) or not(@type = 'metanorma')]"> - <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma')]"/> + <xsl:if test="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"> + <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/> <xsl:text>, </xsl:text> </xsl:if> </xsl:when> <xsl:otherwise> - <xsl:value-of select="itu:docidentifier"/> + <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/> <xsl:if test="itu:title"> <xsl:text>, </xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> @@ -1876,13 +1870,13 @@ [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018). [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag. --> <xsl:template match="itu:annex//itu:bibitem"> <fo:block margin-top="6pt" margin-left="10mm" text-indent="-10mm"> - <fo:inline id="{@id}" padding-right="5mm">[<xsl:value-of select="itu:docidentifier"/>]</fo:inline> + <fo:inline id="{@id}" padding-right="5mm">[<xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>]</fo:inline> <xsl:text> </xsl:text> - <xsl:apply-templates select="itu:docidentifier" mode="content"/> + <xsl:apply-templates select="itu:docidentifier[not(@type = 'metanorma-ordinal')]" mode="content"/> <xsl:if test="node()[local-name(.) != current()/itu:docidentifier]">, </xsl:if> <xsl:apply-templates/> </fo:block> </xsl:template> @@ -2296,17 +2290,10 @@ </xsl:if> </xsl:template> <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_"> - <title-annex lang="en">Annex </title-annex> - <title-annex lang="fr">Annexe </title-annex> - - <title-annex lang="zh">Annex </title-annex> - - - <title-edition lang="en"> <xsl:text>Edition </xsl:text> @@ -2316,37 +2303,22 @@ <xsl:text>Édition </xsl:text> </title-edition> - + + <!-- These titles of Table of contents renders different than determined in localized-strings --> <title-toc lang="en"> - <xsl:text>Table of Contents</xsl:text> - </title-toc> <title-toc lang="fr"> - <xsl:text>Sommaire</xsl:text> - - - </title-toc> + </title-toc> - <title-toc lang="zh">Contents</title-toc> - - - <title-page lang="en">Page</title-page> - <title-page lang="fr">Page</title-page> - - <title-key lang="en">Key</title-key> - <title-key lang="fr">Légende</title-key> - - <title-where lang="en">where</title-where> - <title-where lang="fr">où</title-where> <title-descriptors lang="en">Descriptors</title-descriptors> <title-part lang="en"> @@ -2365,68 +2337,20 @@ </title-subpart> <title-subpart lang="fr"> </title-subpart> - <title-modified lang="en">modified</title-modified> - <title-modified lang="fr">modifiée</title-modified> - - <title-modified lang="zh">modified</title-modified> - - - - <title-source lang="en"> - - <xsl:text>SOURCE</xsl:text> - - - </title-source> - - <title-keywords lang="en">Keywords</title-keywords> - - <title-deprecated lang="en">DEPRECATED</title-deprecated> - <title-deprecated lang="fr">DEPRECATED</title-deprecated> - <title-list-tables lang="en">List of Tables</title-list-tables> <title-list-figures lang="en">List of Figures</title-list-figures> <title-table-figures lang="en">Table of Figures</title-table-figures> <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations> - <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements> - - <title-abstract lang="en">Abstract</title-abstract> - <title-summary lang="en">Summary</title-summary> - <title-in lang="en">in </title-in> - - <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes> - <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes> - - <title-completion-date lang="en">Completion date for this manuscript</title-completion-date> - <title-completion-date lang="zh">本稿完成日期</title-completion-date> - - <title-issuance-date lang="en">Issuance Date: #</title-issuance-date> - <title-issuance-date lang="zh"># 发布</title-issuance-date> - - <title-implementation-date lang="en">Implementation Date: #</title-implementation-date> - <title-implementation-date lang="zh"># 实施</title-implementation-date> - - <title-obligation-normative lang="en">normative</title-obligation-normative> - <title-obligation-normative lang="zh">规范性附录</title-obligation-normative> - - <title-caution lang="en">CAUTION</title-caution> - <title-caution lang="zh">注意</title-caution> - - <title-warning lang="en">WARNING</title-warning> - <title-warning lang="zh">警告</title-warning> - - <title-amendment lang="en">AMENDMENT</title-amendment> - <title-continued lang="en">(continued)</title-continued> <title-continued lang="fr">(continué)</title-continued> </xsl:variable><xsl:variable name="bibdata"> <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/> @@ -2522,10 +2446,11 @@ + <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="margin-top">12pt</xsl:attribute> @@ -2536,11 +2461,13 @@ </xsl:attribute-set><xsl:attribute-set name="example-body-style"> + </xsl:attribute-set><xsl:attribute-set name="example-name-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> @@ -2563,10 +2490,11 @@ + <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="margin-top">12pt</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> @@ -2917,11 +2845,11 @@ - </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:template name="OLD_processPrefaceSectionsDefault_Contents"> + </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="OLD_processPrefaceSectionsDefault_Contents"> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/> @@ -4277,16 +4205,13 @@ <fo:block margin-bottom="12pt" text-align="left"> <xsl:variable name="title-where"> - - - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-where'"/> - </xsl:call-template> - + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">where</xsl:with-param> + </xsl:call-template> </xsl:variable> <xsl:value-of select="$title-where"/><xsl:text> </xsl:text> <xsl:apply-templates select="*[local-name()='dt']/*"/> <xsl:text/> <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/> @@ -4300,16 +4225,13 @@ <xsl:attribute name="margin-bottom">6pt</xsl:attribute> <xsl:variable name="title-where"> - - - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-where'"/> - </xsl:call-template> - + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">where</xsl:with-param> + </xsl:call-template> </xsl:variable> <xsl:value-of select="$title-where"/>: </fo:block> </xsl:when> <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> @@ -4317,16 +4239,13 @@ <xsl:variable name="title-key"> - - - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-key'"/> - </xsl:call-template> - + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">key</xsl:with-param> + </xsl:call-template> </xsl:variable> <xsl:value-of select="$title-key"/> </fo:block> </xsl:when> </xsl:choose> @@ -4667,10 +4586,19 @@ <fo:inline text-decoration="underline"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='add']"> <xsl:choose> + <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start --> + <fo:inline> + <xsl:call-template name="insertTag"> + <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --> + <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C --> + <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C --> + </xsl:call-template> + </fo:inline> + </xsl:when> <xsl:when test="@amendment"> <fo:inline> <xsl:call-template name="insertTag"> <xsl:with-param name="kind">A</xsl:with-param> <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param> @@ -4701,11 +4629,10 @@ <fo:inline xsl:use-attribute-sets="add-style"> <xsl:apply-templates/> </fo:inline> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template name="insertTag"> <xsl:param name="type"/> <xsl:param name="kind"/> <xsl:param name="value"/> <xsl:variable name="add_width" select="string-length($value) * 20"/> @@ -4717,18 +4644,18 @@ <xsl:attribute name="content-width">100%</xsl:attribute> <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> <xsl:attribute name="scaling">uniform</xsl:attribute> <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80"> <g> - <xsl:if test="$type = 'closing'"> + <xsl:if test="$type = 'closing' or $type = 'end'"> <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute> </xsl:if> <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/> <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/> </g> <text font-family="Arial" x="15" y="57" font-size="40pt"> - <xsl:if test="$type = 'closing'"> + <xsl:if test="$type = 'closing' or $type = 'end'"> <xsl:attribute name="x">25</xsl:attribute> </xsl:if> <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan> </text> </svg> @@ -5217,13 +5144,13 @@ <xsl:call-template name="getLevel"/> </xsl:variable> <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2"> <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style"> - <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> + <xsl:apply-templates select="*[local-name()='name']"/> </fo:block> - <xsl:apply-templates/> + <xsl:apply-templates select="node()[not(local-name()='name')]"/> </xsl:template><xsl:template match="*[local-name() = 'callout']"> <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link> </xsl:template><xsl:template match="*[local-name() = 'annotation']"> <xsl:variable name="annotation-id" select="@id"/> <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/> @@ -5820,15 +5747,62 @@ <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']" priority="2" mode="contents"> + <xsl:variable name="level"> + <xsl:call-template name="getLevel"> + <xsl:with-param name="depth" select="@depth"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="section"> + <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/> + </xsl:variable> + + <xsl:variable name="type">floating-title</xsl:variable> + + <xsl:variable name="display"> + <xsl:choose> + <xsl:when test="normalize-space(@id) = ''">false</xsl:when> + <xsl:when test="$level &lt;= $toc_level">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="skip">false</xsl:variable> + + <xsl:if test="$skip = 'false'"> + + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="*[local-name() = 'tab']"> + <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="node()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="root"> + <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if> + <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if> + </xsl:variable> + + <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}"> + <title> + <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/> + </title> + </item> + </xsl:if> </xsl:template><xsl:template match="node()" mode="bookmarks"> <xsl:apply-templates mode="bookmarks"/> </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents"> <xsl:apply-templates select="."/> - </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks"> + </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks"> <xsl:apply-templates mode="bookmarks"/> </xsl:template><xsl:template name="addBookmarks"> <xsl:param name="contents"/> <xsl:if test="xalan:nodeset($contents)//item"> <fo:bookmark-tree> @@ -5995,11 +5969,14 @@ <xsl:apply-templates/> </fo:block> </xsl:if> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item"> - <xsl:apply-templates mode="contents_item"/> + <xsl:param name="mode">bookmarks</xsl:param> + <xsl:apply-templates mode="contents_item"> + <xsl:with-param name="mode" select="$mode"/> + </xsl:apply-templates> <!-- <xsl:text> </xsl:text> --> </xsl:template><xsl:template name="getSection"> <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/> <!-- <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"> @@ -6068,10 +6045,22 @@ </xsl:copy> </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item"> <xsl:copy-of select="."/> </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item"> <xsl:text> </xsl:text> + </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item"> + <xsl:param name="mode">bookmarks</xsl:param> + <xsl:apply-templates mode="contents_item"> + <xsl:with-param name="mode" select="$mode"/> + </xsl:apply-templates> + </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item"> + <xsl:param name="mode">bookmarks</xsl:param> + <xsl:if test="$mode = 'contents'"> + <xsl:copy> + <xsl:apply-templates mode="contents_item"/> + </xsl:copy> + </xsl:if> </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode"> <fo:block-container margin-left="0mm"> <xsl:copy-of select="@id"/> @@ -6404,46 +6393,52 @@ </xsl:choose> </xsl:template><xsl:template match="*[local-name() = 'example']"> <fo:block id="{@id}" xsl:use-attribute-sets="example-style"> - <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> - - <xsl:variable name="element"> + <xsl:variable name="fo_element"> + <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if> block - <xsl:if test=".//*[local-name() = 'table']">block</xsl:if> + </xsl:variable> + <!-- display 'EXAMPLE' --> + <xsl:apply-templates select="*[local-name()='name']"> + <xsl:with-param name="fo_element" select="$fo_element"/> + </xsl:apply-templates> + <xsl:choose> - <xsl:when test="contains(normalize-space($element), 'block')"> - <fo:block xsl:use-attribute-sets="example-body-style"> - <xsl:apply-templates/> - </fo:block> + <xsl:when test="contains(normalize-space($fo_element), 'block')"> + <fo:block-container xsl:use-attribute-sets="example-body-style"> + <fo:block-container margin-left="0mm" margin-right="0mm"> + <xsl:apply-templates select="node()[not(local-name() = 'name')]"> + <xsl:with-param name="fo_element" select="$fo_element"/> + </xsl:apply-templates> + </fo:block-container> + </fo:block-container> </xsl:when> <xsl:otherwise> <fo:inline> - <xsl:apply-templates/> + <xsl:apply-templates select="node()[not(local-name() = 'name')]"> + <xsl:with-param name="fo_element" select="$fo_element"/> + </xsl:apply-templates> </fo:inline> </xsl:otherwise> </xsl:choose> </fo:block> - </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation"> - - <xsl:variable name="element"> - block - - <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if> - </xsl:variable> + </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"> + <xsl:param name="fo_element">block</xsl:param> + <xsl:choose> <xsl:when test="ancestor::*[local-name() = 'appendix']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:when> - <xsl:when test="contains(normalize-space($element), 'block')"> + <xsl:when test="contains(normalize-space($fo_element), 'block')"> <fo:block xsl:use-attribute-sets="example-name-style"> <xsl:apply-templates/> </fo:block> </xsl:when> <xsl:otherwise> @@ -6452,18 +6447,19 @@ </fo:inline> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']"> + <xsl:param name="fo_element">block</xsl:param> + <xsl:variable name="num"><xsl:number/></xsl:variable> <xsl:variable name="element"> - block - + <xsl:value-of select="$fo_element"/> </xsl:variable> <xsl:choose> - <xsl:when test="normalize-space($element) = 'block'"> + <xsl:when test="starts-with(normalize-space($element), 'block')"> <fo:block xsl:use-attribute-sets="example-p-style"> <xsl:apply-templates/> </fo:block> </xsl:when> @@ -6527,16 +6523,13 @@ <xsl:apply-templates/> </fo:inline> </fo:basic-link> </xsl:template><xsl:template match="*[local-name() = 'modification']"> <xsl:variable name="title-modified"> - - - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-modified'"/> - </xsl:call-template> - + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">modified</xsl:with-param> + </xsl:call-template> </xsl:variable> <xsl:variable name="text"><xsl:apply-templates/></xsl:variable> <xsl:choose> <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when> @@ -6724,24 +6717,23 @@ <fo:block xsl:use-attribute-sets="admitted-style"> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'deprecates']"> <xsl:variable name="title-deprecated"> - - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">deprecated</xsl:with-param> - </xsl:call-template> - - + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">deprecated</xsl:with-param> + </xsl:call-template> </xsl:variable> <fo:block xsl:use-attribute-sets="deprecates-style"> <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template name="setStyle_preferred"> <xsl:if test="*[local-name() = 'strong']"> <xsl:attribute name="font-weight">normal</xsl:attribute> </xsl:if> + </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]"> + <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/> </xsl:template><xsl:template match="*[local-name() = 'definition']"> <fo:block xsl:use-attribute-sets="definition-style"> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]"> @@ -7067,20 +7059,34 @@ </fo:table-cell> </xsl:template><xsl:template name="processBibitem"> - + + + + + + + + + <!-- end MPFD bibitem processing --> + + <!-- start M3D bibitem processing --> + + + + </xsl:template><xsl:template name="processBibitemDocId"> - <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/> + <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/> <xsl:choose> <xsl:when test="normalize-space($_doc_ident) != ''"> <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/> <xsl:if test="$type != '' and not(contains($_doc_ident, $type))"> <xsl:value-of select="$type"/><xsl:text> </xsl:text> @@ -7090,11 +7096,11 @@ <xsl:otherwise> <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/> <xsl:if test="$type != ''"> <xsl:value-of select="$type"/><xsl:text> </xsl:text> </xsl:if> --> - <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/> + <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="processPersonalAuthor"> <xsl:choose> <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']"> @@ -7196,12 +7202,16 @@ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']"> <fo:block-container border="1pt solid black" width="50%"> <fo:block> </fo:block> </fo:block-container> </xsl:template><xsl:variable name="toc_level"> + <!-- https://www.metanorma.org/author/ref/document-attributes/ --> + <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:--> + <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render --> <xsl:choose> - <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml --> + <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml --> + <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml --> <xsl:otherwise><!-- default value --> @@ -7299,11 +7309,11 @@ <xsl:copy-of select="."/> </xsl:for-each> </td> </xsl:for-each> <td>333</td> <!-- page number, just for fill --> - </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"> + </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"> <fo:inline padding-right="5mm"> </fo:inline> <fo:inline><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare"> <fo:inline padding-right="2.5mm" baseline-shift="5%"> <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad"> @@ -7671,12 +7681,18 @@ </xsl:call-template> </xsl:if> </xsl:template><xsl:template name="getLocalizedString"> <xsl:param name="key"/> <xsl:param name="formatted">false</xsl:param> + <xsl:param name="lang"/> <xsl:variable name="curr_lang"> - <xsl:call-template name="getLang"/> + <xsl:choose> + <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when> + <xsl:otherwise> + <xsl:call-template name="getLang"/> + </xsl:otherwise> + </xsl:choose> </xsl:variable> <xsl:variable name="data_value"> <xsl:choose> <xsl:when test="$formatted = 'true'"> \ No newline at end of file