metanorma-ribose 2.6.1 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -476,11 +476,8 @@
476
476
  <xsl:call-template name="getPageSequenceOrientation"/>
477
477
  </xsl:attribute>
478
478
 
479
- <fo:static-content flow-name="xsl-footnote-separator">
480
- <fo:block>
481
- <fo:leader leader-pattern="rule" leader-length="30%"/>
482
- </fo:block>
483
- </fo:static-content>
479
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
480
+
484
481
  <xsl:call-template name="insertHeaderFooter">
485
482
  <xsl:with-param name="section">main</xsl:with-param>
486
483
  </xsl:call-template>
@@ -951,12 +948,6 @@
951
948
  </xsl:if>
952
949
  </xsl:template>
953
950
 
954
- <xsl:template match="ribose:fn/ribose:p">
955
- <fo:block>
956
- <xsl:apply-templates/>
957
- </fo:block>
958
- </xsl:template>
959
-
960
951
  <xsl:template match="ribose:ul | ribose:ol" mode="list" priority="2">
961
952
  <fo:block-container>
962
953
  <fo:block-container margin-left="0mm">
@@ -2177,12 +2168,16 @@
2177
2168
  </xsl:template>
2178
2169
 
2179
2170
  <xsl:attribute-set name="table-fn-number-style">
2180
- <xsl:attribute name="font-size">80%</xsl:attribute>
2181
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
2171
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
2182
2172
 
2183
2173
  </xsl:attribute-set> <!-- table-fn-number-style -->
2184
2174
 
2185
- <xsl:template name="refine_table-fn-number-style">
2175
+ <xsl:attribute-set name="table-fmt-fn-label-style">
2176
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2177
+
2178
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
2179
+
2180
+ <xsl:template name="refine_table-fmt-fn-label-style">
2186
2181
 
2187
2182
  </xsl:template>
2188
2183
 
@@ -2197,11 +2192,18 @@
2197
2192
  </xsl:attribute-set>
2198
2193
 
2199
2194
  <xsl:attribute-set name="figure-fn-number-style">
2200
- <xsl:attribute name="font-size">80%</xsl:attribute>
2201
2195
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2196
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
2197
+
2198
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
2199
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2202
2200
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2203
2201
 
2204
- </xsl:attribute-set>
2202
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
2203
+
2204
+ <xsl:template name="refine_figure-fmt-fn-label-style">
2205
+
2206
+ </xsl:template>
2205
2207
 
2206
2208
  <xsl:attribute-set name="figure-fn-body-style">
2207
2209
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -3773,9 +3775,13 @@
3773
3775
 
3774
3776
  <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3775
3777
  <xsl:if test="$isNoteOrFnExist = 'true'">
3776
-
3777
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3778
-
3778
+ <!-- <xsl:choose>
3779
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
3780
+ <xsl:otherwise>
3781
+
3782
+ </xsl:otherwise>
3783
+ </xsl:choose> -->
3784
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3779
3785
  </xsl:if>
3780
3786
 
3781
3787
  <xsl:choose>
@@ -3822,7 +3828,7 @@
3822
3828
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3823
3829
  </xsl:when>
3824
3830
  <xsl:otherwise>
3825
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'example') 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 -->
3831
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'example') 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') and not(local-name() = 'fmt-footnote-container')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3826
3832
  </xsl:otherwise>
3827
3833
  </xsl:choose>
3828
3834
 
@@ -3833,13 +3839,26 @@
3833
3839
 
3834
3840
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3835
3841
 
3836
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3837
- <xsl:call-template name="insertTableFooterInSeparateTable">
3838
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3839
- <xsl:with-param name="colwidths" select="$colwidths"/>
3840
- <xsl:with-param name="colgroup" select="$colgroup"/>
3841
- </xsl:call-template>
3842
- </xsl:for-each>
3842
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
3843
+
3844
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3845
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3846
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3847
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3848
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3849
+ </xsl:call-template>
3850
+ </xsl:for-each>
3851
+
3852
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
3853
+ <xsl:if test="$namespace = 'plateau'">
3854
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
3855
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
3856
+ <xsl:variable name="table_fn_block">
3857
+ <xsl:call-template name="table_fn_display" />
3858
+ </xsl:variable>
3859
+ <xsl:copy-of select="$table_fn_block"/>
3860
+ </xsl:for-each>
3861
+ </xsl:if> -->
3843
3862
 
3844
3863
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3845
3864
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -4626,6 +4645,8 @@
4626
4645
 
4627
4646
  <xsl:template name="setTableRowAttributes">
4628
4647
 
4648
+ <xsl:call-template name="setColors"/>
4649
+
4629
4650
  </xsl:template> <!-- setTableRowAttributes -->
4630
4651
  <!-- ===================== -->
4631
4652
  <!-- END Table's row processing -->
@@ -4677,6 +4698,7 @@
4677
4698
  </xsl:attribute>
4678
4699
  </xsl:if>
4679
4700
  <xsl:call-template name="display-align"/>
4701
+ <xsl:call-template name="setColors"/>
4680
4702
  </xsl:template>
4681
4703
 
4682
4704
  <xsl:template name="display-align">
@@ -4692,6 +4714,29 @@
4692
4714
  </xsl:if>
4693
4715
  </xsl:template>
4694
4716
 
4717
+ <xsl:template name="setColors">
4718
+ <xsl:variable name="styles__">
4719
+ <xsl:call-template name="split">
4720
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
4721
+ <xsl:with-param name="sep" select="';'"/>
4722
+ </xsl:call-template>
4723
+ </xsl:variable>
4724
+ <xsl:variable name="quot">"</xsl:variable>
4725
+ <xsl:variable name="styles_">
4726
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
4727
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
4728
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
4729
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
4730
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
4731
+ </xsl:if>
4732
+ </xsl:for-each>
4733
+ </xsl:variable>
4734
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
4735
+ <xsl:for-each select="$styles/style">
4736
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4737
+ </xsl:for-each>
4738
+ </xsl:template>
4739
+
4695
4740
  <!-- cell in table body, footer -->
