lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-2.2.10 vs lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-2.2.11

- old
+ new

@@ -972,11 +972,11 @@ </xsl:otherwise> </xsl:choose> <fo:flow flow-name="xsl-region-body"> - <xsl:if test="/itu:itu-standard/itu:preface/* or /itu:itu-standard/itu:bibdata/itu:keyword"> + <xsl:if test="/itu:itu-standard/itu:preface/*[not(@type = 'toc')] or /itu:itu-standard/itu:bibdata/itu:keyword"> <fo:block-container font-size="14pt" font-weight="bold"> <xsl:choose> <xsl:when test="$doctype = 'implementers-guide'"/> <xsl:when test="$doctype = 'recommendation-supplement'"> <fo:block> @@ -1036,116 +1036,14 @@ DEBUG contents=<xsl:copy-of select="$contents"/> <xsl:text disable-output-escaping="yes">--&gt;</xsl:text> </xsl:if> - <xsl:if test="$contents//item[@display = 'true'] and $doctype != 'resolution' and $doctype != 'service-publication'"> - <fo:block break-after="page"/> - <fo:block-container> - <fo:block role="TOC"> - <fo:block margin-top="6pt" text-align="center" font-weight="bold" role="H1"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">table_of_contents</xsl:with-param> - </xsl:call-template> - </fo:block> - <fo:block margin-top="6pt" text-align="end" font-weight="bold"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">Page.sg</xsl:with-param> - </xsl:call-template> - </fo:block> + <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']"> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> - <xsl:for-each select="$contents//item[@display = 'true']"> - <fo:block role="TOCI"> - <xsl:if test="@level = 1"> - <xsl:attribute name="margin-top">6pt</xsl:attribute> - </xsl:if> - <xsl:if test="@level &gt;= 2"> - <xsl:attribute name="margin-top">4pt</xsl:attribute> - <!-- <xsl:attribute name="margin-left">12mm</xsl:attribute> --> - </xsl:if> - <fo:list-block provisional-label-separation="3mm"> - <xsl:attribute name="provisional-distance-between-starts"> - <xsl:choose> - <xsl:when test="@section != ''"> - <xsl:if test="@level = 1"> - <xsl:choose> - <xsl:when test="string-length(@section) &gt; 10">27mm</xsl:when> - <xsl:when test="string-length(@section) &gt; 5">22mm</xsl:when> - <!-- <xsl:when test="@type = 'annex'">20mm</xsl:when> --> - <xsl:otherwise>12mm</xsl:otherwise> - </xsl:choose> - </xsl:if> - <xsl:if test="@level &gt;= 2"><xsl:value-of select="(@level - 1) * 26"/>mm</xsl:if> - </xsl:when> <!-- --> - <xsl:otherwise>0mm</xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <fo:list-item> - <fo:list-item-label end-indent="label-end()"> - <xsl:if test="@level &gt;= 2"> - <xsl:attribute name="start-indent"><xsl:value-of select="(@level - 1) * 12"/>mm</xsl:attribute> - </xsl:if> - <fo:block> - <xsl:if test="@section"> - <xsl:value-of select="@section"/> - </xsl:if> - </fo:block> - </fo:list-item-label> - <fo:list-item-body start-indent="body-start()"> - <fo:block text-align-last="justify"> - <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}"> - <xsl:apply-templates select="title"/> - <fo:inline keep-together.within-line="always"> - <fo:leader leader-pattern="dots"/> - <fo:page-number-citation ref-id="{@id}"/> - </fo:inline> - </fo:basic-link> - </fo:block> - </fo:list-item-body> - </fo:list-item> - </fo:list-block> - </fo:block> - </xsl:for-each> - - <!-- List of Tables --> - <xsl:if test="$contents//tables/table"> - <xsl:call-template name="insertListOf_Title"> - <xsl:with-param name="title" select="$title-list-tables"/> - </xsl:call-template> - <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">Page.sg</xsl:with-param> - </xsl:call-template> - </fo:block> - <fo:block-container> - <xsl:for-each select="$contents//tables/table"> - <xsl:call-template name="insertListOf_Item"/> - </xsl:for-each> - </fo:block-container> - </xsl:if> - - <!-- List of Figures --> - <xsl:if test="$contents//figures/figure"> - <xsl:call-template name="insertListOf_Title"> - <xsl:with-param name="title" select="$title-list-figures"/> - </xsl:call-template> - <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">Page.sg</xsl:with-param> - </xsl:call-template> - </fo:block> - <fo:block-container> - <xsl:for-each select="$contents//figures/figure"> - <xsl:call-template name="insertListOf_Item"/> - </xsl:for-each> - </fo:block-container> - </xsl:if> - - </fo:block> - </fo:block-container> - </xsl:if> - </fo:flow> </fo:page-sequence> <!-- BODY --> <fo:page-sequence master-reference="document" initial-page-number="1" force-page-count="no-force"> @@ -1256,10 +1154,131 @@ </fo:inline> </fo:basic-link> </fo:block> </xsl:template> + <xsl:template match="itu:preface/itu:clause[@type = 'toc']" priority="4"> + <xsl:param name="process">false</xsl:param> + + <xsl:if test="$process = 'true'"> + <xsl:if test="$doctype != 'resolution' and $doctype != 'service-publication'"> + <fo:block break-after="page"/> + <fo:block-container> + <fo:block role="TOC"> + + <xsl:apply-templates/> + + <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC --> + + <xsl:for-each select="$contents//item[@display = 'true']"> + <fo:block role="TOCI"> + <xsl:if test="@level = 1"> + <xsl:attribute name="margin-top">6pt</xsl:attribute> + </xsl:if> + <xsl:if test="@level &gt;= 2"> + <xsl:attribute name="margin-top">4pt</xsl:attribute> + <!-- <xsl:attribute name="margin-left">12mm</xsl:attribute> --> + </xsl:if> + <fo:list-block provisional-label-separation="3mm"> + <xsl:attribute name="provisional-distance-between-starts"> + <xsl:choose> + <xsl:when test="@section != ''"> + <xsl:if test="@level = 1"> + <xsl:choose> + <xsl:when test="string-length(@section) &gt; 10">27mm</xsl:when> + <xsl:when test="string-length(@section) &gt; 5">22mm</xsl:when> + <!-- <xsl:when test="@type = 'annex'">20mm</xsl:when> --> + <xsl:otherwise>12mm</xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@level &gt;= 2"><xsl:value-of select="(@level - 1) * 26"/>mm</xsl:if> + </xsl:when> <!-- --> + <xsl:otherwise>0mm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <xsl:if test="@level &gt;= 2"> + <xsl:attribute name="start-indent"><xsl:value-of select="(@level - 1) * 12"/>mm</xsl:attribute> + </xsl:if> + <fo:block> + <xsl:if test="@section"> + <xsl:value-of select="@section"/> + </xsl:if> + </fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block text-align-last="justify"> + <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}"> + <xsl:apply-templates select="title"/> + <fo:inline keep-together.within-line="always"> + <fo:leader leader-pattern="dots"/> + <fo:page-number-citation ref-id="{@id}"/> + </fo:inline> + </fo:basic-link> + </fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + </fo:block> + </xsl:for-each> + + <!-- List of Tables --> + <xsl:if test="$contents//tables/table"> + <xsl:call-template name="insertListOf_Title"> + <xsl:with-param name="title" select="$title-list-tables"/> + </xsl:call-template> + <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always"> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">Page.sg</xsl:with-param> + </xsl:call-template> + </fo:block> + <fo:block-container> + <xsl:for-each select="$contents//tables/table"> + <xsl:call-template name="insertListOf_Item"/> + </xsl:for-each> + </fo:block-container> + </xsl:if> + + <!-- List of Figures --> + <xsl:if test="$contents//figures/figure"> + <xsl:call-template name="insertListOf_Title"> + <xsl:with-param name="title" select="$title-list-figures"/> + </xsl:call-template> + <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always"> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">Page.sg</xsl:with-param> + </xsl:call-template> + </fo:block> + <fo:block-container> + <xsl:for-each select="$contents//figures/figure"> + <xsl:call-template name="insertListOf_Item"/> + </xsl:for-each> + </fo:block-container> + </xsl:if> + + </xsl:if> + </fo:block> + </fo:block-container> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template match="itu:preface/itu:clause[@type = 'toc']/itu:title" priority="4"> + <fo:block margin-top="6pt" text-align="center" font-weight="bold" role="H1"> + <!-- <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">table_of_contents</xsl:with-param> + </xsl:call-template> --> + <xsl:apply-templates/> + </fo:block> + <fo:block margin-top="6pt" text-align="end" font-weight="bold"> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">Page.sg</xsl:with-param> + </xsl:call-template> + </fo:block> + </xsl:template> + <xsl:template match="node()"> <xsl:apply-templates/> </xsl:template> <!-- ============================= --> @@ -1293,10 +1312,11 @@ </xsl:choose> </xsl:variable> <xsl:variable name="skip"> <xsl:choose> + <xsl:when test="@type = 'toc'">true</xsl:when> <xsl:when test="ancestor-or-self::itu:bibitem">true</xsl:when> <xsl:when test="ancestor-or-self::itu:term">true</xsl:when> <xsl:when test="@inline-header = 'true' and not(*[local-name() = 'title']/*[local-name() = 'tab'])">true</xsl:when> <xsl:otherwise>false</xsl:otherwise> </xsl:choose> @@ -2511,10 +2531,14 @@ <xsl:attribute-set name="link-style"> </xsl:attribute-set> + <xsl:template name="refine_link-style"> + + </xsl:template> <!-- refine_link-style --> + <xsl:attribute-set name="sourcecode-container-style"> </xsl:attribute-set> <xsl:attribute-set name="sourcecode-style"> @@ -2526,10 +2550,14 @@ <xsl:attribute name="margin-top">6pt</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_sourcecode-style"> + + </xsl:template> <!-- refine_sourcecode-style --> + <xsl:attribute-set name="pre-style"> <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> <xsl:attribute name="margin-top">6pt</xsl:attribute> @@ -2606,10 +2634,14 @@ <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="margin-top">12pt</xsl:attribute> </xsl:attribute-set> <!-- example-style --> + <xsl:template name="refine_example-style"> + + </xsl:template> <!-- refine_example-style --> + <xsl:attribute-set name="example-body-style"> </xsl:attribute-set> <!-- example-body-style --> <xsl:attribute-set name="example-name-style"> @@ -2625,10 +2657,14 @@ <xsl:attribute name="margin-top">12pt</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> </xsl:attribute-set> <!-- example-p-style --> + <xsl:template name="refine_example-p-style"> + + </xsl:template> <!-- refine_example-p-style --> + <xsl:attribute-set name="termexample-name-style"> </xsl:attribute-set> <!-- termexample-name-style --> <!-- ========================== --> @@ -2651,75 +2687,181 @@ <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="space-after">18pt</xsl:attribute> </xsl:attribute-set> <!-- table-container-style --> + <xsl:template name="refine_table-container-style"> + <xsl:param name="margin-side"/> + + <xsl:if test="$doctype = 'service-publication' and $lang != 'ar'"> + <xsl:attribute name="font-family">Calibri</xsl:attribute> + </xsl:if> + + <!-- end table block-container attributes --> + </xsl:template> <!-- refine_table-container-style --> + <xsl:attribute-set name="table-style"> <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute> <xsl:attribute name="table-layout">fixed</xsl:attribute> </xsl:attribute-set><!-- table-style --> + <xsl:template name="refine_table-style"> + <xsl:param name="margin-side"/> + + <xsl:call-template name="setBordersTableArray"/> + + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_table-style --> + <xsl:attribute-set name="table-name-style"> <xsl:attribute name="keep-with-next">always</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="text-align">center</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> </xsl:attribute-set> <!-- table-name-style --> + <xsl:template name="refine_table-name-style"> + <xsl:param name="continued"/> + + </xsl:template> <!-- refine_table-name-style --> + <xsl:attribute-set name="table-row-style"> <xsl:attribute name="min-height">4mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="table-header-row-style" use-attribute-sets="table-row-style"> <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_table-header-row-style"> + + <xsl:call-template name="setBordersTableArray"/> + + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="border-bottom">1.1pt solid black</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_table-header-row-style --> + <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style"> </xsl:attribute-set> + <xsl:template name="refine_table-footer-row-style"> + + </xsl:template> <!-- refine_table-footer-row-style --> + <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style"> </xsl:attribute-set> + <xsl:template name="refine_table-body-row-style"> + + <xsl:call-template name="setBordersTableArray"/> + + </xsl:template> <!-- refine_table-body-row-style --> + <xsl:attribute-set name="table-header-cell-style"> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="padding-left">1mm</xsl:attribute> <xsl:attribute name="padding-right">1mm</xsl:attribute> <xsl:attribute name="display-align">center</xsl:attribute> </xsl:attribute-set> <!-- table-header-cell-style --> + <xsl:template name="refine_table-header-cell-style"> + + <xsl:call-template name="setBordersTableArray"/> + + <xsl:if test="ancestor::*[local-name()='preface']"> + <xsl:if test="$doctype != 'service-publication'"> + <xsl:attribute name="border">solid black 0pt</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> + <xsl:attribute name="border-bottom">1pt solid black</xsl:attribute> + <xsl:attribute name="padding-top">1mm</xsl:attribute> + </xsl:if> + + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> + + <xsl:call-template name="setTableCellAttributes"/> + + </xsl:template> <!-- refine_table-header-cell-style --> + <xsl:attribute-set name="table-cell-style"> <xsl:attribute name="display-align">center</xsl:attribute> <xsl:attribute name="padding-left">1mm</xsl:attribute> <xsl:attribute name="padding-right">1mm</xsl:attribute> <xsl:attribute name="border">solid black 1pt</xsl:attribute> <xsl:attribute name="display-align">before</xsl:attribute> </xsl:attribute-set> <!-- table-cell-style --> + <xsl:template name="refine_table-cell-style"> + + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> + + <!-- bsi --> + + <xsl:call-template name="setBordersTableArray"/> + + <xsl:if test="ancestor::*[local-name()='preface']"> + <xsl:attribute name="border">solid black 0pt</xsl:attribute> + </xsl:if> + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> + <xsl:attribute name="padding-top">1mm</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_table-cell-style --> + <xsl:attribute-set name="table-footer-cell-style"> <xsl:attribute name="border">solid black 1pt</xsl:attribute> <xsl:attribute name="padding-left">1mm</xsl:attribute> <xsl:attribute name="padding-right">1mm</xsl:attribute> <xsl:attribute name="padding-top">1mm</xsl:attribute> </xsl:attribute-set> <!-- table-footer-cell-style --> + <xsl:template name="refine_table-footer-cell-style"> + + <xsl:if test="ancestor::*[local-name()='preface']"> + <xsl:if test="$doctype != 'service-publication'"> + <xsl:attribute name="border">solid black 0pt</xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="border">none</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_table-footer-cell-style --> + <xsl:attribute-set name="table-note-style"> <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> </xsl:attribute-set><!-- table-note-style --> + <xsl:template name="refine_table-note-style"> + + </xsl:template> <!-- refine_table-note-style --> + <xsl:attribute-set name="table-fn-style"> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> <xsl:attribute name="margin-bottom">2pt</xsl:attribute> <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute> @@ -2778,17 +2920,33 @@ <xsl:attribute-set name="dt-cell-style"> </xsl:attribute-set> + <xsl:template name="refine_dt-cell-style"> + + <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']"> + <xsl:attribute name="padding-right">3mm</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_dt-cell-style --> + <xsl:attribute-set name="dt-block-style"> <xsl:attribute name="margin-top">0pt</xsl:attribute> <xsl:attribute name="margin-top">6pt</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_dt-block-style"> + + <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']"> + <xsl:attribute name="text-align">right</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_dt-block-style --> + <xsl:attribute-set name="dl-name-style"> <xsl:attribute name="keep-with-next">always</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> @@ -2798,10 +2956,14 @@ <xsl:attribute-set name="dd-cell-style"> <xsl:attribute name="padding-left">2mm</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_dd-cell-style"> + + </xsl:template> <!-- refine_dd-cell-style --> + <!-- ========================== --> <!-- END Definition's list styles --> <!-- ========================== --> <xsl:attribute-set name="appendix-style"> @@ -2811,11 +2973,10 @@ <xsl:attribute-set name="appendix-example-style"> </xsl:attribute-set> <xsl:attribute-set name="xref-style"> - <xsl:attribute name="keep-together.within-line">always</xsl:attribute> <xsl:attribute name="color">blue</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> </xsl:attribute-set> @@ -2825,30 +2986,48 @@ <xsl:attribute name="color">blue</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_eref-style"> + <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets --> + <xsl:variable name="text" select="normalize-space()"/> + + </xsl:template> <!-- refine_eref-style --> + <xsl:attribute-set name="note-style"> <xsl:attribute name="font-size">11pt</xsl:attribute> <xsl:attribute name="space-before">4pt</xsl:attribute> <xsl:attribute name="text-align">justify</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_note-style"> + + </xsl:template> + <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:template name="refine_note-name-style"> + + </xsl:template> <!-- refine_note-name-style --> + <xsl:attribute-set name="table-note-name-style"> <xsl:attribute name="padding-right">2mm</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_table-note-name-style"> + + </xsl:template> <!-- refine_table-note-name-style --> + <xsl:attribute-set name="note-p-style"> <xsl:attribute name="space-before">4pt</xsl:attribute> </xsl:attribute-set> @@ -2857,14 +3036,22 @@ <xsl:attribute name="margin-top">4pt</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_termnote-style"> + + </xsl:template> <!-- refine_termnote-style --> + <xsl:attribute-set name="termnote-name-style"> </xsl:attribute-set> + <xsl:template name="refine_termnote-name-style"> + + </xsl:template> + <xsl:attribute-set name="termnote-p-style"> </xsl:attribute-set> <xsl:attribute-set name="quote-style"> @@ -2873,19 +3060,27 @@ <xsl:attribute name="margin-top">6pt</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_quote-style"> + + </xsl:template> + <xsl:attribute-set name="quote-source-style"> <xsl:attribute name="text-align">right</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="termsource-style"> </xsl:attribute-set> + <xsl:template name="refine_termsource-style"> + + </xsl:template> <!-- refine_termsource-style --> + <xsl:attribute-set name="termsource-text-style"> </xsl:attribute-set> <xsl:attribute-set name="origin-style"> @@ -2920,10 +3115,14 @@ <xsl:attribute name="space-after">6pt</xsl:attribute> <xsl:attribute name="keep-with-previous">always</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_figure-name-style"> + + </xsl:template> <!-- refine_figure-name-style --> + <xsl:attribute-set name="figure-source-style"> </xsl:attribute-set> <!-- Formula's styles --> @@ -2940,10 +3139,14 @@ <xsl:attribute name="margin-left">0mm</xsl:attribute> </xsl:attribute-set> <!-- formula-stem-block-style --> + <xsl:template name="refine_formula-stem-block-style"> + + </xsl:template> <!-- refine_formula-stem-block-style --> + <xsl:attribute-set name="formula-stem-number-style"> <xsl:attribute name="text-align">right</xsl:attribute> <xsl:attribute name="margin-left">0mm</xsl:attribute> @@ -2953,10 +3156,14 @@ <xsl:attribute-set name="image-style"> <xsl:attribute name="text-align">center</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_image-style"> + + </xsl:template> + <xsl:attribute-set name="figure-pseudocode-p-style"> <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="margin-top">6pt</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> @@ -3046,14 +3253,22 @@ <xsl:attribute name="font-size">11pt</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_mathml-style"> + + </xsl:template> + <xsl:attribute-set name="list-style"> </xsl:attribute-set> <!-- list-style --> + <xsl:template name="refine_list-style"> + + </xsl:template> <!-- refine_list-style --> + <xsl:attribute-set name="list-name-style"> <xsl:attribute name="keep-with-next">always</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> @@ -3061,18 +3276,30 @@ <xsl:attribute-set name="list-item-style"> </xsl:attribute-set> + <xsl:template name="refine_list-item-style"> + + </xsl:template> <!-- refine_list-item-style --> + <xsl:attribute-set name="list-item-label-style"> </xsl:attribute-set> + <xsl:template name="refine_list-item-label-style"> + + </xsl:template> <!-- refine_list-item-label-style --> + <xsl:attribute-set name="list-item-body-style"> </xsl:attribute-set> + <xsl:template name="refine_list-item-body-style"> + + </xsl:template> <!-- refine_list-item-body-style --> + <xsl:attribute-set name="toc-style"> <xsl:attribute name="line-height">135%</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="fn-reference-style"> @@ -3082,10 +3309,14 @@ <xsl:attribute name="vertical-align">super</xsl:attribute> <xsl:attribute name="color">blue</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_fn-reference-style"> + + </xsl:template> <!-- refine_fn-reference-style --> + <xsl:attribute-set name="fn-style"> <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="fn-num-style"> @@ -3106,19 +3337,31 @@ <xsl:attribute name="margin-bottom">12pt</xsl:attribute> <xsl:attribute name="text-align">justify</xsl:attribute> </xsl:attribute-set> + <xsl:template name="refine_fn-body-style"> + + <xsl:if test="$doctype = 'service-publication'"> + <xsl:attribute name="font-size">10pt</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_fn-body-style --> + <xsl:attribute-set name="fn-body-num-style"> <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute> <xsl:attribute name="font-size">85%</xsl:attribute> <xsl:attribute name="padding-right">2mm</xsl:attribute> <xsl:attribute name="baseline-shift">30%</xsl:attribute> </xsl:attribute-set> <!-- fn-body-num-style --> + <xsl:template name="refine_fn-body-num-style"> + + </xsl:template> <!-- refine_fn-body-num-style --> + <!-- admonition --> <xsl:attribute-set name="admonition-style"> <xsl:attribute name="border">0.5pt solid black</xsl:attribute> <xsl:attribute name="space-before">12pt</xsl:attribute> @@ -3785,16 +4028,14 @@ </xsl:choose> </xsl:variable> <fo:block-container xsl:use-attribute-sets="table-container-style"> - <xsl:if test="$doctype = 'service-publication' and $lang != 'ar'"> - <xsl:attribute name="font-family">Calibri</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_table-container-style"> + <xsl:with-param name="margin-side" select="$margin-side"/> + </xsl:call-template> - <!-- end table block-container attributes --> - <!-- display table's name before table for PAS inside block-container (2-columnn layout) --> <xsl:variable name="table_width_default">100%</xsl:variable> <xsl:variable name="table_width"> <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) --> @@ -3810,16 +4051,14 @@ <xsl:attribute name="margin-right">0mm</xsl:attribute> </xsl:if> <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute> - <xsl:call-template name="setBordersTableArray"/> + <xsl:call-template name="refine_table-style"> + <xsl:with-param name="margin-side" select="$margin-side"/> + </xsl:call-template> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> - </xsl:if> - </xsl:element> </xsl:variable> <xsl:if test="$isGenerateTableIF = 'true'"> <!-- to determine start of table --> @@ -3880,11 +4119,11 @@ <xsl:choose> <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']"> <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/> </xsl:when> <xsl:otherwise> - <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely --> + <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely --> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> @@ -3970,10 +4209,14 @@ <xsl:param name="continued"/> <xsl:if test="normalize-space() != ''"> <fo:block xsl:use-attribute-sets="table-name-style"> + <xsl:call-template name="refine_table-name-style"> + <xsl:with-param name="continued" select="$continued"/> + </xsl:call-template> + <xsl:choose> <xsl:when test="$continued = 'true'"> </xsl:when> <xsl:otherwise> @@ -4352,10 +4595,12 @@ <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:call-template name="refine_table-header-title-style"/> + <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']"> <xsl:with-param name="continued">true</xsl:with-param> </xsl:apply-templates> <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name --> @@ -4364,10 +4609,14 @@ </fo:table-cell> </fo:table-row> </xsl:template> <!-- table-header-title --> + <xsl:template name="refine_table-header-title-style"> + + </xsl:template> <!-- refine_table-header-title-style --> + <xsl:template match="*[local-name()='thead']" mode="process_tbody"> <fo:table-body> <xsl:apply-templates/> </fo:table-body> </xsl:template> @@ -4388,11 +4637,11 @@ <xsl:template name="insertTableFooterInSeparateTable"> <xsl:param name="table_attributes"/> <xsl:param name="colwidths"/> <xsl:param name="colgroup"/> - <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/> + <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/> <xsl:variable name="isNoteOrFnExistShowAfterTable"> </xsl:variable> @@ -4454,18 +4703,11 @@ <fo:table-body> <fo:table-row> <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}"> - <xsl:if test="ancestor::*[local-name()='preface']"> - <xsl:if test="$doctype != 'service-publication'"> - <xsl:attribute name="border">solid black 0pt</xsl:attribute> - </xsl:if> - </xsl:if> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="border">none</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_table-footer-cell-style"/> <xsl:call-template name="setBordersTableArray"/> <!-- fn will be processed inside 'note' processing --> @@ -4475,10 +4717,11 @@ <!-- for BSI (not PAS) display Notes before footnotes --> <!-- except gb and bsi --> + <xsl:apply-templates select="../*[local-name()='p']"/> <xsl:apply-templates select="../*[local-name()='dl']"/> <xsl:apply-templates select="../*[local-name()='note']"/> <xsl:apply-templates select="../*[local-name()='source']"/> <xsl:variable name="isDisplayRowSeparator"> @@ -4606,16 +4849,12 @@ <!-- ===================== --> <!-- row in table header (thead) thead/tr --> <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2"> <fo:table-row xsl:use-attribute-sets="table-header-row-style"> - <xsl:call-template name="setBordersTableArray"/> + <xsl:call-template name="refine_table-header-row-style"/> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="border-bottom">1.1pt solid black</xsl:attribute> - </xsl:if> - <xsl:call-template name="setTableRowAttributes"/> <xsl:apply-templates/> </fo:table-row> </xsl:template> @@ -4644,10 +4883,12 @@ <!-- row in table footer (tfoot), tfoot/tr --> <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2"> <fo:table-row xsl:use-attribute-sets="table-footer-row-style"> + <xsl:call-template name="refine_table-footer-row-style"/> + <xsl:call-template name="setTableRowAttributes"/> <xsl:apply-templates/> </fo:table-row> </xsl:template> @@ -4657,13 +4898,14 @@ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only --> <xsl:attribute name="keep-with-next">always</xsl:attribute> </xsl:if> - <xsl:call-template name="setBordersTableArray"/> + <xsl:call-template name="refine_table-body-row-style"/> <xsl:call-template name="setTableRowAttributes"/> + <xsl:apply-templates/> </fo:table-row> </xsl:template> <xsl:template name="setTableRowAttributes"> @@ -4682,29 +4924,12 @@ <fo:table-cell xsl:use-attribute-sets="table-header-cell-style"> <!-- text-align="{@align}" --> <xsl:call-template name="setTextAlignment"> <xsl:with-param name="default">center</xsl:with-param> </xsl:call-template> - <xsl:call-template name="setBordersTableArray"/> + <xsl:call-template name="refine_table-header-cell-style"/> - <xsl:if test="ancestor::*[local-name()='preface']"> - <xsl:if test="$doctype != 'service-publication'"> - <xsl:attribute name="border">solid black 0pt</xsl:attribute> - </xsl:if> - </xsl:if> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> - <xsl:attribute name="border-bottom">1pt solid black</xsl:attribute> - <xsl:attribute name="padding-top">1mm</xsl:attribute> - </xsl:if> - - <xsl:if test="$lang = 'ar'"> - <xsl:attribute name="padding-right">1mm</xsl:attribute> - </xsl:if> - - <xsl:call-template name="setTableCellAttributes"/> - <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template> <!-- cell in table header row - 'th' --> @@ -4741,26 +4966,12 @@ <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" --> <xsl:call-template name="setTextAlignment"> <xsl:with-param name="default">left</xsl:with-param> </xsl:call-template> - <xsl:if test="$lang = 'ar'"> - <xsl:attribute name="padding-right">1mm</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_table-cell-style"/> - <!-- bsi --> - - <xsl:call-template name="setBordersTableArray"/> - - <xsl:if test="ancestor::*[local-name()='preface']"> - <xsl:attribute name="border">solid black 0pt</xsl:attribute> - </xsl:if> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> - <xsl:attribute name="padding-top">1mm</xsl:attribute> - </xsl:if> - <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table --> <xsl:attribute name="padding-right">1mm</xsl:attribute> </xsl:if> <xsl:call-template name="setTableCellAttributes"/> @@ -4786,13 +4997,17 @@ <xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2"> <fo:block xsl:use-attribute-sets="table-note-style"> + <xsl:call-template name="refine_table-note-style"/> + <!-- Table's note name (NOTE, for example) --> <fo:inline xsl:use-attribute-sets="table-note-name-style"> + <xsl:call-template name="refine_table-note-name-style"/> + <xsl:apply-templates select="*[local-name() = 'name']"/> </fo:inline> <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> @@ -4816,10 +5031,18 @@ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn"> <!-- list of footnotes to calculate actual footnotes number --> <xsl:variable name="p_fn_"> <xsl:call-template name="get_fn_list"/> + <!-- <xsl:choose> + <xsl:when test="$namespace = 'jis'"> + <xsl:call-template name="get_fn_list_for_element"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get_fn_list"/> + </xsl:otherwise> + </xsl:choose> --> </xsl:variable> <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/> <xsl:variable name="gen_id" select="generate-id(.)"/> <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/> @@ -4840,11 +5063,18 @@ <xsl:variable name="current_fn_number_text"> <xsl:value-of select="$current_fn_number"/> </xsl:variable> - <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/> + <xsl:variable name="ref_id"> + <xsl:choose> + <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> <xsl:variable name="footnote_inline"> <fo:inline> <xsl:variable name="fn_styles"> <xsl:choose> @@ -4866,11 +5096,11 @@ </xsl:if> <xsl:call-template name="insert_basic_link"> <xsl:with-param name="element"> <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> - <xsl:value-of select="$current_fn_number_text"/> + <xsl:copy-of select="$current_fn_number_text"/> </fo:basic-link> </xsl:with-param> </xsl:call-template> </fo:inline> </xsl:variable> @@ -4886,16 +5116,16 @@ <fo:block-container xsl:use-attribute-sets="fn-container-body-style"> <fo:block xsl:use-attribute-sets="fn-body-style"> - <xsl:if test="$doctype = 'service-publication'"> - <xsl:attribute name="font-size">10pt</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_fn-body-style"/> <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style"> + <xsl:call-template name="refine_fn-body-num-style"/> + <xsl:value-of select="$current_fn_number_text"/> </fo:inline> <xsl:apply-templates/> </fo:block> </fo:block-container> @@ -4943,10 +5173,32 @@ </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:template> + <xsl:template name="get_fn_list_for_element"> + <xsl:choose> + <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already --> + <fn gen_id="{generate-id(.)}"> + <xsl:copy-of select="@*"/> + <xsl:copy-of select="node()"/> + </fn> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]"> + <xsl:variable name="element_id" select="@id"/> + <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]"> + <!-- copy unique fn --> + <fn gen_id="{generate-id(.)}"> + <xsl:copy-of select="@*"/> + <xsl:copy-of select="node()"/> + </fn> + </xsl:for-each> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <!-- ============================ --> <!-- table's footnotes rendering --> <!-- ============================ --> <xsl:template name="table_fn_display"> <xsl:variable name="references"> @@ -5123,10 +5375,12 @@ <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) --> <xsl:template match="*[local-name()='fn']"> <fo:inline xsl:use-attribute-sets="fn-reference-style"> + <xsl:call-template name="refine_fn-reference-style"/> + <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> @@ -5222,11 +5476,11 @@ </xsl:when> <!-- END: only one component --> <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:call-template name="refine_dl_formula_where_style"/> <!-- <xsl:variable name="title-where"> <xsl:call-template name="getLocalizedString"> <xsl:with-param name="key">where</xsl:with-param> </xsl:call-template> @@ -5237,10 +5491,12 @@ </fo:block> </xsl:when> <!-- END: a few components --> <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure --> <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always"> + <xsl:call-template name="refine_figure_key_style"/> + <xsl:variable name="title-key"> <xsl:call-template name="getLocalizedString"> <xsl:with-param name="key">key</xsl:with-param> </xsl:call-template> </xsl:variable> @@ -5251,20 +5507,20 @@ <!-- a few components --> <xsl:if test="$onlyOneComponent = 'false'"> <fo:block> - <xsl:if test="$parent = 'figure' or $parent = 'formula'"> - <xsl:attribute name="margin-left">7.4mm</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_multicomponent_style"/> <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']"> <xsl:attribute name="margin-top">0</xsl:attribute> </xsl:if> <fo:block> + <xsl:call-template name="refine_multicomponent_block_style"/> + <xsl:apply-templates select="*[local-name() = 'name']"> <xsl:with-param name="process">true</xsl:with-param> </xsl:apply-templates> <xsl:if test="$isGenerateTableIF = 'true'"> @@ -5418,10 +5674,34 @@ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/> </xsl:if> </xsl:template> <!-- END: dl --> + <xsl:template name="refine_dl_formula_where_style"> + + <xsl:attribute name="margin-bottom">6pt</xsl:attribute> + + </xsl:template> <!-- refine_dl_formula_where_style --> + + <xsl:template name="refine_figure_key_style"> + + </xsl:template> <!-- refine_figure_key_style --> + + <xsl:template name="refine_multicomponent_style"> + <xsl:variable name="parent" select="local-name(..)"/> + + <xsl:if test="$parent = 'figure' or $parent = 'formula'"> + <xsl:attribute name="margin-left">7.4mm</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_multicomponent_style --> + + <xsl:template name="refine_multicomponent_block_style"> + <xsl:variable name="parent" select="local-name(..)"/> + + </xsl:template> <!-- refine_multicomponent_block_style --> + <!-- ignore 'p' with 'where' in formula, before 'dl' --> <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/> <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']"> <xsl:param name="process">false</xsl:param> @@ -5637,24 +5917,20 @@ <xsl:attribute name="border">0.1pt solid black</xsl:attribute> <xsl:attribute name="text-align">left</xsl:attribute> </xsl:if> - <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']"> - <xsl:attribute name="padding-right">3mm</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_dt-cell-style"/> <fo:block xsl:use-attribute-sets="dt-block-style"> <xsl:copy-of select="@id"/> <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="margin-top">0</xsl:attribute> </xsl:if> - <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']"> - <xsl:attribute name="text-align">right</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_dt-block-style"/> <xsl:apply-templates> <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/> </xsl:apply-templates> @@ -5671,10 +5947,12 @@ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- border is mandatory, to calculate real width --> <xsl:attribute name="border">0.1pt solid black</xsl:attribute> </xsl:if> + <xsl:call-template name="refine_dd-cell-style"/> + <fo:block> <xsl:if test="$isGenerateTableIF = 'true'"> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> </xsl:if> @@ -5823,16 +6101,22 @@ <xsl:template match="*[local-name()='strong'] | *[local-name()='b']"> <xsl:param name="split_keep-within-line"/> <fo:inline font-weight="bold"> + <xsl:call-template name="refine_strong_style"/> + <xsl:apply-templates> <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/> </xsl:apply-templates> </fo:inline> </xsl:template> + <xsl:template name="refine_strong_style"> + + </xsl:template> + <xsl:template match="*[local-name()='padding']"> <fo:inline padding-right="{@value}"> </fo:inline> </xsl:template> <xsl:template match="*[local-name()='sup']"> @@ -6295,11 +6579,14 @@ </xsl:when> <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise> </xsl:choose> </xsl:variable> - <xsl:value-of select="$text9"/> + <!-- replace sequence #x200B and space TO space --> + <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/> + + <xsl:value-of select="$text10"/> </xsl:template> <xsl:template name="add-zero-spaces-link-java"> <xsl:param name="text" select="."/> @@ -6970,10 +7257,15 @@ <xsl:variable name="isAdded" select="@added"/> <xsl:variable name="isDeleted" select="@deleted"/> <fo:inline xsl:use-attribute-sets="mathml-style"> + <!-- DEBUG --> + <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> --> + + <xsl:call-template name="refine_mathml-style"/> + <xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element --> <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> --> </xsl:if> <xsl:call-template name="setTrackChangesStyles"> @@ -7074,10 +7366,12 @@ <xsl:apply-templates select="." mode="mathml"/> </xsl:variable> <fo:instream-foreign-object fox:alt-text="Math"> + <xsl:call-template name="refine_mathml_insteam_object_style"/> + <!-- put MathML in Actual Text --> <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> --> <xsl:attribute name="fox:actual-text"> <xsl:value-of select="$mathml_content"/> </xsl:attribute> @@ -7094,10 +7388,14 @@ <xsl:copy-of select="xalan:nodeset($mathml)"/> </fo:instream-foreign-object> </xsl:template> + <xsl:template name="refine_mathml_insteam_object_style"> + + </xsl:template> <!-- refine_mathml_insteam_object_style --> + <xsl:template match="mathml:*" mode="mathml_actual_text"> <!-- <xsl:text>a+b</xsl:text> --> <xsl:text>&lt;</xsl:text> <xsl:value-of select="local-name()"/> <xsl:if test="local-name() = 'math'"> @@ -7238,10 +7536,12 @@ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem> --> <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3"> <fo:inline xsl:use-attribute-sets="mathml-style"> + <xsl:call-template name="refine_mathml-style"/> + <xsl:choose> <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when> <xsl:otherwise> <xsl:apply-templates> <xsl:with-param name="process">true</xsl:with-param> @@ -7282,10 +7582,12 @@ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])"> <xsl:attribute name="keep-together.within-line">always</xsl:attribute> </xsl:if> + <xsl:call-template name="refine_link-style"/> + <xsl:choose> <xsl:when test="$target_text = ''"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> @@ -7369,10 +7671,13 @@ <xsl:template match="*[local-name() = 'xref']"> <xsl:call-template name="insert_basic_link"> <xsl:with-param name="element"> <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style"> + <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])"> + <xsl:attribute name="keep-together.within-line">always</xsl:attribute> + </xsl:if> <xsl:if test="parent::*[local-name() = 'add']"> <xsl:call-template name="append_add-style"/> </xsl:if> <xsl:apply-templates/> </fo:basic-link> @@ -7430,10 +7735,12 @@ <fo:table-body> <fo:table-row> <fo:table-cell display-align="center"> <fo:block xsl:use-attribute-sets="formula-stem-block-style"> + <xsl:call-template name="refine_formula-stem-block-style"/> + <xsl:apply-templates/> </fo:block> </fo:table-cell> <fo:table-cell display-align="center"> <fo:block xsl:use-attribute-sets="formula-stem-number-style"> @@ -7471,20 +7778,22 @@ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style"> <xsl:call-template name="setBlockSpanAll"/> + <xsl:call-template name="refine_note-style"/> + <fo:block-container margin-left="0mm" margin-right="0mm"> <fo:block> - <xsl:if test="ancestor::itu:figure"> - <xsl:attribute name="keep-with-previous">always</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_note_block_style"/> <fo:inline xsl:use-attribute-sets="note-name-style"> + <xsl:call-template name="refine_note-name-style"/> + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> --> <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> <xsl:call-template name="append_add-style"/> </xsl:if> @@ -7506,10 +7815,18 @@ </fo:block-container> </fo:block-container> </xsl:template> + <xsl:template name="refine_note_block_style"> + + <xsl:if test="ancestor::itu:figure"> + <xsl:attribute name="keep-with-previous">always</xsl:attribute> + </xsl:if> + + </xsl:template> + <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']"> <xsl:variable name="num"><xsl:number/></xsl:variable> <xsl:choose> <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE --> <fo:inline xsl:use-attribute-sets="note-p-style"> @@ -7527,16 +7844,20 @@ <xsl:template match="*[local-name() = 'termnote']"> <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style"> <xsl:call-template name="setBlockSpanAll"/> + <xsl:call-template name="refine_termnote-style"/> + <fo:inline xsl:use-attribute-sets="termnote-name-style"> <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])"> <xsl:attribute name="padding-right">1mm</xsl:attribute> </xsl:if> + <xsl:call-template name="refine_termnote-name-style"/> + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> --> <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> <xsl:call-template name="append_add-style"/> </xsl:if> @@ -7706,10 +8027,12 @@ </fo:inline> </xsl:when> <xsl:otherwise> <fo:block xsl:use-attribute-sets="image-style"> + <xsl:call-template name="refine_image-style"/> + <xsl:variable name="src"> <xsl:call-template name="image_src"/> </xsl:variable> <xsl:choose> @@ -8555,10 +8878,12 @@ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']"> <xsl:if test="normalize-space() != ''"> <fo:block xsl:use-attribute-sets="figure-name-style"> + <xsl:call-template name="refine_figure-name-style"/> + <xsl:apply-templates/> </fo:block> </xsl:if> </xsl:template> @@ -8820,10 +9145,12 @@ <xsl:attribute name="{local-name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> + <xsl:call-template name="refine_sourcecode-style"/> + <!-- remove margin between rows in the table with sourcecode line numbers --> <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <xsl:attribute name="margin-top">0pt</xsl:attribute> <xsl:attribute name="margin-bottom">0pt</xsl:attribute> </xsl:if> @@ -9524,10 +9851,12 @@ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style"> <xsl:call-template name="setBlockSpanAll"/> + <xsl:call-template name="refine_example-style"/> + <xsl:variable name="fo_element"> <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if> block </xsl:variable> @@ -9651,10 +9980,12 @@ <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> </xsl:if> <fo:block xsl:use-attribute-sets="example-p-style"> + <xsl:call-template name="refine_example-p-style"/> + <xsl:apply-templates/> </fo:block> </fo:block-container> </xsl:when> <xsl:when test="starts-with(normalize-space($element), 'list')"> @@ -9667,10 +9998,11 @@ <xsl:apply-templates/> </fo:inline> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- example/p --> + <!-- ====== --> <!-- ====== --> <!-- ====== --> <!-- termsource --> @@ -9678,10 +10010,12 @@ <!-- modification --> <!-- ====== --> <xsl:template match="*[local-name() = 'termsource']" name="termsource"> <fo:block xsl:use-attribute-sets="termsource-style"> + <xsl:call-template name="refine_termsource-style"/> + <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] --> <xsl:variable name="termsource_text"> <xsl:apply-templates/> </xsl:variable> <xsl:copy-of select="$termsource_text"/> @@ -9793,10 +10127,12 @@ </xsl:if> <fo:block-container margin-left="0mm"> <fo:block-container xsl:use-attribute-sets="quote-style"> + <xsl:call-template name="refine_quote-style"/> + <fo:block-container margin-left="0mm" margin-right="0mm"> <fo:block role="BlockQuote"> <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source --> </fo:block> </fo:block-container> @@ -9867,21 +10203,22 @@ <xsl:attribute name="vertical-align">super</xsl:attribute> <xsl:attribute name="font-size">80%</xsl:attribute> </xsl:if> - <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets --> - <xsl:variable name="text" select="normalize-space()"/> + <xsl:call-template name="refine_eref-style"/> <xsl:call-template name="insert_basic_link"> <xsl:with-param name="element"> <fo:basic-link fox:alt-text="{@citeas}"> <xsl:if test="normalize-space(@citeas) = ''"> <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute> </xsl:if> <xsl:if test="@type = 'inline'"> + <xsl:call-template name="refine_basic_link_style"/> + </xsl:if> <xsl:choose> <xsl:when test="$external-destination != ''"> <!-- external hyperlink --> <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute> @@ -9910,10 +10247,15 @@ </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> + + <xsl:template name="refine_basic_link_style"> + + </xsl:template> <!-- refine_basic_link_style --> + <!-- ====== --> <!-- END eref --> <!-- ====== --> <!-- Tabulation processing --> @@ -10055,22 +10397,28 @@ <xsl:template match="/*/*[local-name() = 'sections']/*" priority="2"> <fo:block> <xsl:call-template name="setId"/> - <xsl:if test="*[1][@class='supertitle']"> - <xsl:attribute name="space-before">36pt</xsl:attribute> - </xsl:if> - <xsl:if test="@inline-header='true'"> - <xsl:attribute name="text-align">justify</xsl:attribute> - </xsl:if> + <xsl:call-template name="sections_element_style"/> <xsl:apply-templates/> </fo:block> </xsl:template> + <xsl:template name="sections_element_style"> + + <xsl:if test="*[1][@class='supertitle']"> + <xsl:attribute name="space-before">36pt</xsl:attribute> + </xsl:if> + <xsl:if test="@inline-header='true'"> + <xsl:attribute name="text-align">justify</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- sections_element_style --> + <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* --> <fo:block break-after="page"/> <fo:block> <xsl:call-template name="setId"/> <xsl:apply-templates/> @@ -10081,18 +10429,24 @@ <fo:block> <xsl:call-template name="setId"/> <xsl:call-template name="setBlockSpanAll"/> - <xsl:if test="@inline-header='true'"> - <xsl:attribute name="text-align">justify</xsl:attribute> - </xsl:if> + <xsl:call-template name="refine_clause_style"/> <xsl:apply-templates/> </fo:block> </xsl:template> + <xsl:template name="refine_clause_style"> + + <xsl:if test="@inline-header='true'"> + <xsl:attribute name="text-align">justify</xsl:attribute> + </xsl:if> + + </xsl:template> <!-- refine_clause_style --> + <xsl:template match="*[local-name() = 'definitions']"> <fo:block id="{@id}"> <xsl:apply-templates/> </fo:block> </xsl:template> @@ -10101,14 +10455,20 @@ <fo:block break-after="page"/> <fo:block id="{@id}"> <xsl:call-template name="setBlockSpanAll"/> + <xsl:call-template name="refine_annex_style"/> + </fo:block> <xsl:apply-templates/> </xsl:template> + <xsl:template name="refine_annex_style"> + + </xsl:template> + <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl --> <!-- comment 2019-11-29 --> <!-- <fo:block font-weight="bold">Review:</fo:block> <xsl:apply-templates /> --> @@ -10271,10 +10631,12 @@ <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:call-template name="refine_list_container_style"/> + <fo:block-container margin-left="0mm"> <fo:block> <xsl:apply-templates select="." mode="list"/> </fo:block> </fo:block-container> @@ -10288,21 +10650,25 @@ </xsl:otherwise> </xsl:choose> </xsl:template> + <xsl:template name="refine_list_container_style"> + + </xsl:template> <!-- refine_list_container_style --> + <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list"> <xsl:apply-templates select="*[local-name() = 'name']"> <xsl:with-param name="process">true</xsl:with-param> </xsl:apply-templates> <fo:list-block xsl:use-attribute-sets="list-style"> <xsl:variable name="provisional_distance_between_starts_"> <attributes xsl:use-attribute-sets="list-style"> - + <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/> </attributes> </xsl:variable> <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/> <xsl:if test="$provisional_distance_between_starts != ''"> <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute> @@ -10334,10 +10700,12 @@ <!-- <xsl:copy-of select="$item_numbers"/> <max_length><xsl:value-of select="$max_length"/></max_length> <addon><xsl:value-of select="$addon"/></addon> --> </xsl:if> + <xsl:call-template name="refine_list-style"/> + <xsl:if test="*[local-name() = 'name']"> <xsl:attribute name="margin-top">0pt</xsl:attribute> </xsl:if> <xsl:apply-templates select="node()[not(local-name() = 'note')]"/> @@ -10346,10 +10714,14 @@ <xsl:call-template name="note"/> </xsl:for-each> --> <xsl:apply-templates select="./*[local-name() = 'note']"/> </xsl:template> + <xsl:template name="refine_list-style_provisional-distance-between-starts"> + + </xsl:template> <!-- refine_list-style_provisional-distance-between-starts --> + <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']"> <xsl:param name="process">false</xsl:param> <xsl:if test="$process = 'true'"> <fo:block xsl:use-attribute-sets="list-name-style"> <xsl:apply-templates/> @@ -10359,24 +10731,31 @@ <xsl:template match="*[local-name()='li']"> <fo:list-item xsl:use-attribute-sets="list-item-style"> <xsl:copy-of select="@id"/> + <xsl:call-template name="refine_list-item-style"/> + <fo:list-item-label end-indent="label-end()"> <fo:block xsl:use-attribute-sets="list-item-label-style"> + <xsl:call-template name="refine_list-item-label-style"/> + <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> <xsl:call-template name="append_add-style"/> </xsl:if> <xsl:call-template name="getListItemFormat"/> + </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style"> <fo:block> + <xsl:call-template name="refine_list-item-body-style"/> + <xsl:apply-templates/> <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" /> <xsl:for-each select="./bsi:note"> @@ -10690,10 +11069,11 @@ <!-- Normative references --> <xsl:template match="*[local-name() = 'references'][@normative='true']" priority="2"> <fo:block id="{@id}"> <xsl:apply-templates/> + </fo:block> </xsl:template> <!-- Bibliography (non-normative references) --> <xsl:template match="*[local-name() = 'references']"> @@ -10709,10 +11089,11 @@ </xsl:if> </xsl:if> --> <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style"> <xsl:apply-templates/> + </fo:block> </xsl:template> <!-- references --> <xsl:template match="*[local-name() = 'bibitem']"> @@ -11315,10 +11696,13 @@ <xsl:call-template name="add_id"/> <xsl:apply-templates mode="update_xml_step1"/> </xsl:copy> </xsl:template> + <!-- prevent empty thead processing in XSL-FO, remove it --> + <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/> + <xsl:template name="add_id"> <xsl:if test="not(@id)"> <!-- add @id - first element with @id plus '_element_name' --> <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute> </xsl:if> @@ -11599,10 +11983,18 @@ </fn> --> <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn"> <xsl:variable name="p_fn_"> <xsl:call-template name="get_fn_list"/> + <!-- <xsl:choose> + <xsl:when test="$namespace = 'jis'"> + <xsl:call-template name="get_fn_list_for_element"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get_fn_list"/> + </xsl:otherwise> + </xsl:choose> --> </xsl:variable> <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/> <xsl:variable name="gen_id" select="generate-id(.)"/> <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/> <xsl:variable name="reference" select="@reference"/> @@ -11613,11 +12005,17 @@ <xsl:apply-templates select="@*" mode="linear_xml"/> <!-- put actual reference number --> <xsl:attribute name="current_fn_number"> <xsl:value-of select="$current_fn_number"/> </xsl:attribute> + <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/> <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote --> - <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/> + + <xsl:value-of select="$skip_footnote_body_"/> + + </xsl:attribute> + <xsl:attribute name="ref_id"> + <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/> </xsl:attribute> <xsl:apply-templates select="node()" mode="linear_xml"/> </xsl:copy> </xsl:template> \ No newline at end of file