lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.2.4 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.2.5

- old
+ new

@@ -979,11 +979,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-toc lang="zh">Contents</title-toc> @@ -1067,14 +1072,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> @@ -1224,10 +1238,11 @@ + </xsl:attribute-set><xsl:attribute-set name="appendix-style"> </xsl:attribute-set><xsl:attribute-set name="appendix-example-style"> @@ -1468,10 +1483,12 @@ + + <!-- $namespace = 'iso' or --> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> @@ -1505,10 +1522,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> @@ -1526,39 +1544,61 @@ </xsl:variable> <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm"> + + + + - <xsl:attribute name="space-after">18pt</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="margin-left">0mm</attribute> + <attribute name="margin-right">0mm</attribute> - - - - - - - <xsl:attribute name="margin-left">0mm</xsl:attribute> - <xsl:attribute name="margin-right">0mm</xsl: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: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> @@ -1577,14 +1617,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"> @@ -1641,10 +1708,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"/> @@ -1700,15 +1774,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 --> @@ -1730,10 +1807,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> @@ -1750,15 +1834,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"/> @@ -1768,10 +1856,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']"> @@ -1820,13 +1986,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"> @@ -1845,10 +2011,11 @@ + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -1886,17 +2053,18 @@ <!-- and ancestor::*[local-name() = 'thead'] --> <xsl:attribute name="padding-top">0.5mm</xsl:attribute> - + + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -1918,21 +2086,24 @@ <xsl:attribute name="font-size">12pt</xsl:attribute> + + <fo:inline padding-right="2mm"> <xsl:attribute name="font-size">11pt</xsl:attribute> <xsl:attribute name="padding-right">3mm</xsl:attribute> - + <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/> @@ -1952,25 +2123,29 @@ <fo:block margin-bottom="12pt"> + <fo:inline font-size="80%" padding-right="5mm" id="{@id}"> <xsl:attribute name="vertical-align">super</xsl:attribute> + <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"> @@ -2003,11 +2178,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> @@ -2068,11 +2256,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> @@ -2087,13 +2276,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/> @@ -2191,11 +2383,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> @@ -2338,10 +2543,11 @@ <xsl:attribute name="margin-top">0pt</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> + <xsl:apply-templates/> <!-- <xsl:if test="$namespace = 'gb'"> <xsl:if test="ancestor::*[local-name()='formula']"> <xsl:text>—</xsl:text> </xsl:if> @@ -2404,23 +2610,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"> - - - + + + 10 - - + + </xsl:variable> <xsl:variable name="font-size" select="normalize-space($_font-size)"/> <xsl:if test="$font-size != ''"> <xsl:attribute name="font-size"> @@ -2753,11 +2959,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="."/> --> @@ -2847,11 +3053,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']"> @@ -3057,22 +3263,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> @@ -3110,10 +3307,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"/> @@ -3124,11 +3335,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"/> @@ -3760,10 +3971,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/> @@ -3795,10 +4007,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> @@ -4075,10 +4288,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']"/> @@ -4095,14 +4309,16 @@ <dc:creator> <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/> + </dc:creator> <dc:description> <xsl:variable name="abstract"> <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/> + </xsl:variable> \ No newline at end of file