4696
4741
  <xsl:template match="*[local-name()='td']" name="td">
4697
4742
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -4703,17 +4748,28 @@
4703
4748
 
4704
4749
  <xsl:call-template name="refine_table-cell-style"/>
4705
4750
 
4751
+ <xsl:call-template name="setTableCellAttributes"/>
4752
+
4706
4753
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4707
4754
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4708
4755
  </xsl:if>
4709
4756
 
4710
- <xsl:call-template name="setTableCellAttributes"/>
4711
-
4712
4757
  <xsl:if test="$isGenerateTableIF = 'true'">
4713
4758
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4714
4759
  <xsl:attribute name="text-align">left</xsl:attribute>
4715
4760
  </xsl:if>
4716
4761
 
4762
+ <xsl:if test="$isGenerateTableIF = 'false'">
4763
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
4764
+ <xsl:attribute name="text-align">right</xsl:attribute>
4765
+ <xsl:attribute name="border">none</xsl:attribute>
4766
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4767
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4768
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4769
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4770
+ </xsl:if>
4771
+ </xsl:if>
4772
+
4717
4773
  <fo:block role="SKIP">
4718
4774
 
4719
4775
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4732,7 +4788,8 @@
4732
4788
  </fo:table-cell>
4733
4789
  </xsl:template> <!-- td -->
4734
4790
 
4735
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4791
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4792
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example'] | *[local-name()='table']/*[local-name()='tfoot']//*[local-name()='note' or local-name() = 'example']" priority="2">
4736
4793
 
4737
4794
  <fo:block xsl:use-attribute-sets="table-note-style">
4738
4795
  <xsl:copy-of select="@id"/>
@@ -4753,65 +4810,54 @@
4753
4810
 
4754
4811
  </xsl:template> <!-- table/note -->
4755
4812
 
4756
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4813
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p'] | *[local-name()='table']/*[local-name()='tfoot']//*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4757
4814
  <xsl:apply-templates/>
4758
4815
  </xsl:template>
4759
4816
 
4760
4817
  <!-- ===================== -->
4761
4818
  <!-- Footnotes processing -->
4762
4819
  <!-- ===================== -->
4820
+
4821
+ <!-- document text (not figures, or tables) footnotes -->
4822
+ <xsl:variable name="footnotes_">
4823
+ <xsl:for-each select="//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']"> <!-- commented *[local-name() = 'metanorma']/, because there are fn in figure or table name -->
4824
+ <!-- <xsl:copy-of select="."/> -->
4825
+ <xsl:variable name="update_xml_step1">
4826
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
4827
+ </xsl:variable>
4828
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
4829
+ </xsl:for-each>
4830
+ </xsl:variable>
4831
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
4832
+
4763
4833
  <!--
4764
4834
  <fn reference="1">
4765
4835
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
4766
4836
  </fn>
4767
4837
  -->
4768
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4838
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4839
+ <!-- fn in text -->
4769
4840
  <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">
4770
4841
 
4771
- <!-- list of footnotes to calculate actual footnotes number -->
4842
+ <!-- list of unique footnotes -->
4772
4843
  <xsl:variable name="p_fn_">
4773
4844
  <xsl:call-template name="get_fn_list"/>
4774
- <!-- <xsl:choose>
4775
- <xsl:when test="$namespace = 'jis'">
4776
- <xsl:call-template name="get_fn_list_for_element"/>
4777
- </xsl:when>
4778
- <xsl:otherwise>
4779
- <xsl:call-template name="get_fn_list"/>
4780
- </xsl:otherwise>
4781
- </xsl:choose> -->
4782
4845
  </xsl:variable>
4783
4846
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4784
4847
 
4785
4848
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4786
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4787
- <xsl:variable name="reference_">
4788
- <xsl:value-of select="@reference"/>
4789
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4790
- </xsl:variable>
4791
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
4849
+
4792
4850
  <!-- fn sequence number in document -->
4793
- <xsl:variable name="current_fn_number">
4794
- <xsl:choose>
4795
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
4796
- <xsl:otherwise>
4797
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
4798
- </xsl:otherwise>
4799
- </xsl:choose>
4800
- </xsl:variable>
4851
+ <xsl:variable name="current_fn_number" select="@reference"/>
4852
+
4801
4853
  <xsl:variable name="current_fn_number_text">
4802
4854
 
4803
4855
  <xsl:value-of select="$current_fn_number"/>
4804
4856
 
4805
4857
  </xsl:variable>
4806
4858
 
4807
- <xsl:variable name="ref_id">
4808
- <xsl:choose>
4809
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4810
- <xsl:otherwise>
4811
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4812
- </xsl:otherwise>
4813
- </xsl:choose>
4814
- </xsl:variable>
4859
+ <xsl:variable name="ref_id" select="@target"/>
4860
+
4815
4861
  <xsl:variable name="footnote_inline">
4816
4862
  <fo:inline role="Reference">
4817
4863
 
@@ -4856,7 +4902,9 @@
4856
4902
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4857
4903
  <xsl:copy-of select="$footnote_inline"/>
4858
4904
  </xsl:when>
4905
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4859
4906
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4907
+
4860
4908
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4861
4909
  <xsl:copy-of select="$footnote_inline"/>
4862
4910
  <fo:footnote-body role="Note">
@@ -4873,7 +4921,10 @@
4873
4921
  <xsl:value-of select="$current_fn_number_text"/>
4874
4922
 
4875
4923
  </fo:inline>
4876
- <xsl:apply-templates/>
4924
+ <!-- <xsl:apply-templates /> -->
4925
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
4926
+ <here><xsl:copy-of select="$footnotes"/></here> -->
4927
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
4877
4928
  </xsl:variable>
4878
4929
 
4879
4930
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -4927,77 +4978,136 @@
4927
4978
  </xsl:choose>
4928
4979
  </xsl:template>
4929
4980
 
