lib/isodoc/gb/gb.recommendation.xsl in metanorma-gb-1.5.4 vs lib/isodoc/gb/gb.recommendation.xsl in metanorma-gb-1.5.5

- old
+ new

@@ -818,11 +818,11 @@ </fo:footnote> </xsl:template> - <xsl:template match="gb:ul | gb:ol"> + <xsl:template match="gb:ul | gb:ol" mode="ul_ol"> <fo:list-block margin-bottom="12pt" margin-left="7.4mm" provisional-distance-between-starts="4mm"> <!-- margin-bottom="8pt" --> <xsl:if test="local-name() = 'ol'"> <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute> </xsl:if> <xsl:apply-templates/> @@ -848,10 +848,13 @@ </fo:block> </fo:list-item-body> </fo:list-item> </xsl:template> + <xsl:template match="gb:note" mode="process"> + <xsl:call-template name="note"/> + </xsl:template> <xsl:template match="gb:preferred" priority="2"> <fo:inline font-family="SimHei" font-size="11pt"> @@ -995,12 +998,16 @@ </xsl:template> <xsl:template match="mathml:math" priority="2"> <fo:inline font-family="Cambria 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="."/> + <!-- <xsl:copy-of select="."/> --> + <xsl:copy-of select="xalan:nodeset($mathml)"/> </fo:instream-foreign-object> </fo:inline> </xsl:template> @@ -1029,14 +1036,17 @@ </fo:block> </xsl:template> <xsl:template match="gb:formula/gb:stem"> - <fo:block font-size="11pt" margin-top="14pt" margin-bottom="14pt"> - <fo:table table-layout="fixed" width="170mm"> - <fo:table-column column-width="165mm"/> - <fo:table-column column-width="5mm"/> + <fo:block margin-top="14pt" margin-bottom="14pt"> + <xsl:if test="not(ancestor::*[local-name()='note'])"> + <xsl:attribute name="font-size">11pt</xsl:attribute> + </xsl:if> + <fo:table table-layout="fixed" width="100%"> <!-- width="170mm" --> + <fo:table-column column-width="95%"/><!-- 165mm --> + <fo:table-column column-width="5%"/> <!-- 5mm --> <fo:table-body> <fo:table-row> <fo:table-cell display-align="center"> <fo:block text-align="center"> <xsl:apply-templates/> @@ -1158,11 +1168,16 @@ <title-modified lang="zh">改写</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> @@ -1201,10 +1216,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> @@ -1218,25 +1237,26 @@ </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">9pt</xsl:attribute> + <xsl:attribute name="font-family">Courier</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</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"> @@ -1283,10 +1303,11 @@ + </xsl:attribute-set><xsl:attribute-set name="example-body-style"> </xsl:attribute-set><xsl:attribute-set name="example-name-style"> @@ -1303,10 +1324,11 @@ + </xsl:attribute-set><xsl:attribute-set name="example-p-style"> @@ -1370,15 +1392,17 @@ </xsl:attribute-set><xsl:attribute-set name="xref-style"> - + + </xsl:attribute-set><xsl:attribute-set name="eref-style"> + </xsl:attribute-set><xsl:attribute-set name="note-style"> <xsl:attribute name="font-size">9pt</xsl:attribute> @@ -1395,25 +1419,25 @@ + </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 name="font-family">SimHei</xsl:attribute> - <xsl:attribute name="font-family">SimHei</xsl:attribute> - + </xsl:attribute-set><xsl:attribute-set name="note-p-style"> <xsl:attribute name="margin-top">4pt</xsl:attribute> @@ -1434,10 +1458,12 @@ + </xsl:attribute-set><xsl:attribute-set name="termnote-name-style"> + </xsl:attribute-set><xsl:attribute-set name="quote-style"> <xsl:attribute name="margin-top">12pt</xsl:attribute> <xsl:attribute name="margin-left">12mm</xsl:attribute> @@ -1462,17 +1488,19 @@ </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-family">SimHei</xsl:attribute> <xsl:attribute name="text-align">center</xsl:attribute> <xsl:attribute name="margin-top">12pt</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> @@ -1512,18 +1540,20 @@ </xsl:attribute-set><xsl:attribute-set name="tt-style"> - <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-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 name="padding-left">7.4mm</xsl:attribute> </xsl:attribute-set><xsl:attribute-set name="admitted-style"> @@ -1585,10 +1615,12 @@ + <!-- $namespace = 'iso' or --> + <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> <xsl:call-template name="fn_name_display"/> @@ -1644,14 +1676,14 @@ + - <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"> @@ -1663,10 +1695,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> @@ -1695,12 +1729,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)"/> @@ -1812,14 +1847,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"> @@ -1879,19 +1929,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> @@ -1913,10 +1967,12 @@ </xsl:if> <xsl:attribute name="min-height">0mm</xsl:attribute> <xsl:attribute name="line-height">110%</xsl:attribute> + + <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"> @@ -1935,24 +1991,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"> @@ -1972,22 +2041,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"> @@ -2176,153 +2246,170 @@ <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="vertical-align">super</xsl:attribute> + <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id--> <xsl:value-of select="@reference"/> </fo:basic-link> </fo:inline> </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"> - - <xsl:if test="$parent = 'figure' or $parent = 'formula'">true</xsl:if> - <!-- 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> - <fo:block text-align="left"> + <xsl:attribute name="margin-left">0mm</xsl:attribute> + + </xsl:if> + <fo:block-container margin-left="0mm"> + + <xsl:variable name="parent" select="local-name(..)"/> + + <xsl:variable name="key_iso"> + + <xsl:if test="$parent = 'figure' or $parent = 'formula'">true</xsl:if> + <!-- 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 text-align="left"> + + + <xsl:attribute name="margin-left">7.4mm</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> + <fo:block> + + <xsl:attribute name="text-indent">7.4mm</xsl:attribute> + + <xsl:apply-templates select="*[local-name()='dt']/*"/> + — + <xsl:text> </xsl:text> + <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/> + </fo:block> - <xsl:attribute name="margin-left">7.4mm</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 = 'formula'"> <!-- a few components --> + <fo:block margin-bottom="12pt" text-align="left"> + + + + + <xsl:attribute name="margin-left">7.4mm</xsl:attribute> + <xsl:attribute name="margin-bottom">0pt</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:attribute name="margin-bottom">0pt</xsl:attribute> + <xsl:attribute name="text-indent">7.4mm</xsl:attribute> + + <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:attribute name="text-indent">7.4mm</xsl:attribute> - <xsl:apply-templates select="*[local-name()='dt']/*"/> - — - <xsl:text> </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-left">7.4mm</xsl:attribute> - <xsl:attribute name="margin-bottom">0pt</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:attribute name="margin-bottom">0pt</xsl:attribute> - <xsl:attribute name="text-indent">7.4mm</xsl:attribute> - - <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> - - - - - <fo:block> - - - <xsl:attribute name="margin-left">7.4mm</xsl:attribute> - <xsl:if test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> - <xsl:attribute name="margin-left">15mm</xsl:attribute> - </xsl:if> - - - - <fo:table width="95%" table-layout="fixed"> - <xsl:attribute name="margin-left">-3.7mm</xsl:attribute> - <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> + <fo:block> + + + <xsl:attribute name="margin-left">7.4mm</xsl:attribute> + <xsl:if test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> + <xsl:attribute name="margin-left">15mm</xsl:attribute> + </xsl:if> + + + + <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:attribute name="margin-left">-3.7mm</xsl:attribute> + + <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 --> @@ -2415,10 +2502,11 @@ </xsl:template><xsl:template match="*[local-name()='dt']"> <xsl:param name="key_iso"/> <fo:table-row> + <fo:table-cell> <fo:block margin-top="6pt"> @@ -2494,10 +2582,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"> + + + 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:inline> </xsl:template><xsl:template match="*[local-name()='del']"> <fo:inline font-size="10pt" color="red" text-decoration="line-through"> <xsl:apply-templates/> @@ -2820,14 +2933,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:'))"/> @@ -2904,13 +3030,28 @@ <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:attribute name="margin-left">0mm</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']"> @@ -2974,11 +3115,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"> @@ -3149,25 +3292,67 @@ <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:attribute name="margin-left">0mm</xsl:attribute> + + </xsl:if> + <fo:block-container margin-left="0mm"> + + <fo:block xsl:use-attribute-sets="sourcecode-style"> + <xsl:variable name="_font-size"> + + + 9 + + + + + + + + + + + + </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"> @@ -3237,23 +3422,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']"> @@ -3272,18 +3457,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> @@ -3298,10 +3490,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> @@ -3313,11 +3506,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"> @@ -3326,20 +3519,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'])"> @@ -3351,11 +3548,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/> @@ -3377,16 +3574,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> @@ -3419,29 +3617,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() != ''"> @@ -3458,22 +3675,35 @@ <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> + + <xsl:attribute name="margin-left">0mm</xsl:attribute> + + <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}"> @@ -3497,10 +3727,11 @@ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> <xsl:if test="@type = 'inline'"> + </xsl:if> <xsl:apply-templates/> </fo:basic-link> @@ -3529,10 +3760,11 @@ + </xsl:variable> <xsl:variable name="padding-right"> <xsl:choose> <xsl:when test="normalize-space($padding) = ''">0</xsl:when> @@ -3648,10 +3880,27 @@ <!-- <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:attribute name="margin-left">0mm</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> @@ -3680,10 +3929,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