lib/isodoc/mpfa/mpfd.circular.xsl in metanorma-mpfa-0.5.4 vs lib/isodoc/mpfa/mpfd.circular.xsl in metanorma-mpfa-0.5.5

- old
+ new

@@ -808,11 +808,16 @@ <xsl:text>Contents</xsl:text> </title-toc> - <title-toc lang="fr">Sommaire</title-toc> + <title-toc lang="fr"> + + <xsl:text>Sommaire</xsl:text> + + + </title-toc> <title-page lang="en">Page</title-page> <title-page lang="fr">Page</title-page> @@ -894,14 +899,23 @@ <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:param name="lang"/> + <xsl:variable name="lang_"> + <xsl:choose> + <xsl:when test="$lang != ''"> + <xsl:value-of select="$lang"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="getLang"/> + </xsl:otherwise> + </xsl:choose> </xsl:variable> - <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/> + <xsl:variable name="language" select="normalize-space($lang_)"/> + <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $language]"/> <xsl:choose> <xsl:when test="normalize-space($title_) != ''"> <xsl:value-of select="$title_"/> </xsl:when> <xsl:otherwise> @@ -1034,15 +1048,16 @@ - + <xsl:attribute name="text-align">center</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> <xsl:attribute name="font-size">11pt</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="appendix-style"> </xsl:attribute-set><xsl:attribute-set name="appendix-example-style"> @@ -1259,10 +1274,12 @@ + + <!-- $namespace = 'iso' or --> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> @@ -1296,10 +1313,11 @@ <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="table" select="$simple-table"/> </xsl:call-template> </xsl:variable> + <!-- colwidths=<xsl:copy-of select="$colwidths"/> --> <!-- <xsl:variable name="colwidths2"> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="$cols-count"/> </xsl:call-template> @@ -1317,39 +1335,61 @@ </xsl:variable> <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm"> + + + + - <xsl:attribute name="space-after">12pt</xsl:attribute> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</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:variable name="table_attributes"> + <attribute name="table-layout">fixed</attribute> + <attribute name="width">100%</attribute> + <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute> + <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute> + + + + <attribute name="border-top">2pt solid black</attribute> + <attribute name="border-bottom">2pt solid black</attribute> + + </xsl:variable> + + + <fo:table id="{@id}" table-omit-footer-at-break="true"> + <xsl:for-each select="xalan:nodeset($table_attributes)/attribute"> + <xsl:attribute name="{@name}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> + <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/> + <xsl:if test="$isNoteOrFnExist = 'true'"> + <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer --> + </xsl:if> - - - - <xsl:attribute name="border-top">2pt solid black</xsl:attribute> - <xsl:attribute name="border-bottom">2pt solid black</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> @@ -1368,14 +1408,41 @@ </xsl:otherwise> </xsl:choose> </fo:table> + <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody --> + <xsl:call-template name="insertTableFooterInSeparateTable"> + <xsl:with-param name="table_attributes" select="$table_attributes"/> + <xsl:with-param name="colwidths" select="$colwidths"/> + </xsl:call-template> + </xsl:for-each> + <!-- insert footer as table --> + <!-- <fo:table> + <xsl:for-each select="xalan::nodeset($table_attributes)/attribute"> + <xsl:attribute name="{@name}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> + + <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> + <xsl:otherwise> + <fo:table-column column-width="proportional-column-width({.})"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </fo:table>--> + + </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"> @@ -1432,10 +1499,17 @@ </xsl:when> <xsl:otherwise> <xsl:for-each select="xalan:nodeset($table)//tr"> <xsl:variable name="td_text"> <xsl:apply-templates select="td[$curr-col]" mode="td_text"/> + + <!-- <xsl:if test="$namespace = 'bipm'"> + <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']"> + <word><xsl:value-of select="normalize-space(.)"/></word> + </xsl:for-each> + </xsl:if> --> + </xsl:variable> <xsl:variable name="words"> <xsl:variable name="string_with_added_zerospaces"> <xsl:call-template name="add-zero-spaces-java"> <xsl:with-param name="text" select="$td_text"/> @@ -1491,15 +1565,18 @@ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text> </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text"> <xsl:value-of select="*[local-name()='origin']/@citeas"/> </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text"> <xsl:value-of select="@target"/> + </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text"> + <xsl:variable name="math_text" select="normalize-space(.)"/> + <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces --> </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> - + <xsl:apply-templates/> </fo:table-header> </xsl:template><xsl:template name="table-header-title"> <xsl:param name="cols-count"/> <!-- row for title --> @@ -1521,10 +1598,17 @@ </fo:table-body> </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process"> <xsl:apply-templates/> </xsl:template><xsl:template name="insertTableFooter"> <xsl:param name="cols-count"/> + <xsl:if test="../*[local-name()='tfoot']"> + <fo:table-footer> + <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> + </fo:table-footer> + </xsl:if> + </xsl:template><xsl:template name="insertTableFooter2"> + <xsl:param name="cols-count"/> <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/> <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'"> <fo:table-footer> @@ -1541,15 +1625,19 @@ <!-- fn will be processed inside 'note' processing --> - <!-- except gb --> + <!-- except gb and bipm --> + <xsl:apply-templates select="../*[local-name()='note']" mode="process"/> + + + <!-- horizontal row separator --> <!-- fn processing --> <xsl:call-template name="fn_display"/> @@ -1559,10 +1647,88 @@ </xsl:if> </fo:table-footer> </xsl:if> + </xsl:template><xsl:template name="insertTableFooterInSeparateTable"> + <xsl:param name="table_attributes"/> + <xsl:param name="colwidths"/> + + <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/> + + <xsl:if test="$isNoteOrFnExist = 'true'"> + + <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/> + + <fo:table keep-with-previous="always"> + <xsl:for-each select="xalan:nodeset($table_attributes)/attribute"> + <xsl:choose> + <xsl:when test="@name = 'border-top'"> + <xsl:attribute name="{@name}">0pt solid black</xsl:attribute> + </xsl:when> + <xsl:when test="@name = 'border'"> + <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute> + <xsl:attribute name="border-top">0pt solid black</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + + <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> + <xsl:otherwise> + <fo:table-column column-width="proportional-column-width({.})"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + + <fo:table-body> + <fo:table-row> + <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}"> + + + + <!-- fn will be processed inside 'note' processing --> + + + + <!-- except gb and bipm --> + + <xsl:apply-templates select="../*[local-name()='note']" mode="process"/> + + + <!-- <xsl:if test="$namespace = 'bipm'"> + <xsl:choose> + <xsl:when test="ancestor::*[local-name()='preface']"> + show Note under table in preface (ex. abstract) sections + <xsl:apply-templates select="../*[local-name()='note']" mode="process"/> + </xsl:when> + <xsl:otherwise> + empty, because notes show at page side in main sections + <fo:block/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> --> + + + <!-- horizontal row separator --> + + + <!-- fn processing --> + <xsl:call-template name="fn_display"/> + + </fo:table-cell> + </fo:table-row> + </fo:table-body> + + </fo:table> + </xsl:if> </xsl:template><xsl:template match="*[local-name()='tbody']"> <xsl:variable name="cols-count"> <xsl:choose> <xsl:when test="../*[local-name()='thead']"> @@ -1611,13 +1777,13 @@ <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"> <xsl:attribute name="text-align"> @@ -1637,12 +1803,13 @@ <xsl:attribute name="border-top">solid black 2pt</xsl:attribute> - <xsl:attribute name="border-bottom">solid black 2pt</xsl:attribute> + <xsl:attribute name="border-bottom">solid black 2pt</xsl:attribute> + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -1678,17 +1845,18 @@ </xsl:choose> </xsl:attribute> - + + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -1708,18 +1876,21 @@ <fo:block font-size="10pt" margin-bottom="12pt"> + + <fo:inline padding-right="2mm"> - + <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/> </fo:inline> + <xsl:apply-templates mode="process"/> </fo:block> </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process"> <xsl:apply-templates/> @@ -1739,23 +1910,27 @@ <fo:block margin-bottom="12pt"> + <fo:inline font-size="80%" padding-right="5mm" id="{@id}"> + <xsl:value-of select="@reference"/> + </fo:inline> <fo:inline> - <xsl:apply-templates/> + <!-- <xsl:apply-templates /> --> + <xsl:copy-of select="./node()"/> </fo:inline> </fo:block> </xsl:if> </xsl:for-each> </xsl:template><xsl:template name="fn_name_display"> @@ -1788,11 +1963,24 @@ <!-- current hierarchy is 'figure' element --> <xsl:variable name="following_dl_colwidths"> <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' --> <xsl:variable name="html-table"> - <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> + <xsl:variable name="doc_ns"> + + </xsl:variable> + <xsl:variable name="ns"> + <xsl:choose> + <xsl:when test="normalize-space($doc_ns) != ''"> + <xsl:value-of select="normalize-space($doc_ns)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(name(/*), '-')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> --> <xsl:element name="{$ns}:table"> <xsl:for-each select="*[local-name() = 'dl'][1]"> <tbody> <xsl:apply-templates mode="dl"/> </tbody> @@ -1853,11 +2041,12 @@ <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="margin-bottom">0</xsl:attribute> </xsl:if> - <xsl:apply-templates/> + <!-- <xsl:apply-templates /> --> + <xsl:copy-of select="./node()"/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:if> </xsl:for-each> @@ -1872,13 +2061,16 @@ + <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/> @@ -1972,11 +2164,24 @@ </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:variable name="doc_ns"> + + </xsl:variable> + <xsl:variable name="ns"> + <xsl:choose> + <xsl:when test="normalize-space($doc_ns) != ''"> + <xsl:value-of select="normalize-space($doc_ns)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(name(/*), '-')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> --> <xsl:element name="{$ns}:table"> <tbody> <xsl:apply-templates mode="dl"/> </tbody> </xsl:element> @@ -2116,10 +2321,11 @@ + <xsl:apply-templates/> <!-- <xsl:if test="$namespace = 'gb'"> <xsl:if test="ancestor::*[local-name()='formula']"> <xsl:text>—</xsl:text> </xsl:if> @@ -2182,23 +2388,23 @@ <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"> @@ -2531,11 +2737,11 @@ </xsl:template><xsl:template name="capitalize"> <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: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="."/> --> @@ -2625,11 +2831,11 @@ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise> </xsl:choose> <xsl:apply-templates/> </xsl:template><xsl:template match="*[local-name() = 'xref']"> <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-container margin-left="0mm"> <xsl:if test="parent::*[local-name() = 'note']"> @@ -2831,22 +3037,13 @@ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1"> <xsl:for-each select="xalan:nodeset($contents)/doc"> <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide"> <fo:bookmark-title> <xsl:variable name="bookmark-title_"> - <xsl:choose> - <xsl:when test="@lang = 'en'"> - - - </xsl:when> - <xsl:when test="@lang = 'fr'"> - - - </xsl:when> - <xsl:when test="@lang = 'de'">Deutsche</xsl:when> - <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise> - </xsl:choose> + <xsl:call-template name="getLangVersion"> + <xsl:with-param name="lang" select="@lang"/> + </xsl:call-template> </xsl:variable> <xsl:choose> <xsl:when test="normalize-space($bookmark-title_) != ''"> <xsl:value-of select="normalize-space($bookmark-title_)"/> </xsl:when> @@ -2884,10 +3081,24 @@ </fo:bookmark-tree> </xsl:if> + </xsl:template><xsl:template name="getLangVersion"> + <xsl:param name="lang"/> + <xsl:choose> + <xsl:when test="$lang = 'en'"> + + + </xsl:when> + <xsl:when test="$lang = 'fr'"> + + + </xsl:when> + <xsl:when test="$lang = 'de'">Deutsche</xsl:when> + <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise> + </xsl:choose> </xsl:template><xsl:template match="item" mode="bookmark"> <fo:bookmark internal-destination="{@id}" starting-state="hide"> <fo:bookmark-title> <xsl:if test="@section != ''"> <xsl:value-of select="@section"/> @@ -2898,11 +3109,11 @@ <xsl:apply-templates mode="bookmark"/> </fo:bookmark> </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation"> <xsl:if test="normalize-space() != ''"> <fo:block xsl:use-attribute-sets="figure-name-style"> - + <xsl:apply-templates/> </fo:block> </xsl:if> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item"> <xsl:apply-templates mode="contents_item"/> @@ -3524,10 +3735,11 @@ <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'clause']"> <fo:block> <xsl:call-template name="setId"/> + <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'definitions']"> <fo:block id="{@id}"> <xsl:apply-templates/> @@ -3559,10 +3771,11 @@ <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-container margin-left="0mm"> <fo:block> <xsl:apply-templates select="." mode="ul_ol"/> </fo:block> </fo:block-container> @@ -3740,10 +3953,11 @@ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""> <!-- Dublin Core properties go here --> <dc:title> <xsl:variable name="title"> + <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/> @@ -3758,12 +3972,14 @@ </xsl:choose> </dc:title> <dc:creator> + </dc:creator> <dc:description> <xsl:variable name="abstract"> + </xsl:variable> \ No newline at end of file