4930
- <xsl:template name="get_fn_list_for_element">
4931
- <xsl:choose>
4932
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4933
- <fn gen_id="{generate-id(.)}">
4934
- <xsl:copy-of select="@*"/>
4935
- <xsl:copy-of select="node()"/>
4936
- </fn>
4937
- </xsl:when>
4938
- <xsl:otherwise>
4939
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4940
- <xsl:variable name="element_id" select="@id"/>
4941
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4942
- <!-- copy unique fn -->
4943
- <fn gen_id="{generate-id(.)}">
4944
- <xsl:copy-of select="@*"/>
4945
- <xsl:copy-of select="node()"/>
4946
- </fn>
4947
- </xsl:for-each>
4948
- </xsl:for-each>
4949
- </xsl:otherwise>
4950
- </xsl:choose>
4951
- </xsl:template>
4952
4981
  <!-- ============================ -->
4953
4982
  <!-- table's footnotes rendering -->
4954
4983
  <!-- ============================ -->
4955
- <xsl:template name="table_fn_display">
4956
- <xsl:variable name="references">
4957
4984
 
4985
+ <!-- table/fmt-footnote-container -->
4986
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
4987
+
4988
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
4989
+ <xsl:for-each select=".">
4990
+ <xsl:call-template name="table_fn_display"/>
4991
+ </xsl:for-each>
4992
+ </xsl:template>
4993
+
4994
+ <xsl:template name="table_fn_display">
4995
+ <!-- <xsl:variable name="references">
4996
+ <xsl:if test="$namespace = 'bsi'">
4997
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
4998
+ <xsl:call-template name="create_fn" />
4999
+ </xsl:for-each>
5000
+ </xsl:if>
4958
5001
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4959
- <xsl:call-template name="create_fn"/>
5002
+ <xsl:call-template name="create_fn" />
4960
5003
  </xsl:for-each>
4961
- </xsl:variable>
4962
-
4963
- <xsl:for-each select="xalan:nodeset($references)//fn">
5004
+ </xsl:variable> -->
5005
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
4964
5006
  <xsl:variable name="reference" select="@reference"/>
4965
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5007
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5008
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4966
5009
 
4967
5010
  <fo:block xsl:use-attribute-sets="table-fn-style">
5011
+ <xsl:copy-of select="@id"/>
4968
5012
  <xsl:call-template name="refine_table-fn-style"/>
4969
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4970
- <xsl:call-template name="refine_table-fn-number-style"/>
4971
5013
 
4972
- <xsl:value-of select="@reference"/>
4973
-
4974
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4975
- <!-- <xsl:if test="$namespace = 'itu'">
4976
- <xsl:text>)</xsl:text>
4977
- </xsl:if> -->
5014
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
5015
+ <xsl:with-param name="process">true</xsl:with-param>
5016
+ </xsl:apply-templates>
4978
5017
 
4979
- </fo:inline>
4980
5018
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4981
- <xsl:copy-of select="./node()"/>
5019
+ <!-- <xsl:copy-of select="./node()"/> -->
5020
+ <xsl:apply-templates/>
4982
5021
  </fo:inline>
4983
5022
 
4984
5023
  </fo:block>
4985
5024
 
4986
- </xsl:if>
5025
+ <!-- </xsl:if> -->
4987
5026
  </xsl:for-each>
4988
5027
  </xsl:template> <!-- table_fn_display -->
4989
5028
 
5029
+ <!-- fmt-fn-body/fmt-fn-label in text -->
5030
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
5031
+
5032
+ <!-- table//fmt-fn-body//fmt-fn-label -->
5033
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5034
+ <xsl:param name="process">false</xsl:param>
5035
+ <xsl:if test="$process = 'true'">
5036
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
5037
+
5038
+ <!-- tab is padding-right -->
5039
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5040
+ <xsl:with-param name="process">true</xsl:with-param>
5041
+ </xsl:apply-templates>
5042
+
5043
+ <!-- <xsl:if test="$namespace = 'bipm'">
5044
+ <fo:inline font-style="normal">(</fo:inline>
5045
+ </xsl:if> -->
5046
+
5047
+ <!-- <xsl:if test="$namespace = 'plateau'">
5048
+ <xsl:text>※</xsl:text>
5049
+ </xsl:if> -->
5050
+
5051
+ <!-- <xsl:value-of select="@reference"/> -->
5052
+ <!-- <xsl:value-of select="normalize-space()"/> -->
5053
+ <xsl:apply-templates/>
5054
+
5055
+ <!-- <xsl:if test="$namespace = 'bipm'">
5056
+ <fo:inline font-style="normal">)</fo:inline>
5057
+ </xsl:if> -->
5058
+
5059
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5060
+ <!-- <xsl:if test="$namespace = 'itu'">
5061
+ <xsl:text>)</xsl:text>
5062
+ </xsl:if> -->
5063
+
5064
+ <!-- <xsl:if test="$namespace = 'plateau'">
5065
+ <xsl:text>:</xsl:text>
5066
+ </xsl:if> -->
5067
+
5068
+ </fo:inline>
5069
+ </xsl:if>
5070
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
5071
+
5072
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5073
+ <xsl:param name="process">false</xsl:param>
5074
+ <xsl:if test="$process = 'true'">
5075
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
5076
+
5077
+ </xsl:if>
5078
+ </xsl:template>
5079
+
5080
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5081
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
5082
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
5083
+ <xsl:apply-templates/>
5084
+ </fo:inline>
5085
+ </xsl:template>
5086
+
5087
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
5088
+ <!--
4990
5089
  <xsl:template name="create_fn">
4991
5090
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4992
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5091
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
4993
5092
  <xsl:attribute name="id">
4994
5093
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4995
5094
  </xsl:attribute>
4996
5095
  </xsl:if>
4997
-
4998
- <xsl:apply-templates/>
5096
+ <xsl:if test="$namespace = 'itu'">
5097
+ <xsl:if test="ancestor::*[local-name()='preface']">
5098
+ <xsl:attribute name="preface">true</xsl:attribute>
5099
+ </xsl:if>
5100
+ </xsl:if>
5101
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5102
+ <xsl:attribute name="id">
5103
+ <xsl:value-of select="@reference"/>
5104
+ <xsl:text>_</xsl:text>
5105
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5106
+ </xsl:attribute>
5107
+ </xsl:if>
5108
+ <xsl:apply-templates />
4999
5109
  </fn>
