lib/isodoc/cc/cc.standard.xsl in metanorma-cc-1.8.5 vs lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.0.0

- old
+ new

@@ -508,34 +508,11 @@ </xsl:template> <xsl:template match="csd:bibitem"> <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt --> - <xsl:if test=".//csd:fn"> - <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute> - </xsl:if> - <!-- csd:docidentifier --> - <xsl:if test="csd:docidentifier"> - <xsl:choose> - <xsl:when test="csd:docidentifier/@type = 'metanorma'"/> - <xsl:otherwise> - <xsl:value-of select="csd:docidentifier"/> - </xsl:otherwise> - </xsl:choose> - </xsl:if> - <xsl:apply-templates select="csd:note"/> - <xsl:if test="csd:docidentifier">, </xsl:if> - <fo:inline font-style="italic"> - <xsl:choose> - <xsl:when test="csd:title[@type = 'main' and @language = 'en']"> - <xsl:value-of select="csd:title[@type = 'main' and @language = 'en']"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="csd:title"/> - </xsl:otherwise> - </xsl:choose> - </fo:inline> + <xsl:call-template name="processBibitem"/> </fo:block> </xsl:template> <xsl:template match="csd:bibitem/csd:note" priority="2"> @@ -652,43 +629,28 @@ <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm"> <fo:list-item> <fo:list-item-label end-indent="label-end()"> <fo:block> <fo:inline id="{@id}"> - <xsl:number format="[1]"/> + <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/> + <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])"> + <xsl:number format="[1]"/> + </xsl:if> </fo:inline> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block> - <xsl:if test="csd:docidentifier"> - <xsl:choose> - <xsl:when test="csd:docidentifier/@type = 'metanorma'"/> - <xsl:otherwise><fo:inline><xsl:value-of select="csd:docidentifier"/><xsl:apply-templates select="csd:note"/>, </fo:inline></xsl:otherwise> - </xsl:choose> - - </xsl:if> - <xsl:choose> - <xsl:when test="csd:title[@type = 'main' and @language = 'en']"> - <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select="csd:title"/> - </xsl:otherwise> - </xsl:choose> - <xsl:apply-templates select="csd:formattedref"/> + <xsl:call-template name="processBibitem"/> </fo:block> </fo:list-item-body> </fo:list-item> </fo:list-block> </xsl:template> - <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem" mode="contents"/> --> - <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem" mode="contents"/> - <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem/csd:title"> --> - <xsl:template match="csd:references[not(@normative='true')]/csd:bibitem/csd:title"> + <xsl:template match="csd:references/csd:bibitem/csd:title"> <fo:inline font-style="italic"> <xsl:apply-templates/> </fo:inline> </xsl:template> @@ -794,17 +756,10 @@ </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> @@ -814,11 +769,12 @@ <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>Contents</xsl:text> @@ -826,25 +782,15 @@ </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"> @@ -863,68 +809,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']"/> @@ -1032,22 +930,24 @@ + </xsl:attribute-set><xsl:attribute-set name="example-body-style"> <xsl:attribute name="margin-left">12.5mm</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="example-name-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> - <xsl:attribute name="keep-with-next">always</xsl:attribute> @@ -1077,10 +977,11 @@ + </xsl:attribute-set><xsl:attribute-set name="termexample-name-style"> <xsl:attribute name="padding-right">10mm</xsl:attribute> @@ -1423,11 +1324,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"/> @@ -2693,16 +2594,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"/> @@ -2714,16 +2612,13 @@ <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')"> @@ -2731,16 +2626,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> @@ -3066,10 +2958,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> @@ -3100,11 +3001,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"/> @@ -3116,18 +3016,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> @@ -3616,13 +3516,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()"/> @@ -4211,15 +4111,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> @@ -4386,11 +4333,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()"> @@ -4459,10 +4409,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"/> @@ -4795,46 +4757,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> @@ -4843,18 +4811,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> @@ -4918,16 +4887,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> @@ -5116,24 +5082,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="getTitle"> - <xsl:with-param name="name" select="'title-deprecated'"/> - </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']]"> @@ -5455,20 +5420,58 @@ </fo:table-cell> </xsl:template><xsl:template name="processBibitem"> - + + + + <!-- start CSD bibtem processing --> + <xsl:if test=".//csd:fn"> + <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute> + </xsl:if> + <xsl:variable name="docidentifier"> + <xsl:choose> + <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/> + <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$docidentifier"/> + <xsl:apply-templates select="csd:note"/> + <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if> + <xsl:choose> + <xsl:when test="csd:title[@type = 'main' and @language = 'en']"> + <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="csd:title"/> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="csd:formattedref"/> + <!-- end CSD bibtem processing --> + + + + + + + <!-- 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> @@ -5478,11 +5481,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']"> @@ -5584,12 +5587,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 --> 2 @@ -5687,11 +5694,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"> @@ -6059,12 +6066,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