lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-1.2.6 vs lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-1.2.7

- old
+ new

@@ -61,12 +61,12 @@ <xsl:variable name="lang"> <xsl:call-template name="getLang"/> </xsl:variable> - <xsl:variable name="isAmendment" select="normalize-space(/itu:itu-standard/itu:local_bibdata/itu:ext/itu:structuredidentifier/itu:amendment[@language = $lang])"/> - <xsl:variable name="isCorrigendum" select="normalize-space(/itu:itu-standard/itu:local_bibdata/itu:ext/itu:structuredidentifier/itu:corrigendum[@language = $lang])"/> + <xsl:variable name="isAmendment" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:amendment[@language = $lang])"/> + <xsl:variable name="isCorrigendum" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:corrigendum[@language = $lang])"/> <xsl:template match="/"> <xsl:call-template name="namespaceCheck"/> <fo:root font-family="Times New Roman, STIX Two Math" font-size="12pt" xml:lang="{$lang}"> <fo:layout-master-set> @@ -311,12 +311,14 @@ </fo:table-cell> <fo:table-cell number-columns-spanned="3"> <fo:block font-size="16pt" margin-top="3pt"> <xsl:value-of select="$doctype"/> <xsl:text>  </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/> - <xsl:text>-</xsl:text> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/> + <xsl:text>-</xsl:text> + </xsl:if> <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/> <xsl:text>  </xsl:text> <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/> <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"> <xsl:variable name="title-annex"> @@ -896,28 +898,42 @@ </fo:inline> <fo:inline font-weight="bold"> <xsl:apply-templates/> </fo:inline> <xsl:if test="../itu:termsource/itu:origin"> + <xsl:text>: </xsl:text> <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/> - <xsl:choose> - <xsl:when test="contains($citeas, '[')"> - <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" --> - </xsl:when> - <xsl:otherwise> - <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:if> - <xsl:text>: </xsl:text> - <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> + <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/> + <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/> + + <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}"> + <xsl:choose> + <xsl:when test="$origin_text != ''"> + <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/> + </xsl:when> + <xsl:when test="contains($citeas, '[')"> + <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" --> + </xsl:when> + <xsl:otherwise> + <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text> + </xsl:otherwise> + </xsl:choose> + </fo:basic-link> + </xsl:if> + <xsl:if test="following-sibling::itu:definition/node()"> + <xsl:text>: </xsl:text> + <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> + </xsl:if> </fo:block> <!-- <xsl:if test="following-sibling::itu:table"> <fo:block space-after="18pt">&#xA0;</fo:block> </xsl:if> --> </xsl:template> + <xsl:template match="itu:term[itu:preferred]/itu:termsource" priority="2"/> + + <xsl:template match="itu:definition/itu:p" priority="2"/> <xsl:template match="itu:definition/itu:formula" priority="2"/> <xsl:template match="itu:definition/itu:p" mode="process" priority="2"> <xsl:choose> @@ -1307,17 +1323,26 @@ <title-descriptors lang="en">Descriptors</title-descriptors> <title-part lang="en"> + </title-part> <title-part lang="fr"> + </title-part> <title-part lang="zh">第 # 部分:</title-part> + <title-subpart lang="en"> + + </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> @@ -1769,12 +1794,14 @@ <fo:block space-before="18pt"> </fo:block> + <!-- <xsl:if test="$namespace = 'bipm'"> + <fo:block>&#xA0;</fo:block> + </xsl:if> --> - <!-- $namespace = 'iso' or --> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> @@ -1943,10 +1970,11 @@ </fo:block-container> </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation"> <xsl:if test="normalize-space() != ''"> <fo:block xsl:use-attribute-sets="table-name-style"> + <xsl:apply-templates/> </fo:block> </xsl:if> </xsl:template><xsl:template name="calculate-columns-numbers"> <xsl:param name="table-row"/> @@ -2304,10 +2332,11 @@ </xsl:if> + <!-- <xsl:if test="$namespace = 'bipm'"> <xsl:attribute name="height">8mm</xsl:attribute> </xsl:if> --> <xsl:apply-templates/> @@ -2398,11 +2427,12 @@ <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> <xsl:call-template name="display-align"/> - <fo:block> + <fo:block> + <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process"> @@ -2629,22 +2659,29 @@ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='dl']"> - <fo:block-container margin-left="0mm"> + <fo:block-container> + + <xsl:attribute name="margin-left">0mm</xsl:attribute> + + <xsl:if test="parent::*[local-name() = 'note']"> <xsl:attribute name="margin-left"> <xsl:choose> <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when> <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:if> - <fo:block-container margin-left="0mm"> - + <fo:block-container> + + <xsl:attribute name="margin-left">0mm</xsl:attribute> + + <xsl:variable name="parent" select="local-name(..)"/> <xsl:variable name="key_iso"> <!-- and (not(../@class) or ../@class !='pseudocode') --> </xsl:variable> @@ -2654,13 +2691,16 @@ <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="getTitle"> + <xsl:with-param name="name" select="'title-where'"/> + </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"/> @@ -2674,26 +2714,32 @@ <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="getTitle"> + <xsl:with-param name="name" select="'title-where'"/> + </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')"> <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always"> <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="getTitle"> + <xsl:with-param name="name" select="'title-key'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-key"/> </fo:block> </xsl:when> </xsl:choose> @@ -3277,11 +3323,22 @@ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan"> <xsl:with-param name="previousRow" select="$newRow"/> </xsl:apply-templates> </xsl:template><xsl:template name="getLang"> - <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> + <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/> + <xsl:variable name="language"> + <xsl:choose> + <xsl:when test="$language_current != ''"> + <xsl:value-of select="$language_current"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> <xsl:when test="$language = 'English'">en</xsl:when> <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="capitalizeWords"> @@ -3312,10 +3369,11 @@ <xsl:param name="str"/> <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/> <xsl:value-of select="substring($str, 2)"/> </xsl:template><xsl:template match="mathml:math"> <fo:inline font-family="STIX Two Math"> <!-- --> + <xsl:variable name="mathml"> <xsl:apply-templates select="." mode="mathml"/> </xsl:variable> <fo:instream-foreign-object fox:alt-text="Math"> <!-- <xsl:copy-of select="."/> --> @@ -3394,14 +3452,18 @@ <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() = '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="getTitle"> + <xsl:with-param name="name" select="'title-modified'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when> <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise> </xsl:choose> <xsl:apply-templates/> @@ -4276,13 +4338,16 @@ <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="getTitle"> + <xsl:with-param name="name" select="'title-deprecated'"/> + </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 match="*[local-name() = 'definition']"> @@ -4641,17 +4706,26 @@ </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="split"> <xsl:param name="pText" select="."/> <xsl:param name="sep" select="','"/> + <xsl:param name="normalize-space" select="'true'"/> <xsl:if test="string-length($pText) &gt;0"> <item> - <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/> + <xsl:choose> + <xsl:when test="$normalize-space = 'true'"> + <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/> + </xsl:otherwise> + </xsl:choose> </item> <xsl:call-template name="split"> <xsl:with-param name="pText" select="substring-after($pText, $sep)"/> <xsl:with-param name="sep" select="$sep"/> + <xsl:with-param name="normalize-space" select="$normalize-space"/> </xsl:call-template> </xsl:if> </xsl:template><xsl:template name="getDocumentId"> <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/> </xsl:template><xsl:template name="namespaceCheck"> @@ -4713,6 +4787,25 @@ <xsl:call-template name="add-letter-spacing"> <xsl:with-param name="text" select="substring($text, 2)"/> <xsl:with-param name="letter-spacing" select="$letter-spacing"/> </xsl:call-template> </xsl:if> + </xsl:template><xsl:template name="repeat"> + <xsl:param name="char" select="'*'"/> + <xsl:param name="count"/> + <xsl:if test="$count &gt; 0"> + <xsl:value-of select="$char"/> + <xsl:call-template name="repeat"> + <xsl:with-param name="char" select="$char"/> + <xsl:with-param name="count" select="$count - 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template><xsl:template name="getLocalizedString"> + <xsl:param name="key"/> + + <xsl:variable name="curr_lang"> + <xsl:call-template name="getLang"/> + </xsl:variable> + + <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> + </xsl:template></xsl:stylesheet> \ No newline at end of file