5000
- </xsl:template>
5110
+ </xsl:template> -->
5001
5111
 
5002
5112
  <!-- footnotes for table's name rendering -->
5003
5113
  <xsl:template name="table_name_fn_display">
@@ -5016,123 +5126,171 @@
5016
5126
  <!-- ============================ -->
5017
5127
  <!-- figure's footnotes rendering -->
5018
5128
  <!-- ============================ -->
5019
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5020
5129
 
5021
- <!-- current figure id -->
5022
- <xsl:variable name="figure_id_">
5023
- <xsl:value-of select="@id"/>
5024
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
5025
- </xsl:variable>
5026
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
5130
+ <!-- figure/fmt-footnote-container -->
5131
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
5132
+
5133
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
5134
+ <xsl:template name="figure_fn_display">
5027
5135
 
5028
- <!-- all footnotes relates to the current figure -->
5029
5136
  <xsl:variable name="references">
5030
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
5031
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5032
- <xsl:apply-templates/>
5033
- </fn>
5137
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5138
+ <xsl:variable name="curr_id" select="@id"/>
5139
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
5140
+ <curr><xsl:copy-of select="."/></curr>
5141
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
5142
+ <xsl:choose>
5143
+ <!-- skip figure/name/fn -->
5144
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
5145
+ <xsl:otherwise>
5146
+ <xsl:element name="figure" namespace="{$namespace_full}">
5147
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
5148
+ <xsl:copy-of select="."/>
5149
+ </xsl:element>
5150
+ </xsl:element>
5151
+ </xsl:otherwise>
5152
+ </xsl:choose>
5034
5153
  </xsl:for-each>
5035
5154
  </xsl:variable>
5155
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
5036
5156
 
5037
- <xsl:if test="xalan:nodeset($references)//fn">
5157
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5038
5158
 
5039
5159
  <xsl:variable name="key_iso">
5040
5160
 
5041
5161
  </xsl:variable>
5042
5162
 
5043
5163
  <fo:block>
5164
+ <!-- current hierarchy is 'figure' element -->
5165
+ <xsl:variable name="following_dl_colwidths">
5166
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5167
+ <xsl:variable name="simple-table">
5168
+ <!-- <xsl:variable name="doc_ns">
5169
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5170
+ </xsl:variable>
5171
+ <xsl:variable name="ns">
5172
+ <xsl:choose>
5173
+ <xsl:when test="normalize-space($doc_ns) != ''">
5174
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5175
+ </xsl:when>
5176
+ <xsl:otherwise>
5177
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5178
+ </xsl:otherwise>
5179
+ </xsl:choose>
5180
+ </xsl:variable> -->
5044
5181
 
5045
- <!-- current hierarchy is 'figure' element -->
5046
- <xsl:variable name="following_dl_colwidths">
5047
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5048
- <xsl:variable name="simple-table">
5049
- <!-- <xsl:variable name="doc_ns">
5050
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5051
- </xsl:variable>
5052
- <xsl:variable name="ns">
5053
- <xsl:choose>
5054
- <xsl:when test="normalize-space($doc_ns) != ''">
5055
- <xsl:value-of select="normalize-space($doc_ns)"/>
5056
- </xsl:when>
5057
- <xsl:otherwise>
5058
- <xsl:value-of select="substring-before(name(/*), '-')"/>
5059
- </xsl:otherwise>
5060
- </xsl:choose>
5061
- </xsl:variable> -->
5062
-
5063
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5064
- <tbody>
5065
- <xsl:apply-templates mode="dl"/>
5066
- </tbody>
5067
- </xsl:for-each>
5068
- </xsl:variable>
5069
-
5070
- <xsl:call-template name="calculate-column-widths">
5071
- <xsl:with-param name="cols-count" select="2"/>
5072
- <xsl:with-param name="table" select="$simple-table"/>
5073
- </xsl:call-template>
5074
-
5075
- </xsl:if>
5076
- </xsl:variable>
5077
-
5078
- <xsl:variable name="maxlength_dt">
5079
5182
  <xsl:for-each select="*[local-name() = 'dl'][1]">
5080
- <xsl:call-template name="getMaxLength_dt"/>
5183
+ <tbody>
5184
+ <xsl:apply-templates mode="dl"/>
5185
+ </tbody>
5081
5186
  </xsl:for-each>
5082
5187
  </xsl:variable>
5083
5188
 
5084
- <fo:table width="95%" table-layout="fixed">
5085
- <xsl:if test="normalize-space($key_iso) = 'true'">
5086
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5189
+ <xsl:call-template name="calculate-column-widths">
5190
+ <xsl:with-param name="cols-count" select="2"/>
5191
+ <xsl:with-param name="table" select="$simple-table"/>
5192
+ </xsl:call-template>
5087
5193
 
5088
- </xsl:if>
5089
- <xsl:choose>
5090
- <!-- if there 'dl', then set same columns width -->
5091
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5092
- <xsl:call-template name="setColumnWidth_dl">
5093
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5094
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5095
- </xsl:call-template>
5096
- </xsl:when>
5097
- <xsl:otherwise>
5098
- <fo:table-column column-width="5%"/>
5099
- <fo:table-column column-width="95%"/>
5100
- </xsl:otherwise>
5101
- </xsl:choose>
5102
- <fo:table-body>
5103
- <xsl:for-each select="xalan:nodeset($references)//fn">
5104
- <xsl:variable name="reference" select="@reference"/>
5105
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5106
- <fo:table-row>
5107
- <fo:table-cell>
5108
- <fo:block>
5109
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5110
- <xsl:value-of select="@reference"/>
5194
+ </xsl:if>
5195
+ </xsl:variable>
5196
+
5197
+ <xsl:variable name="maxlength_dt">
5198
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5199
+ <xsl:call-template name="getMaxLength_dt"/>
5200
+ </xsl:for-each>
5201
+ </xsl:variable>
5202
+
5203
+ <fo:table width="95%" table-layout="fixed">
5204
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5205
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5206
+
5207
+ </xsl:if>
5208
+ <xsl:choose>
5209
+ <!-- if there 'dl', then set same columns width -->
5210
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5211
+ <xsl:call-template name="setColumnWidth_dl">
5212
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5213
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5214
+ </xsl:call-template>
5215
+ </xsl:when>
5216
+ <xsl:otherwise>
5217
+ <fo:table-column column-width="5%"/>
5218
+ <fo:table-column column-width="95%"/>
5219
+ </xsl:otherwise>
5220
+ </xsl:choose>
5221
+ <fo:table-body>
5222
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
5223
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5224
+
5225
+ <xsl:variable name="reference" select="@reference"/>
5226
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5227
+ <fo:table-row>
5228
+ <fo:table-cell>
5229
+ <fo:block>
5230
+
5231
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
5232
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
5233
+ <!-- <xsl:value-of select="@reference"/> -->
5234
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
5111
5235
  </fo:inline>
