lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-1.2.2 vs lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-1.2.3

- old
+ new

@@ -977,11 +977,11 @@ <xsl:apply-templates/> </xsl:template> <xsl:template match="itu:docidentifier"/> - <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol"> + <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol" mode="ul_ol"> <xsl:if test="preceding-sibling::*[1][local-name() = 'title']"> <fo:block padding-top="-8pt" font-size="1pt"> </fo:block> </xsl:if> <fo:list-block> <xsl:apply-templates/> @@ -990,21 +990,25 @@ </xsl:template> <xsl:template match="itu:ul//itu:note | itu:ol//itu:note" priority="2"/> <xsl:template match="itu:ul//itu:note | itu:ol//itu:note" mode="process"> <fo:block id="{@id}"> - <xsl:apply-templates select="../itu:name" mode="presentation"/> + <xsl:apply-templates select="itu:name" mode="presentation"/> <xsl:apply-templates mode="process"/> </fo:block> </xsl:template> - <xsl:template match="itu:ul//itu:note/itu:name | itu:ol//itu:note/itu:name" mode="process"/> - <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process"> + <xsl:template match="itu:ul//itu:note/itu:name | itu:ol//itu:note/itu:name" mode="process" priority="2"/> + <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process" priority="2"> <fo:block font-size="11pt" margin-top="4pt"> <xsl:apply-templates/> </fo:block> </xsl:template> + <xsl:template match="itu:ul//itu:note/* | itu:ol//itu:note/*" mode="process"> + <xsl:apply-templates select="."/> + </xsl:template> + <xsl:template match="itu:li"> <fo:list-item id="{@id}"> <fo:list-item-label end-indent="label-end()"> <fo:block> <xsl:call-template name="getListItemFormat"/> @@ -1104,12 +1108,16 @@ <xsl:call-template name="formula"/> </xsl:template> <xsl:template match="mathml:math" priority="2"> <fo:inline font-family="STIX2Math" font-size="11pt"> + <xsl:variable name="mathml"> + <xsl:apply-templates select="." mode="mathml"/> + </xsl:variable> <fo:instream-foreign-object fox:alt-text="Math"> - <xsl:copy-of select="."/> + <!-- <xsl:copy-of select="."/> --> + <xsl:copy-of select="xalan:nodeset($mathml)"/> </fo:instream-foreign-object> </fo:inline> </xsl:template> @@ -1258,11 +1266,16 @@ <title-modified lang="zh">modified</title-modified> - <title-source lang="en">SOURCE</title-source> + <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> @@ -1301,10 +1314,14 @@ <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="tab_zh"> </xsl:variable><xsl:template name="getTitle"> <xsl:param name="name"/> <xsl:variable name="lang"> <xsl:call-template name="getLang"/> </xsl:variable> @@ -1318,26 +1335,27 @@ </xsl:otherwise> </xsl:choose> </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style"> + </xsl:attribute-set><xsl:attribute-set name="sourcecode-style"> <xsl:attribute name="white-space">pre</xsl:attribute> <xsl:attribute name="wrap-option">wrap</xsl:attribute> - <xsl:attribute name="font-family">Courier</xsl:attribute> - <xsl:attribute name="font-size">10pt</xsl:attribute> + <xsl:attribute name="font-family">Courier</xsl:attribute> <xsl:attribute name="margin-top">6pt</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="permission-style"> </xsl:attribute-set><xsl:attribute-set name="permission-name-style"> </xsl:attribute-set><xsl:attribute-set name="permission-label-style"> @@ -1378,10 +1396,11 @@ + </xsl:attribute-set><xsl:attribute-set name="example-body-style"> </xsl:attribute-set><xsl:attribute-set name="example-name-style"> @@ -1398,10 +1417,11 @@ + </xsl:attribute-set><xsl:attribute-set name="example-p-style"> @@ -1455,18 +1475,20 @@ </xsl:attribute-set><xsl:attribute-set name="xref-style"> <xsl:attribute name="color">blue</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> - + + </xsl:attribute-set><xsl:attribute-set name="eref-style"> <xsl:attribute name="color">blue</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="note-style"> @@ -1481,24 +1503,24 @@ + </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style"> - </xsl:attribute-set><xsl:attribute-set name="note-name-style"> - + </xsl:attribute-set><xsl:attribute-set name="note-p-style"> @@ -1519,10 +1541,12 @@ <xsl:attribute name="margin-top">4pt</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="termnote-name-style"> + </xsl:attribute-set><xsl:attribute-set name="quote-style"> @@ -1545,19 +1569,21 @@ </xsl:attribute-set><xsl:attribute-set name="origin-style"> + </xsl:attribute-set><xsl:attribute-set name="term-style"> </xsl:attribute-set><xsl:attribute-set name="figure-name-style"> + <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="text-align">center</xsl:attribute> <xsl:attribute name="margin-top">6pt</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> @@ -1602,15 +1628,18 @@ </xsl:attribute-set><xsl:attribute-set name="tt-style"> + </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style"> <xsl:attribute name="font-size">11pt</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="text-align">center</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> + <xsl:attribute name="keep-with-previous">always</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="domain-style"> </xsl:attribute-set><xsl:attribute-set name="admitted-style"> @@ -1672,10 +1701,12 @@ <fo:block space-before="18pt"> </fo:block> + <!-- $namespace = 'iso' or --> + <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> <xsl:call-template name="fn_name_display"/> @@ -1737,14 +1768,14 @@ <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> <xsl:attribute name="space-after">18pt</xsl:attribute> + - <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true"> <xsl:attribute name="margin-left">0mm</xsl:attribute> @@ -1759,10 +1790,12 @@ <xsl:attribute name="font-size">10pt</xsl:attribute> + + <xsl:for-each select="xalan:nodeset($colwidths)//column"> <xsl:choose> <xsl:when test=". = 1 or . = 0"> <fo:table-column column-width="proportional-column-width(2)"/> </xsl:when> @@ -1789,12 +1822,13 @@ </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:apply-templates/> + </fo:block> </xsl:if> </xsl:template><xsl:template name="calculate-columns-numbers"> <xsl:param name="table-row"/> <xsl:variable name="columns-count" select="count($table-row/*)"/> <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/> @@ -1906,14 +1940,29 @@ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text"> <xsl:value-of select="@target"/> </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process"> <xsl:param name="cols-count"/> <!-- font-weight="bold" --> - <fo:table-header> - + <fo:table-header> + <xsl:apply-templates/> </fo:table-header> + </xsl:template><xsl:template name="table-header-title"> + <xsl:param name="cols-count"/> + <!-- row for title --> + <fo:table-row> + <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black"> + <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/> + <xsl:for-each select="ancestor::*[local-name()='table'][1]"> + <xsl:call-template name="fn_name_display"/> + </xsl:for-each> + <fo:block text-align="right" font-style="italic"> + <xsl:text> </xsl:text> + <fo:retrieve-table-marker retrieve-class-name="table_continued"/> + </fo:block> + </fo:table-cell> + </fo:table-row> </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody"> <fo:table-body> <xsl:apply-templates/> </fo:table-body> </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process"> @@ -1977,19 +2026,23 @@ </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:variable> + + <xsl:apply-templates select="../*[local-name()='thead']" mode="process"> <xsl:with-param name="cols-count" select="$cols-count"/> </xsl:apply-templates> <xsl:call-template name="insertTableFooter"> <xsl:with-param name="cols-count" select="$cols-count"/> </xsl:call-template> <fo:table-body> + + <xsl:apply-templates/> <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> --> </fo:table-body> @@ -2008,10 +2061,12 @@ <xsl:if test="$parent-name = 'tfoot'"> </xsl:if> + + <xsl:apply-templates/> </fo:table-row> </xsl:template><xsl:template match="*[local-name()='th']"> <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center"> @@ -2034,24 +2089,37 @@ + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@rowspan"> <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> + <xsl:call-template name="display-align"/> <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> + </xsl:template><xsl:template name="display-align"> + <xsl:if test="@valign"> + <xsl:attribute name="display-align"> + <xsl:choose> + <xsl:when test="@valign = 'top'">before</xsl:when> + <xsl:when test="@valign = 'middle'">center</xsl:when> + <xsl:when test="@valign = 'bottom'">after</xsl:when> + <xsl:otherwise>before</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> </xsl:template><xsl:template match="*[local-name()='td']"> <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm"> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@align"> @@ -2072,22 +2140,23 @@ + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@rowspan"> <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> - <fo:block> - + <xsl:call-template name="display-align"/> + <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"> @@ -2275,10 +2344,11 @@ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> --> <fo:inline font-size="80%" keep-with-previous.within-line="always"> + <xsl:attribute name="vertical-align">super</xsl:attribute> <xsl:attribute name="color">blue</xsl:attribute> <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id--> @@ -2289,128 +2359,142 @@ </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']"> - <xsl:variable name="parent" select="local-name(..)"/> - - <xsl:variable name="key_iso"> - <!-- and (not(../@class) or ../@class !='pseudocode') --> - </xsl:variable> - - <xsl:choose> - <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component --> + <fo:block-container margin-left="0mm"> + <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"> + + <xsl:variable name="parent" select="local-name(..)"/> - <fo:block margin-bottom="12pt" text-align="left"> + <xsl:variable name="key_iso"> + <!-- and (not(../@class) or ../@class !='pseudocode') --> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component --> - <xsl:variable name="title-where"> - <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"/> - </fo:block> + + <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: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"/> + </fo:block> + + </xsl:when> + <xsl:when test="$parent = 'formula'"> <!-- a few components --> + <fo:block margin-bottom="12pt" text-align="left"> + + + + <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: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:variable> + <xsl:value-of select="$title-key"/> + </fo:block> + </xsl:when> + </xsl:choose> - </xsl:when> - <xsl:when test="$parent = 'formula'"> <!-- a few components --> - <fo:block margin-bottom="12pt" text-align="left"> - - - - <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: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:variable> - <xsl:value-of select="$title-key"/> - </fo:block> - </xsl:when> - </xsl:choose> - - <!-- a few components --> - <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)"> - <fo:block> - - - <xsl:if test="$parent = 'figure' or $parent = 'formula'"> - <xsl:attribute name="margin-left">7.4mm</xsl:attribute> - </xsl:if> - <xsl:if test="$parent = 'li'"> - <!-- <xsl:attribute name="margin-left">-4mm</xsl:attribute> --> - </xsl:if> - - - - <fo:block> - - - - - <fo:table width="95%" table-layout="fixed"> + <!-- a few components --> + <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)"> + <fo:block> - <xsl:choose> - <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"> - <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> --> - </xsl:when> - <xsl:when test="normalize-space($key_iso) = 'true'"> - <xsl:attribute name="font-size">10pt</xsl:attribute> + + <xsl:if test="$parent = 'figure' or $parent = 'formula'"> + <xsl:attribute name="margin-left">7.4mm</xsl:attribute> + </xsl:if> + <xsl:if test="$parent = 'li'"> + <!-- <xsl:attribute name="margin-left">-4mm</xsl:attribute> --> + </xsl:if> + + + + <fo:block> + + + + + <fo:table width="95%" table-layout="fixed"> - </xsl:when> - </xsl:choose> - <!-- create virtual html table for dl/[dt and dd] --> - <xsl:variable name="html-table"> - <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> - <xsl:element name="{$ns}:table"> - <tbody> - <xsl:apply-templates mode="dl"/> - </tbody> - </xsl:element> - </xsl:variable> - <!-- html-table<xsl:copy-of select="$html-table"/> --> - <xsl:variable name="colwidths"> - <xsl:call-template name="calculate-column-widths"> - <xsl:with-param name="cols-count" select="2"/> - <xsl:with-param name="table" select="$html-table"/> - </xsl:call-template> - </xsl:variable> - <!-- colwidths=<xsl:value-of select="$colwidths"/> --> - <xsl:variable name="maxlength_dt"> - <xsl:call-template name="getMaxLength_dt"/> - </xsl:variable> - <xsl:call-template name="setColumnWidth_dl"> - <xsl:with-param name="colwidths" select="$colwidths"/> - <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/> - </xsl:call-template> - <fo:table-body> - <xsl:apply-templates> - <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/> - </xsl:apply-templates> - </fo:table-body> - </fo:table> - </fo:block> - </fo:block> - </xsl:if> + <xsl:choose> + <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"> + <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> --> + </xsl:when> + <xsl:when test="normalize-space($key_iso) = 'true'"> + <xsl:attribute name="font-size">10pt</xsl:attribute> + + </xsl:when> + </xsl:choose> + <!-- create virtual html table for dl/[dt and dd] --> + <xsl:variable name="html-table"> + <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> + <xsl:element name="{$ns}:table"> + <tbody> + <xsl:apply-templates mode="dl"/> + </tbody> + </xsl:element> + </xsl:variable> + <!-- html-table<xsl:copy-of select="$html-table"/> --> + <xsl:variable name="colwidths"> + <xsl:call-template name="calculate-column-widths"> + <xsl:with-param name="cols-count" select="2"/> + <xsl:with-param name="table" select="$html-table"/> + </xsl:call-template> + </xsl:variable> + <!-- colwidths=<xsl:value-of select="$colwidths"/> --> + <xsl:variable name="maxlength_dt"> + <xsl:call-template name="getMaxLength_dt"/> + </xsl:variable> + <xsl:call-template name="setColumnWidth_dl"> + <xsl:with-param name="colwidths" select="$colwidths"/> + <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/> + </xsl:call-template> + <fo:table-body> + <xsl:apply-templates> + <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/> + </xsl:apply-templates> + </fo:table-body> + </fo:table> + </fo:block> + </fo:block> + </xsl:if> + </fo:block-container> + </fo:block-container> </xsl:template><xsl:template name="setColumnWidth_dl"> <xsl:param name="colwidths"/> <xsl:param name="maxlength_dt"/> <xsl:choose> <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table --> @@ -2503,10 +2587,11 @@ </xsl:template><xsl:template match="*[local-name()='dt']"> <xsl:param name="key_iso"/> <fo:table-row> + <fo:table-cell> <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']"> <xsl:attribute name="padding-right">3mm</xsl:attribute> </xsl:if> @@ -2592,10 +2677,35 @@ <fo:inline font-size="80%" vertical-align="sub"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='tt']"> <fo:inline xsl:use-attribute-sets="tt-style"> + <xsl:variable name="_font-size"> + + + + + + + + + + + + + + + </xsl:variable> + <xsl:variable name="font-size" select="normalize-space($_font-size)"/> + <xsl:if test="$font-size != ''"> + <xsl:attribute name="font-size"> + <xsl:choose> + <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when> + <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='del']"> <fo:inline font-size="10pt" color="red" text-decoration="line-through"> <xsl:apply-templates/> @@ -2918,14 +3028,27 @@ <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="STIX2Math"> - <fo:instream-foreign-object fox:alt-text="Math"> - <xsl:copy-of select="."/> - </fo:instream-foreign-object> + <xsl:variable name="mathml"> + <xsl:apply-templates select="." mode="mathml"/> + </xsl:variable> + <fo:instream-foreign-object fox:alt-text="Math"> + <!-- <xsl:copy-of select="."/> --> + <xsl:copy-of select="xalan:nodeset($mathml)"/> + </fo:instream-foreign-object> </fo:inline> + </xsl:template><xsl:template match="@*|node()" mode="mathml"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" mode="mathml"/> + </xsl:copy> + </xsl:template><xsl:template match="mathml:mtext" mode="mathml"> + <xsl:copy> + <!-- replace start and end spaces to non-break space --> + <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/> + </xsl:copy> </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link"> <xsl:variable name="target"> <xsl:choose> <xsl:when test="starts-with(normalize-space(@target), 'mailto:')"> <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/> @@ -3002,13 +3125,26 @@ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style"> <xsl:apply-templates/> </fo:basic-link> </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula"> - <fo:block id="{@id}" xsl:use-attribute-sets="formula-style"> - <xsl:apply-templates/> - </fo:block> + <fo:block-container margin-left="0mm"> + <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 id="{@id}" xsl:use-attribute-sets="formula-style"> + <xsl:apply-templates/> + </fo:block> + </fo:block-container> + </fo:block-container> </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'dt']/*[local-name() = 'stem']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name() = 'admitted']/*[local-name() = 'stem']"> @@ -3068,11 +3204,13 @@ </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template match="*[local-name() = 'termnote']"> <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style"> - <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/> + <fo:inline xsl:use-attribute-sets="termnote-name-style"> + <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/> + </fo:inline> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'note']/*[local-name() = 'name'] | *[local-name() = 'termnote']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']" mode="presentation"> <xsl:param name="sfx"/> <xsl:variable name="suffix"> @@ -3239,25 +3377,65 @@ <xsl:apply-templates mode="contents_item"/> </xsl:copy> </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item"> <xsl:text> </xsl:text> </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode"> - <fo:block xsl:use-attribute-sets="sourcecode-style"> - <xsl:apply-templates/> - </fo:block> - <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> - </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()"> + + <fo:block-container margin-left="0mm"> + <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 xsl:use-attribute-sets="sourcecode-style"> + <xsl:variable name="_font-size"> + + + + + + + 10 + + + + + + + + </xsl:variable> + <xsl:variable name="font-size" select="normalize-space($_font-size)"/> + <xsl:if test="$font-size != ''"> + <xsl:attribute name="font-size"> + <xsl:choose> + <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when> + <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </fo:block> + <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> + + </fo:block-container> + </fo:block-container> + </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2"> <xsl:variable name="text"> <xsl:call-template name="add-zero-spaces-equal"/> </xsl:variable> - <xsl:call-template name="add-zero-spaces"> + <xsl:call-template name="add-zero-spaces-java"> <xsl:with-param name="text" select="$text"/> </xsl:call-template> </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="presentation"> <xsl:if test="normalize-space() != ''"> - <fo:block xsl:use-attribute-sets="sourcecode-name-style"> - + <fo:block xsl:use-attribute-sets="sourcecode-name-style"> <xsl:apply-templates/> </fo:block> </xsl:if> </xsl:template><xsl:template match="*[local-name() = 'permission']"> <fo:block id="{@id}" xsl:use-attribute-sets="permission-style"> @@ -3327,23 +3505,23 @@ <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt"> <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']"> <xsl:attribute name="margin-bottom">0pt</xsl:attribute> </xsl:if> <fo:block-container margin-left="0mm" margin-right="0mm"> - <fo:table id="{@id}" table-layout="fixed" width="100%" border="1pt solid black"> + <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" --> <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']"> - <xsl:attribute name="border">0.5pt solid black</xsl:attribute> + <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> --> </xsl:if> <xsl:variable name="simple-table"> <xsl:call-template name="getSimpleTable"/> </xsl:variable> <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/> <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])"> <!-- <fo:table-column column-width="35mm"/> <fo:table-column column-width="115mm"/> --> - <fo:table-column column-width="25%"/> - <fo:table-column column-width="75%"/> + <fo:table-column column-width="30%"/> + <fo:table-column column-width="70%"/> </xsl:if> <xsl:apply-templates mode="requirement"/> </fo:table> <!-- fn processing --> <xsl:if test=".//*[local-name() = 'fn']"> @@ -3362,18 +3540,25 @@ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="requirement"> <fo:table-body> <xsl:apply-templates mode="requirement"/> </fo:table-body> </xsl:template><xsl:template match="*[local-name()='tr']" mode="requirement"> - <fo:table-row height="7mm"> - <xsl:if test="parent::*[local-name()='thead'] and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission'])"> - <xsl:attribute name="border">1pt solid black</xsl:attribute> + <fo:table-row height="7mm" border-bottom="0.5pt solid grey"> + <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) --> + <!-- <xsl:attribute name="border">1pt solid black</xsl:attribute> --> + <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute> </xsl:if> + <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')"> + <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute> + </xsl:if> + <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')"> + <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute> + </xsl:if> <xsl:apply-templates mode="requirement"/> </fo:table-row> </xsl:template><xsl:template match="*[local-name()='th']" mode="requirement"> - <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm" border="0.5pt solid black"> + <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" --> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@align"> <xsl:value-of select="@align"/> </xsl:when> @@ -3388,10 +3573,11 @@ <xsl:if test="@rowspan"> <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> + <xsl:call-template name="display-align"/> <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'"> <xsl:attribute name="padding-top">0.5mm</xsl:attribute> <xsl:attribute name="background-color">rgb(165, 165, 165)</xsl:attribute> </xsl:if> @@ -3403,11 +3589,11 @@ <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template><xsl:template match="*[local-name()='td']" mode="requirement"> - <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm" border="0.5pt solid black"> + <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" --> <xsl:if test="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']"> <xsl:attribute name="padding">0mm</xsl:attribute> <xsl:attribute name="padding-left">0mm</xsl:attribute> </xsl:if> <xsl:attribute name="text-align"> @@ -3416,20 +3602,24 @@ <xsl:value-of select="@align"/> </xsl:when> <xsl:otherwise>left</xsl:otherwise> </xsl:choose> </xsl:attribute> + <xsl:if test="following-sibling::*[local-name()='td'] and not(preceding-sibling::*[local-name()='td'])"> + <xsl:attribute name="font-weight">bold</xsl:attribute> + </xsl:if> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@rowspan"> <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> + <xsl:call-template name="display-align"/> <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'"> <xsl:attribute name="padding-left">0.5mm</xsl:attribute> <xsl:attribute name="padding-top">0.5mm</xsl:attribute> <xsl:if test="parent::*[local-name()='tr']/preceding-sibling::*[local-name()='tr'] and not(*[local-name()='table'])"> @@ -3441,11 +3631,11 @@ <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2"> - <fo:block font-size="11pt" font-weight="bold"> <!-- margin-bottom="4pt" text-align="center" --> + <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" --> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]"> <fo:block> <!-- margin-bottom="10pt" --> <xsl:apply-templates/> @@ -3467,16 +3657,17 @@ <fo:block id="{@id}" xsl:use-attribute-sets="example-style"> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> <xsl:variable name="element"> - block + block + <xsl:if test=".//*[local-name() = 'table']">block</xsl:if> </xsl:variable> <xsl:choose> - <xsl:when test="normalize-space($element) = 'block'"> + <xsl:when test="contains(normalize-space($element), 'block')"> <fo:block xsl:use-attribute-sets="example-body-style"> <xsl:apply-templates/> </fo:block> </xsl:when> <xsl:otherwise> @@ -3509,29 +3700,48 @@ <xsl:apply-templates/> </fo:inline> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']"> - <fo:block xsl:use-attribute-sets="example-p-style"> + </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']"> + + <xsl:variable name="element"> + block - <xsl:apply-templates/> - </fo:block> + </xsl:variable> + <xsl:choose> + <xsl:when test="normalize-space($element) = 'block'"> + <fo:block xsl:use-attribute-sets="example-p-style"> + + <xsl:apply-templates/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <fo:inline xsl:use-attribute-sets="example-p-style"> + <xsl:apply-templates/> + </fo:inline> + </xsl:otherwise> + </xsl:choose> </xsl:template><xsl:template match="*[local-name() = 'termsource']"> <fo:block xsl:use-attribute-sets="termsource-style"> <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] --> <xsl:variable name="termsource_text"> <xsl:apply-templates/> </xsl:variable> + <xsl:choose> <xsl:when test="starts-with(normalize-space($termsource_text), '[')"> <xsl:apply-templates/> </xsl:when> - <xsl:otherwise> - <xsl:text>[</xsl:text> - <xsl:apply-templates/> - <xsl:text>]</xsl:text> + <xsl:otherwise> + + <xsl:text>[</xsl:text> + + <xsl:apply-templates/> + + <xsl:text>]</xsl:text> + </xsl:otherwise> </xsl:choose> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()"> <xsl:if test="normalize-space() != ''"> @@ -3548,22 +3758,33 @@ <fo:inline><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template match="*[local-name() = 'modification']/text()"> <xsl:if test="normalize-space() != ''"> <xsl:value-of select="."/> </xsl:if> - </xsl:template><xsl:template match="*[local-name() = 'quote']"> + </xsl:template><xsl:template match="*[local-name() = 'quote']"> + <fo:block-container margin-left="0mm"> + <xsl:if test="parent::*[local-name() = 'note']"> + <xsl:if test="not(ancestor::*[local-name() = 'table'])"> + <xsl:attribute name="margin-left">5mm</xsl:attribute> + </xsl:if> + </xsl:if> + + <fo:block-container margin-left="0mm"> - <fo:block xsl:use-attribute-sets="quote-style"> - <xsl:apply-templates select=".//*[local-name() = 'p']"/> - </fo:block> - <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']"> - <fo:block xsl:use-attribute-sets="quote-source-style"> - <!-- — ISO, ISO 7301:2011, Clause 1 --> - <xsl:apply-templates select="*[local-name() = 'author']"/> - <xsl:apply-templates select="*[local-name() = 'source']"/> - </fo:block> - </xsl:if> + <fo:block xsl:use-attribute-sets="quote-style"> + <xsl:apply-templates select=".//*[local-name() = 'p']"/> + </fo:block> + <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']"> + <fo:block xsl:use-attribute-sets="quote-source-style"> + <!-- — ISO, ISO 7301:2011, Clause 1 --> + <xsl:apply-templates select="*[local-name() = 'author']"/> + <xsl:apply-templates select="*[local-name() = 'source']"/> + </fo:block> + </xsl:if> + + </fo:block-container> + </fo:block-container> </xsl:template><xsl:template match="*[local-name() = 'source']"> <xsl:if test="../*[local-name() = 'author']"> <xsl:text>, </xsl:text> </xsl:if> <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> @@ -3587,10 +3808,11 @@ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> <xsl:if test="@type = 'inline'"> + </xsl:if> <xsl:apply-templates/> </fo:basic-link> @@ -3627,10 +3849,11 @@ + </xsl:variable> <xsl:variable name="padding-right"> <xsl:choose> <xsl:when test="normalize-space($padding) = ''">0</xsl:when> @@ -3741,10 +3964,25 @@ <!-- <fo:block font-weight="bold">Review:</fo:block> <xsl:apply-templates /> --> </xsl:template><xsl:template match="*[local-name() = 'name']/text()"> <!-- 0xA0 to space replacement --> <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/> + </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']"> + <fo:block-container margin-left="0mm"> + <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"> + <xsl:apply-templates select="." mode="ul_ol"/> + </fo:block-container> + </fo:block-container> </xsl:template><xsl:template match="*[local-name() = 'errata']"> <!-- <row> <date>05-07-2013</date> <type>Editorial</type> <change>Changed CA-9 Priority Code from P1 to P2 in <xref target="tabled2"/>.</change> @@ -3773,10 +4011,31 @@ </xsl:template><xsl:template match="*[local-name() = 'errata']/*[local-name() = 'row']/*"> <fo:table-cell border="1pt solid black" padding-left="1mm" padding-top="0.5mm"> <fo:block><xsl:apply-templates/></fo:block> </fo:table-cell> </xsl:template><xsl:template name="processBibitem"> + + + + </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: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> + </xsl:if> + <xsl:value-of select="$_doc_ident"/> + </xsl:when> + <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:otherwise> + </xsl:choose> </xsl:template><xsl:template name="processPersonalAuthor"> <xsl:choose> <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']"> <author> <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/> \ No newline at end of file