5112
- </fo:block>
5113
- </fo:table-cell>
5114
- <fo:table-cell>
5115
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5116
- <xsl:if test="normalize-space($key_iso) = 'true'">
5117
5236
 
5118
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5237
+ </fo:block>
5238
+ </fo:table-cell>
5239
+ <fo:table-cell>
5240
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5241
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5119
5242
 
5120
- </xsl:if>
5121
- <xsl:copy-of select="./node()"/>
5122
- </fo:block>
5123
- </fo:table-cell>
5124
- </fo:table-row>
5125
- </xsl:if>
5126
- </xsl:for-each>
5127
- </fo:table-body>
5128
- </fo:table>
5243
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5244
+
5245
+ </xsl:if>
5129
5246
 
5247
+ <!-- <xsl:copy-of select="./node()"/> -->
5248
+ <xsl:apply-templates/>
5249
+ </fo:block>
5250
+ </fo:table-cell>
5251
+ </fo:table-row>
5252
+ <!-- </xsl:if> -->
5253
+ </xsl:for-each>
5254
+ </fo:table-body>
5255
+ </fo:table>
5130
5256
  </fo:block>
5131
5257
  </xsl:if>
5132
- </xsl:template> <!-- fn_display_figure -->
5258
+ </xsl:template> <!-- figure_fn_display -->
5259
+
5260
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5261
+ <xsl:param name="process">false</xsl:param>
5262
+ <xsl:if test="$process = 'true'">
5263
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
5264
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5265
+
5266
+ <!-- tab is padding-right -->
5267
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5268
+ <xsl:with-param name="process">true</xsl:with-param>
5269
+ </xsl:apply-templates>
5270
+
5271
+ <xsl:apply-templates/>
5272
+
5273
+ </fo:inline>
5274
+ </xsl:if>
5275
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
5276
+
5277
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5278
+ <xsl:param name="process">false</xsl:param>
5279
+ <xsl:if test="$process = 'true'">
5280
+
5281
+ </xsl:if>
5282
+ </xsl:template>
5283
+
5284
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5285
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
5286
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
5287
+ <xsl:apply-templates/>
5288
+ </fo:inline>
5289
+ </xsl:template>
5133
5290
 
5134
5291
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5135
5292
  <!-- figure's footnote label -->
5293
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
5136
5294
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'dl'][@key = 'true']/*[local-name() = 'dt']/ *[local-name() = 'p'][count(node()[normalize-space() != '']) = 1]/*[local-name() = 'sup']" priority="3">
5137
5295
  <xsl:variable name="key_iso">
5138
5296
 
@@ -5141,7 +5299,7 @@
5141
5299
  <xsl:attribute name="font-size">10pt</xsl:attribute>
5142
5300
 
5143
5301
  </xsl:if>
5144
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5302
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
5145
5303
  <!-- <xsl:value-of select="@reference"/> -->
5146
5304
  <xsl:apply-templates/>
5147
5305
  </fo:inline>
@@ -5151,38 +5309,65 @@
5151
5309
  <!-- END: figure's footnotes rendering -->
5152
5310
  <!-- ============================ -->
5153
5311
 
5154
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5312
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5313
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5155
5314
  <xsl:template match="*[local-name()='fn']">
5156
5315
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5157
5316
 
5158
5317
  <xsl:call-template name="refine_fn-reference-style"/>
5159
5318
 
5160
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5161
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5162
- <xsl:attribute name="internal-destination">
5319
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5320
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5321
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5322
+ <!-- <xsl:attribute name="internal-destination">
5163
5323
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5164
5324
  </xsl:attribute>
5165
5325
  </xsl:if>
5326
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5327
+ <xsl:attribute name="internal-destination">
5328
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5329
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5330
+ </xsl:attribute>
5331
+ </xsl:if> -->
5332
+ <!-- <xsl:if test="$namespace = 'plateau'">
5333
+ <xsl:text>※</xsl:text>
5334
+ </xsl:if> -->
5335
+ <!-- <xsl:value-of select="@reference"/> -->
5166
5336
 
5167
- <xsl:value-of select="@reference"/>
5337
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5168
5338
 
5339
+ <!-- <xsl:if test="$namespace = 'bsi'">
5340
+ <xsl:text>)</xsl:text>
5341
+ </xsl:if> -->
5169
5342
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5170
5343
  <!-- <xsl:if test="$namespace = 'jis'">
5171
5344
  <fo:inline font-weight="normal">)</fo:inline>
5172
5345
  </xsl:if> -->
5173
5346
  </fo:basic-link>
5174
5347
  </fo:inline>
5175
- </xsl:template>
5348
+ </xsl:template> <!-- fn -->
5176
5349
 
5350
+ <!-- fn/text() -->
5177
5351
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
5178
5352
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
5179
5353
  </xsl:template>
5180
5354
 
5181
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
5355
+ <!-- fn//p fmt-fn-body//p -->
5356
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
5182
5357
  <fo:inline role="P">
5183
5358
  <xsl:apply-templates/>
5184
5359
  </fo:inline>
5185
5360
  </xsl:template>
5361
+
5362
+ <xsl:template name="insertFootnoteSeparatorCommon">
5363
+ <xsl:param name="leader_length">30%</xsl:param>
5364
+ <fo:static-content flow-name="xsl-footnote-separator">
5365
+ <fo:block>
5366
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
5367
+ </fo:block>
5368
+ </fo:static-content>
5369
+ </xsl:template>
5370
+
5186
5371
  <!-- ===================== -->
5187
5372
  <!-- END Footnotes processing -->
5188
5373
  <!-- ===================== -->
@@ -5459,11 +5644,11 @@
5459
5644
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
5460
5645
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
5461
5646
 
5462
- <xsl:call-template name="setColumnWidth_dl">
5463
- <xsl:with-param name="colwidths" select="$colwidths"/>
5464
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5465
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5466
- </xsl:call-template>
5647
+ <xsl:call-template name="setColumnWidth_dl">
5648
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5649
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5650
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5651
+ </xsl:call-template>
5467
5652
 
5468
5653
  <fo:table-body>
5469
5654
 
@@ -5497,6 +5682,14 @@
5497
5682
 
5498
5683
  </xsl:template> <!-- END: dl -->
5499
5684
 
5685
+ <xsl:template match="@*|node()" mode="dt_clean">
5686
+ <xsl:copy>
5687
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
5688
+ </xsl:copy>
5689
+ </xsl:template>
5690
+
5691
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
5692
+
5500
5693
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
5501
5694
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
5502
5695
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -5529,10 +5722,12 @@
5529
5722
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5530
5723
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5531
5724
 
5725
+ <!-- dl/name -->
5532
5726
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5533
5727
  <xsl:param name="process">false</xsl:param>
5534
5728
  <xsl:if test="$process = 'true'">
5535
5729
  <fo:block xsl:use-attribute-sets="dl-name-style">
5730
+
5536
5731
  <xsl:apply-templates/>
5537
5732
  </fo:block>
5538
5733
  </xsl:if>
@@ -5546,6 +5741,10 @@
5546
5741
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5547
5742
 
5548
5743
  <xsl:choose>
5744
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
5745
+ <fo:table-column column-width="10%"/>
5746
+ <fo:table-column column-width="90%"/>
5747
+ </xsl:when> -->
5549
5748
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5550
5749
  <xsl:call-template name="insertTableColumnWidth">
5551
5750
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -6349,7 +6548,7 @@
6349
6548
  <xsl:choose>
6350
6549
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
6351
6550
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
6352
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
6551
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
6353
6552
  </xsl:when>
6354
6553
  <xsl:otherwise>
6355
6554
  <xsl:apply-templates/>
@@ -6357,7 +6556,7 @@
6357
6556
  </xsl:choose>
6358
6557
  </xsl:template>
6359
6558
  <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
6360
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6559
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
6361
6560
  </xsl:template>
6362
6561
 
6363
6562
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -7397,24 +7596,26 @@
7397
7596
  <xsl:apply-templates select="." mode="mathml"/>
7398
7597
  </xsl:variable>
7399
7598
 
7400
- <fo:instream-foreign-object fox:alt-text="Math">
7599
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
7401
7600
 
7402
7601
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
7403
7602
 
7404
- <!-- put MathML in Actual Text -->
7405
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7406
- <xsl:attribute name="fox:actual-text">
7407
- <xsl:value-of select="$mathml_content"/>
7408
- </xsl:attribute>
7409
-
7410
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7411
- <xsl:if test="normalize-space($asciimath_text_) != ''">
7412
- <!-- put Mathin Alternate Text -->
7413
- <xsl:attribute name="fox:alt-text">
7414
- <xsl:value-of select="$asciimath_text_"/>
7603
+ <xsl:if test="$isGenerateTableIF = 'false'">
7604
+ <!-- put MathML in Actual Text -->
7605
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7606
+ <xsl:attribute name="fox:actual-text">
7607
+ <xsl:value-of select="$mathml_content"/>
7415
7608
  </xsl:attribute>
7609
+
7610
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7611
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
7612
+ <!-- put Mathin Alternate Text -->
7613
+ <xsl:attribute name="fox:alt-text">
7614
+ <xsl:value-of select="$asciimath_text_"/>
7615
+ </xsl:attribute>
7616
+ </xsl:if>
7617
+ <!-- </xsl:if> -->
7416
7618
  </xsl:if>
7417
- <!-- </xsl:if> -->
7418
7619
 
7419
7620
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
7420
7621
 
@@ -7677,6 +7878,27 @@
7677
7878
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7678
7879
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7679
7880
  </xsl:when> -->
7881
+
7882
+ <!-- <xsl:when test="not(starts-with(@target, 'http:') or starts-with(@target, 'https') or starts-with(@target, 'www') or starts-with(@target, 'mailto') or starts-with(@target, 'ftp'))">
7883
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7884
+ <xsl:variable name="filename">
7885
+ <xsl:call-template name="substring-after-last">
7886
+ <xsl:with-param name="value" select="$target_"/>
7887
+ <xsl:with-param name="delimiter" select="'/'"/>
7888
+ </xsl:call-template>
7889
+ </xsl:variable>
7890
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
7891
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
7892
+ <xsl:choose>
7893
+ <xsl:when test="$file_exists = 'true'">
7894
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
7895
+ </xsl:when>
7896
+ <xsl:otherwise>
7897
+ <xsl:value-of select="normalize-space(@target)"/>
7898
+ </xsl:otherwise>
7899
+ </xsl:choose>
7900
+ </xsl:when> -->
7901
+
7680
7902
  <xsl:otherwise>
7681
7903
  <xsl:value-of select="normalize-space(@target)"/>
7682
7904
  </xsl:otherwise>
@@ -7981,7 +8203,7 @@
7981
8203
 
7982
8204
  <xsl:template name="refine_note_block_style">
7983
8205
 
7984
- </xsl:template>
8206
+ </xsl:template> <!-- refine_note_block_style -->
7985
8207
 
7986
8208
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7987
8209
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -8174,10 +8396,21 @@
8174
8396
  </xsl:template>
8175
8397
 
8176
8398
  <xsl:template name="showFigureKey">
8177
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8178
- <xsl:call-template name="note"/>
8399
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
8400
+ <xsl:choose>
8401
+ <xsl:when test="local-name() = 'note'">
8402
+ <xsl:call-template name="note"/>
8403
+ </xsl:when>
8404
+ <xsl:when test="local-name() = 'example'">
8405
+ <xsl:call-template name="example"/>
8406
+ </xsl:when>
8407
+ <xsl:otherwise>
8408
+ <xsl:apply-templates select="."/>
8409
+ </xsl:otherwise>
8410
+ </xsl:choose>
8179
8411
  </xsl:for-each>
8180
- <xsl:call-template name="fn_display_figure"/>
8412
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
8413
+ <xsl:call-template name="figure_fn_display"/>
8181
8414
  </xsl:template>
8182
8415
 
8183
8416
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9071,10 +9304,10 @@
9071
9304
  <xsl:when test="@type = 'section-title'">
9072
9305
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9073
9306
  <xsl:text>: </xsl:text>
9074
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9307
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9075
9308
  </xsl:when>
9076
9309
  <xsl:otherwise>
9077
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9310
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9078
9311
  </xsl:otherwise>
9079
9312
  </xsl:choose>
9080
9313
  </xsl:when>
@@ -9139,6 +9372,8 @@
9139
9372
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
9140
9373
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
9141
9374
 
9375
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
9376
+
9142
9377
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
9143
9378
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
9144
9379
  <xsl:apply-templates mode="bookmarks"/>
@@ -9160,6 +9395,8 @@
9160
9395
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
9161
9396
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
9162
9397
 
9398
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
9399
+
9163
9400
  <!-- Bookmarks -->
9164
9401
  <xsl:template name="addBookmarks">
9165
9402
  <xsl:param name="contents"/>
@@ -9405,9 +9642,15 @@
9405
9642
  </xsl:if>
9406
9643
  </xsl:template>
9407
9644
 
9645
+ <!-- figure/fn -->
9408
9646
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
9409
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
9647
+ <!-- figure/note -->
9648
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
9649
+ <!-- figure/example -->
9650
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
9410
9651
 
9652
+ <!-- figure/note[@type = 'units'] -->
9653
+ <!-- image/note[@type = 'units'] -->
9411
9654
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
9412
9655
  <fo:block text-align="right" keep-with-next="always">
9413
9656
  <xsl:apply-templates/>
@@ -9528,6 +9771,7 @@
9528
9771
  </xsl:choose>
9529
9772
  </xsl:template>
9530
9773
 
9774
+ <!-- fn -->
9531
9775
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
9532
9776
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
9533
9777
 
@@ -10428,7 +10672,7 @@
10428
10672
  text line 1
10429
10673
  text line 2
10430
10674
  -->
10431
- <xsl:template match="*[local-name() = 'example']">
10675
+ <xsl:template match="*[local-name() = 'example']" name="example">
10432
10676
 
10433
10677
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10434
10678
 
@@ -10534,6 +10778,7 @@
10534
10778
 
10535
10779
  </xsl:template>
10536
10780
 
10781
+ <!-- example/name -->
10537
10782
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
10538
10783
  <xsl:param name="fo_element">block</xsl:param>
10539
10784
 
@@ -10559,7 +10804,8 @@
10559
10804
 
10560
10805
  </xsl:template>
10561
10806
 
10562
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
10807
+ <!-- table/example/name, table/tfoot//example/name -->
10808
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
10563
10809
  <fo:inline xsl:use-attribute-sets="example-name-style">
10564
10810
 
10565
10811
  <xsl:apply-templates/>
@@ -11031,21 +11277,32 @@
11031
11277
  <!-- ========== -->
11032
11278
 
11033
11279
  <xsl:variable name="reviews_">
11034
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
11280
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
11035
11281
  <xsl:copy>
11036
11282
  <xsl:copy-of select="@from"/>
11037
11283
  <xsl:copy-of select="@id"/>
11038
11284
  </xsl:copy>
11039
11285
  </xsl:for-each>
11286
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
11287
+ <xsl:copy>
11288
+ <xsl:copy-of select="@source"/>
11289
+ <xsl:copy-of select="@id"/>
11290
+ </xsl:copy>
11291
+ </xsl:for-each>
11040
11292
  </xsl:variable>
11041
11293
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11042
11294
 
11043
11295
  <xsl:template name="addReviewHelper">
11044
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11045
- <xsl:variable name="curr_id" select="@id"/>
11046
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11047
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11048
- <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11296
+ <xsl:if test="$isGenerateTableIF = 'false'">
11297
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11298
+ <xsl:variable name="curr_id" select="@id"/>
11299
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
11300
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
11301
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
11302
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11303
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11304
+ </xsl:if>
11305
+ </xsl:for-each>
11049
11306
  </xsl:if>
11050
11307
  <!-- <fo:block>
11051
11308
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -11187,14 +11444,61 @@
11187
11444
 
11188
11445
  </xsl:template>
11189
11446
 
11190
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11447
+ <!-- document text (not figures, or tables) footnotes -->
11448
+ <xsl:variable name="reviews_container_">
11449
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
11450
+ <xsl:variable name="update_xml_step1">
11451
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
11452
+ </xsl:variable>
11453
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
11454
+ </xsl:for-each>
11455
+ </xsl:variable>
11456
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
11457
+
11458
+ <xsl:template match="*[local-name() = 'review-container']"/>
11459
+
11460
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
11461
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11462
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11463
+ <xsl:if test="$isGenerateTableIF = 'false'">
11464
+ <xsl:choose>
11465
+ <!-- if there isn't the attribute '@from', then -->
11466
+ <xsl:when test="$id_from = ''">
11467
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11468
+ </xsl:when>
11469
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11470
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11471
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11472
+ </xsl:when>
11473
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11474
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11475
+ </xsl:when>
11476
+ </xsl:choose>
11477
+ </xsl:if>
11478
+ </xsl:template>
11479
+
11480
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
11481
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11191
11482
  <!-- comment 2019-11-29 -->
11192
11483
  <!-- <fo:block font-weight="bold">Review:</fo:block>
11193
11484
  <xsl:apply-templates /> -->
11194
11485
 
11195
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11486
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
11196
11487
 
11197
- <xsl:if test="1 = 1">
11488
+ <xsl:variable name="source" select="normalize-space(@source)"/>
11489
+
11490
+ <xsl:if test="$isGenerateTableIF = 'false'">
11491
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
11492
+
11493
+ <!-- <xsl:if test="@source = @end"> -->
11494
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
11495
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
11496
+ <!-- <fo:block id="{$source}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$source}" fox:alt-text="Annot___{$source}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block> -->
11497
+ <fo:block id="{@id}" font-size="1pt" role="SKIP" keep-with-next="always" line-height="0.1"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11498
+ <!-- </xsl:if> -->
11499
+ </xsl:if>
11500
+
11501
+ <xsl:if test="1 = 2">
11198
11502
  <xsl:choose>
11199
11503
  <!-- if there isn't the attribute '@from', then -->
11200
11504
  <xsl:when test="$id_from = ''">
@@ -11202,10 +11506,10 @@
11202
11506
  </xsl:when>
11203
11507
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11204
11508
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11205
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11509
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11206
11510
  </xsl:when>
11207
11511
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11208
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11512
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11209
11513
  </xsl:when>
11210
11514
  </xsl:choose>
11211
11515
  </xsl:if>
@@ -11256,16 +11560,21 @@
11256
11560
  <xsl:variable name="list_level">
11257
11561
  <xsl:choose>
11258
11562
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
11259
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
11563
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
11564
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
11565
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
11260
11566
  </xsl:choose>
11261
11567
  </xsl:variable>
11262
11568
  <xsl:choose>
11263
11569
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
11264
11570
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
11265
11571
  </xsl:when>
11266
- <xsl:when test="$list_level mod 3 = 0">
11572
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
11267
11573
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
11268
11574
  </xsl:when>
11575
+ <xsl:when test="$list_level mod 3 = 0">
11576
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
11577
+ </xsl:when>
11269
11578
  <xsl:when test="$list_level mod 2 = 0">
11270
11579
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
11271
11580
  </xsl:when>
@@ -11808,10 +12117,22 @@
11808
12117
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
11809
12118
 
11810
12119
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
11811
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11812
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
11813
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11814
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12120
+ <xsl:variable name="bookmark_id" select="@id"/>
12121
+ <xsl:choose>
12122
+ <!-- Example:
12123
+ <fmt-review-start id="_7ef81cf7-3f6c-4ed4-9c1f-1ba092052bbd" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" end="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/>
12124
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
12125
+ <fmt-review-end id="_f336a8d0-08a8-4b7f-a1aa-b04688ed40c1" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" start="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/> -->
12126
+ <xsl:when test="1 = 2 and preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]">
12127
+ <!-- skip here, see the template 'fmt-review-start' -->
12128
+ </xsl:when>
12129
+ <xsl:otherwise>
12130
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12131
+ <fo:inline id="{@id}" font-size="1pt"><xsl:if test="preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]"><xsl:attribute name="line-height">0.1</xsl:attribute></xsl:if><xsl:value-of select="$hair_space"/></fo:inline>
12132
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12133
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12134
+ </xsl:otherwise>
12135
+ </xsl:choose>
11815
12136
  </xsl:template>
11816
12137
  <!-- =================== -->
11817
12138
  <!-- End of Index processing -->
@@ -12189,8 +12510,33 @@
12189
12510
 
12190
12511
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
12191
12512
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12513
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12514
+ <!-- <test><xsl:copy-of select="."/></test> -->
12515
+
12192
12516
  <xsl:variable name="target" select="@target"/>
12517
+
12193
12518
  <xsl:for-each select="*[local-name() = 'tab']">
12519
+
12520
+ <xsl:if test="position() = 1">
12521
+ <!-- first column (data before first `tab`) -->
12522
+ <fo:table-cell>
12523
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
12524
+ <xsl:call-template name="insert_basic_link">
12525
+ <xsl:with-param name="element">
12526
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12527
+ <xsl:for-each select="preceding-sibling::node()">
12528
+ <xsl:choose>
12529
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12530
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12531
+ </xsl:choose>
12532
+ </xsl:for-each>
12533
+ </fo:basic-link>
12534
+ </xsl:with-param>
12535
+ </xsl:call-template>
12536
+ </fo:block>
12537
+ </fo:table-cell>
12538
+ </xsl:if>
12539
+
12194
12540
  <xsl:variable name="current_id" select="generate-id()"/>
12195
12541
  <fo:table-cell>
12196
12542
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -12241,11 +12587,25 @@
12241
12587
 
12242
12588
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
12243
12589
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12590
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12244
12591
  <xsl:for-each select="*[local-name() = 'tab']">
12592
+ <xsl:if test="position() = 1">
12593
+ <td>
12594
+ <xsl:for-each select="preceding-sibling::node()">
12595
+ <xsl:choose>
12596
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12597
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
12598
+ </xsl:choose>
12599
+ </xsl:for-each>
12600
+ </td>
12601
+ </xsl:if>
12245
12602
  <xsl:variable name="current_id" select="generate-id()"/>
12246
12603
  <td>
12247
12604
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12248
- <xsl:copy-of select="."/>
12605
+ <xsl:choose>
12606
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12607
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
12608
+ </xsl:choose>
12249
12609
  </xsl:for-each>
12250
12610
  </td>
12251
12611
  </xsl:for-each>
@@ -13116,6 +13476,9 @@
13116
13476
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
13117
13477
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
13118
13478
 
13479
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
13480
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
13481
+
13119
13482
  <!-- END: update new Presentation XML -->
13120
13483
 
13121
13484
  <!-- =========================================================================== -->
@@ -13639,6 +14002,7 @@
13639
14002
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13640
14003
  </fn>
13641
14004
  -->
14005
+ <!-- fn in text -->
13642
14006
  <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">
13643
14007
  <xsl:variable name="p_fn_">
13644
14008
  <xsl:call-template name="get_fn_list"/>