metanorma-jis 0.5.1 → 0.5.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.
@@ -2321,7 +2321,8 @@
2321
2321
  </xsl:template>
2322
2322
 
2323
2323
  <xsl:template name="fn_jis">
2324
- <fo:block-container margin-left="11mm" margin-bottom="4pt" id="{@ref_id}">
2324
+ <xsl:variable name="ref_id" select="@target"/>
2325
+ <fo:block-container margin-left="11mm" margin-bottom="4pt" id="{$ref_id}">
2325
2326
  <xsl:if test="position() = last()">
2326
2327
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2327
2328
  </xsl:if>
@@ -2329,11 +2330,13 @@
2329
2330
  <fo:list-block provisional-distance-between-starts="10mm">
2330
2331
  <fo:list-item>
2331
2332
  <fo:list-item-label end-indent="label-end()">
2332
- <fo:block xsl:use-attribute-sets="note-name-style">注 <fo:inline xsl:use-attribute-sets="fn-num-style"><xsl:value-of select="@current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></fo:inline></fo:block>
2333
+ <xsl:variable name="current_fn_number" select="translate(normalize-space(jis:fmt-fn-label), ')', '')"/>
2334
+ <fo:block xsl:use-attribute-sets="note-name-style">注 <fo:inline xsl:use-attribute-sets="fn-num-style"><xsl:value-of select="$current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></fo:inline></fo:block>
2333
2335
  </fo:list-item-label>
2334
2336
  <fo:list-item-body start-indent="body-start()">
2335
2337
  <fo:block>
2336
- <xsl:apply-templates/>
2338
+ <!-- <xsl:apply-templates /> -->
2339
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
2337
2340
  </fo:block>
2338
2341
  </fo:list-item-body>
2339
2342
  </fo:list-item>
@@ -2342,6 +2345,20 @@
2342
2345
  </fo:block-container>
2343
2346
  </xsl:template>
2344
2347
 
2348
+ <!-- <fmt-fn-label>注<sup> -->
2349
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']/node()[1][self::text()]" priority="5">
2350
+ <fo:inline font-size="9pt" padding-right="1mm">
2351
+ <xsl:if test="not($vertical_layout = 'true')">
2352
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
2353
+ </xsl:if>
2354
+ <!-- <xsl:call-template name="getLocalizedString">
2355
+ <xsl:with-param name="key">table_footnote</xsl:with-param>
2356
+ </xsl:call-template> -->
2357
+ <xsl:value-of select="."/>
2358
+ </fo:inline>
2359
+ <!-- <xsl:text> </xsl:text> -->
2360
+ </xsl:template>
2361
+
2345
2362
  <!-- =========================================================================== -->
2346
2363
  <!-- STEP 0: Replace characters with vertical form -->
2347
2364
  <!-- =========================================================================== -->
@@ -6410,17 +6427,26 @@
6410
6427
  </xsl:template>
6411
6428
 
6412
6429
  <xsl:attribute-set name="table-fn-number-style">
6430
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
6431
+
6432
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
6433
+
6434
+ </xsl:attribute-set> <!-- table-fn-number-style -->
6435
+
6436
+ <xsl:attribute-set name="table-fmt-fn-label-style">
6413
6437
  <xsl:attribute name="font-size">80%</xsl:attribute>
6414
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
6415
6438
 
6416
- <xsl:attribute name="font-size">67%</xsl:attribute>
6417
6439
  <xsl:attribute name="font-weight">bold</xsl:attribute>
6440
+ <xsl:attribute name="font-size">67%</xsl:attribute>
6418
6441
  <xsl:attribute name="vertical-align">super</xsl:attribute>
6419
- <xsl:attribute name="padding-right">0mm</xsl:attribute>
6420
6442
 
6421
- </xsl:attribute-set> <!-- table-fn-number-style -->
6443
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
6422
6444
 
6423
- <xsl:template name="refine_table-fn-number-style">
6445
+ <xsl:template name="refine_table-fmt-fn-label-style">
6446
+
6447
+ <xsl:if test="not($vertical_layout = 'true')">
6448
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
6449
+ </xsl:if>
6424
6450
 
6425
6451
  </xsl:template>
6426
6452
 
@@ -6435,11 +6461,18 @@
6435
6461
  </xsl:attribute-set>
6436
6462
 
6437
6463
  <xsl:attribute-set name="figure-fn-number-style">
6438
- <xsl:attribute name="font-size">80%</xsl:attribute>
6439
6464
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
6465
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
6466
+
6467
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
6468
+ <xsl:attribute name="font-size">80%</xsl:attribute>
6440
6469
  <xsl:attribute name="vertical-align">super</xsl:attribute>
6441
6470
 
6442
- </xsl:attribute-set>
6471
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
6472
+
6473
+ <xsl:template name="refine_figure-fmt-fn-label-style">
6474
+
6475
+ </xsl:template>
6443
6476
 
6444
6477
  <xsl:attribute-set name="figure-fn-body-style">
6445
6478
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -8020,9 +8053,13 @@
8020
8053
 
8021
8054
  <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']"/>
8022
8055
  <xsl:if test="$isNoteOrFnExist = 'true'">
8023
-
8024
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
8025
-
8056
+ <!-- <xsl:choose>
8057
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
8058
+ <xsl:otherwise>
8059
+
8060
+ </xsl:otherwise>
8061
+ </xsl:choose> -->
8062
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
8026
8063
  </xsl:if>
8027
8064
 
8028
8065
  <xsl:choose>
@@ -8069,7 +8106,7 @@
8069
8106
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
8070
8107
  </xsl:when>
8071
8108
  <xsl:otherwise>
8072
- <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 -->
8109
+ <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 -->
8073
8110
  </xsl:otherwise>
8074
8111
  </xsl:choose>
8075
8112
 
@@ -8080,13 +8117,26 @@
8080
8117
 
8081
8118
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
8082
8119
 
8083
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
8084
- <xsl:call-template name="insertTableFooterInSeparateTable">
8085
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
8086
- <xsl:with-param name="colwidths" select="$colwidths"/>
8087
- <xsl:with-param name="colgroup" select="$colgroup"/>
8088
- </xsl:call-template>
8089
- </xsl:for-each>
8120
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
8121
+
8122
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
8123
+ <xsl:call-template name="insertTableFooterInSeparateTable">
8124
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
8125
+ <xsl:with-param name="colwidths" select="$colwidths"/>
8126
+ <xsl:with-param name="colgroup" select="$colgroup"/>
8127
+ </xsl:call-template>
8128
+ </xsl:for-each>
8129
+
8130
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
8131
+ <xsl:if test="$namespace = 'plateau'">
8132
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
8133
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
8134
+ <xsl:variable name="table_fn_block">
8135
+ <xsl:call-template name="table_fn_display" />
8136
+ </xsl:variable>
8137
+ <xsl:copy-of select="$table_fn_block"/>
8138
+ </xsl:for-each>
8139
+ </xsl:if> -->
8090
8140
 
8091
8141
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
8092
8142
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -8869,6 +8919,8 @@
8869
8919
 
8870
8920
  <xsl:template name="setTableRowAttributes">
8871
8921
 
8922
+ <xsl:call-template name="setColors"/>
8923
+
8872
8924
  </xsl:template> <!-- setTableRowAttributes -->
8873
8925
  <!-- ===================== -->
8874
8926
  <!-- END Table's row processing -->
@@ -8920,6 +8972,7 @@
8920
8972
  </xsl:attribute>
8921
8973
  </xsl:if>
8922
8974
  <xsl:call-template name="display-align"/>
8975
+ <xsl:call-template name="setColors"/>
8923
8976
  </xsl:template>
8924
8977
 
8925
8978
  <xsl:template name="display-align">
@@ -8935,6 +8988,29 @@
8935
8988
  </xsl:if>
8936
8989
  </xsl:template>
8937
8990
 
8991
+ <xsl:template name="setColors">
8992
+ <xsl:variable name="styles__">
8993
+ <xsl:call-template name="split">
8994
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
8995
+ <xsl:with-param name="sep" select="';'"/>
8996
+ </xsl:call-template>
8997
+ </xsl:variable>
8998
+ <xsl:variable name="quot">"</xsl:variable>
8999
+ <xsl:variable name="styles_">
9000
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
9001
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
9002
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
9003
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
9004
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
9005
+ </xsl:if>
9006
+ </xsl:for-each>
9007
+ </xsl:variable>
9008
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
9009
+ <xsl:for-each select="$styles/style">
9010
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
9011
+ </xsl:for-each>
9012
+ </xsl:template>
9013
+
8938
9014
  <!-- cell in table body, footer -->
8939
9015
  <xsl:template match="*[local-name()='td']" name="td">
8940
9016
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -8946,17 +9022,28 @@
8946
9022
 
8947
9023
  <xsl:call-template name="refine_table-cell-style"/>
8948
9024
 
9025
+ <xsl:call-template name="setTableCellAttributes"/>
9026
+
8949
9027
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
8950
9028
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
8951
9029
  </xsl:if>
8952
9030
 
8953
- <xsl:call-template name="setTableCellAttributes"/>
8954
-
8955
9031
  <xsl:if test="$isGenerateTableIF = 'true'">
8956
9032
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
8957
9033
  <xsl:attribute name="text-align">left</xsl:attribute>
8958
9034
  </xsl:if>
8959
9035
 
9036
+ <xsl:if test="$isGenerateTableIF = 'false'">
9037
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
9038
+ <xsl:attribute name="text-align">right</xsl:attribute>
9039
+ <xsl:attribute name="border">none</xsl:attribute>
9040
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
9041
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
9042
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
9043
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
9044
+ </xsl:if>
9045
+ </xsl:if>
9046
+
8960
9047
  <fo:block role="SKIP">
8961
9048
 
8962
9049
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -8978,7 +9065,8 @@
8978
9065
  </fo:table-cell>
8979
9066
  </xsl:template> <!-- td -->
8980
9067
 
8981
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
9068
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
9069
+ <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">
8982
9070
 
8983
9071
  <fo:list-block id="{@id}" xsl:use-attribute-sets="table-note-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
8984
9072
  <fo:list-item>
@@ -8998,51 +9086,46 @@
8998
9086
 
8999
9087
  </xsl:template> <!-- table/note -->
9000
9088
 
9001
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
9089
+ <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">
9002
9090
  <xsl:apply-templates/>
9003
9091
  </xsl:template>
9004
9092
 
9005
9093
  <!-- ===================== -->
9006
9094
  <!-- Footnotes processing -->
9007
9095
  <!-- ===================== -->
9096
+
9097
+ <!-- document text (not figures, or tables) footnotes -->
9098
+ <xsl:variable name="footnotes_">
9099
+ <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 -->
9100
+ <!-- <xsl:copy-of select="."/> -->
9101
+ <xsl:variable name="update_xml_step1">
9102
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
9103
+ </xsl:variable>
9104
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
9105
+ </xsl:for-each>
9106
+ </xsl:variable>
9107
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
9108
+
9008
9109
  <!--
9009
9110
  <fn reference="1">
9010
9111
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
9011
9112
  </fn>
9012
9113
  -->
9013
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
9114
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
9115
+ <!-- fn in text -->
9014
9116
  <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">
9015
9117
 
9016
- <!-- list of footnotes to calculate actual footnotes number -->
9118
+ <!-- list of unique footnotes -->
9017
9119
  <xsl:variable name="p_fn_">
9018
9120
  <xsl:call-template name="get_fn_list"/>
9019
- <!-- <xsl:choose>
9020
- <xsl:when test="$namespace = 'jis'">
9021
- <xsl:call-template name="get_fn_list_for_element"/>
9022
- </xsl:when>
9023
- <xsl:otherwise>
9024
- <xsl:call-template name="get_fn_list"/>
9025
- </xsl:otherwise>
9026
- </xsl:choose> -->
9027
9121
  </xsl:variable>
9028
9122
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9029
9123
 
9030
9124
  <xsl:variable name="gen_id" select="generate-id(.)"/>
9031
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9032
- <xsl:variable name="reference_">
9033
- <xsl:value-of select="@reference"/>
9034
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
9035
- </xsl:variable>
9036
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
9125
+
9037
9126
  <!-- fn sequence number in document -->
9038
- <xsl:variable name="current_fn_number">
9039
- <xsl:choose>
9040
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9041
- <xsl:otherwise>
9042
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
9043
- </xsl:otherwise>
9044
- </xsl:choose>
9045
- </xsl:variable>
9127
+ <xsl:variable name="current_fn_number" select="@reference"/>
9128
+
9046
9129
  <xsl:variable name="current_fn_number_text">
9047
9130
 
9048
9131
  <xsl:choose>
@@ -9051,19 +9134,13 @@
9051
9134
  <xsl:value-of select="$numbers_japanese//jis:localized-string[@key = $current_fn_number]"/>
9052
9135
  <xsl:text> </xsl:text>
9053
9136
  </xsl:when>
9054
- <xsl:otherwise><xsl:value-of select="$current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></xsl:otherwise>
9137
+ <xsl:otherwise><xsl:value-of select="translate($current_fn_number, ')', '')"/><fo:inline font-weight="normal">)</fo:inline></xsl:otherwise>
9055
9138
  </xsl:choose>
9056
9139
 
9057
9140
  </xsl:variable>
9058
9141
 
9059
- <xsl:variable name="ref_id">
9060
- <xsl:choose>
9061
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
9062
- <xsl:otherwise>
9063
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
9064
- </xsl:otherwise>
9065
- </xsl:choose>
9066
- </xsl:variable>
9142
+ <xsl:variable name="ref_id" select="@target"/>
9143
+
9067
9144
  <xsl:variable name="footnote_inline">
9068
9145
  <fo:inline role="Reference">
9069
9146
 
@@ -9109,15 +9186,19 @@
9109
9186
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
9110
9187
 
9111
9188
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9112
- <xsl:call-template name="insertVerticalChar">
9113
- <xsl:with-param name="str" select="'〔'"/>
9114
- </xsl:call-template>
9189
+ <fo:inline font-family="IPAexGothic">
9190
+ <xsl:call-template name="insertVerticalChar">
9191
+ <xsl:with-param name="str" select="'〔'"/>
9192
+ </xsl:call-template>
9193
+ </fo:inline>
9115
9194
 
9116
9195
  <xsl:copy-of select="$current_fn_number_text"/>
9117
9196
 
9118
- <xsl:call-template name="insertVerticalChar">
9119
- <xsl:with-param name="str" select="'〕'"/>
9120
- </xsl:call-template>
9197
+ <fo:inline font-family="IPAexGothic">
9198
+ <xsl:call-template name="insertVerticalChar">
9199
+ <xsl:with-param name="str" select="'〕'"/>
9200
+ </xsl:call-template>
9201
+ </fo:inline>
9121
9202
 
9122
9203
  </fo:inline>
9123
9204
  </fo:basic-link>
@@ -9130,7 +9211,9 @@
9130
9211
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
9131
9212
  <xsl:copy-of select="$footnote_inline"/>
9132
9213
  </xsl:when>
9214
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
9133
9215
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
9216
+
9134
9217
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
9135
9218
  <xsl:copy-of select="$footnote_inline"/>
9136
9219
  <fo:footnote-body role="Note">
@@ -9147,7 +9230,10 @@
9147
9230
  <xsl:value-of select="$current_fn_number_text"/>
9148
9231
 
9149
9232
  </fo:inline>
9150
- <xsl:apply-templates/>
9233
+ <!-- <xsl:apply-templates /> -->
9234
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
9235
+ <here><xsl:copy-of select="$footnotes"/></here> -->
9236
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
9151
9237
  </xsl:variable>
9152
9238
 
9153
9239
  <xsl:choose>
@@ -9176,14 +9262,16 @@
9176
9262
  </fo:list-item-label>
9177
9263
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style" role="SKIP">
9178
9264
  <fo:block role="SKIP">
9179
- <xsl:apply-templates/>
9265
+ <!-- <xsl:apply-templates /> -->
9266
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
9180
9267
  </fo:block>
9181
9268
  </fo:list-item-body>
9182
9269
  </fo:list-item>
9183
9270
  </fo:list-block>
9184
- </xsl:when>
9271
+ </xsl:when> <!-- $vertical_layout = 'true' -->
9185
9272
  <xsl:otherwise>
9186
9273
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
9274
+ <xsl:attribute name="text-align">left</xsl:attribute> <!-- because footer is centered -->
9187
9275
  <xsl:copy-of select="$fn_block"/>
9188
9276
  </fo:block>
9189
9277
  </xsl:otherwise>
@@ -9237,48 +9325,40 @@
9237
9325
  </xsl:choose>
9238
9326
  </xsl:template>
9239
9327
 
9240
- <xsl:template name="get_fn_list_for_element">
9241
- <xsl:choose>
9242
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
9243
- <fn gen_id="{generate-id(.)}">
9244
- <xsl:copy-of select="@*"/>
9245
- <xsl:copy-of select="node()"/>
9246
- </fn>
9247
- </xsl:when>
9248
- <xsl:otherwise>
9249
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
9250
- <xsl:variable name="element_id" select="@id"/>
9251
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
9252
- <!-- copy unique fn -->
9253
- <fn gen_id="{generate-id(.)}">
9254
- <xsl:copy-of select="@*"/>
9255
- <xsl:copy-of select="node()"/>
9256
- </fn>
9257
- </xsl:for-each>
9258
- </xsl:for-each>
9259
- </xsl:otherwise>
9260
- </xsl:choose>
9261
- </xsl:template>
9262
9328
  <!-- ============================ -->
9263
9329
  <!-- table's footnotes rendering -->
9264
9330
  <!-- ============================ -->
9265
- <xsl:template name="table_fn_display">
9266
- <xsl:variable name="references">
9267
9331
 
9332
+ <!-- table/fmt-footnote-container -->
9333
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
9334
+
9335
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
9336
+ <xsl:for-each select=".">
9337
+ <xsl:call-template name="table_fn_display"/>
9338
+ </xsl:for-each>
9339
+ </xsl:template>
9340
+
9341
+ <xsl:template name="table_fn_display">
9342
+ <!-- <xsl:variable name="references">
9343
+ <xsl:if test="$namespace = 'bsi'">
9344
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
9345
+ <xsl:call-template name="create_fn" />
9346
+ </xsl:for-each>
9347
+ </xsl:if>
9268
9348
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
9269
- <xsl:call-template name="create_fn"/>
9349
+ <xsl:call-template name="create_fn" />
9270
9350
  </xsl:for-each>
9271
- </xsl:variable>
9272
-
9273
- <xsl:for-each select="xalan:nodeset($references)//fn">
9351
+ </xsl:variable> -->
9352
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
9274
9353
  <xsl:variable name="reference" select="@reference"/>
9275
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
9354
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
9355
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
9276
9356
 
9277
9357
  <fo:list-block id="{@id}" xsl:use-attribute-sets="table-fn-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
9278
9358
  <fo:list-item>
9279
9359
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
9280
9360
  <fo:block>
9281
- <fo:inline font-size="9pt">
9361
+ <!-- <fo:inline font-size="9pt">
9282
9362
  <xsl:if test="not($vertical_layout = 'true')">
9283
9363
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
9284
9364
  </xsl:if>
@@ -9286,40 +9366,127 @@
9286
9366
  <xsl:with-param name="key">table_footnote</xsl:with-param>
9287
9367
  </xsl:call-template>
9288
9368
  </fo:inline>
9289
- <xsl:text> </xsl:text>
9290
- <fo:inline xsl:use-attribute-sets="table-fn-number-style">
9291
- <xsl:if test="not($vertical_layout = 'true')">
9369
+ <xsl:text> </xsl:text> -->
9370
+
9371
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9372
+ <xsl:with-param name="process">true</xsl:with-param>
9373
+ </xsl:apply-templates>
9374
+
9375
+ <!-- <fo:inline xsl:use-attribute-sets="table-fn-number-style table-fmt-fn-label-style"> -->
9376
+ <!-- <xsl:if test="not($vertical_layout = 'true')">
9292
9377
  <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
9293
- </xsl:if>
9294
- <xsl:value-of select="@reference"/>
9378
+ </xsl:if> -->
9379
+ <!-- <xsl:value-of select="@reference"/> -->
9380
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9381
+ <xsl:with-param name="process">true</xsl:with-param>
9382
+ </xsl:apply-templates> -->
9383
+ <!-- <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/> -->
9384
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9385
+ <xsl:with-param name="process">true</xsl:with-param>
9386
+ </xsl:apply-templates> -->
9387
+
9295
9388
  <!-- <fo:inline font-weight="normal">)</fo:inline> --> <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9296
- </fo:inline>
9389
+ <!-- </fo:inline> -->
9297
9390
  </fo:block>
9298
9391
  </fo:list-item-label>
9299
9392
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">
9300
9393
  <fo:block>
9301
- <xsl:copy-of select="./node()"/>
9394
+ <!-- <xsl:copy-of select="./node()"/> -->
9395
+ <xsl:apply-templates/>
9302
9396
  </fo:block>
9303
9397
  </fo:list-item-body>
9304
9398
  </fo:list-item>
9305
9399
  </fo:list-block>
9306
9400
  <!-- jis -->
9307
9401
 
9308
- </xsl:if>
9402
+ <!-- </xsl:if> -->
9309
9403
  </xsl:for-each>
9310
9404
  </xsl:template> <!-- table_fn_display -->
9311
9405
 
9406
+ <!-- fmt-fn-body/fmt-fn-label in text -->
9407
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
9408
+
9409
+ <!-- table//fmt-fn-body//fmt-fn-label -->
9410
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
9411
+ <xsl:param name="process">false</xsl:param>
9412
+ <xsl:if test="$process = 'true'">
9413
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
9414
+
9415
+ <!-- tab is padding-right -->
9416
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
9417
+ <xsl:with-param name="process">true</xsl:with-param>
9418
+ </xsl:apply-templates>
9419
+
9420
+ <!-- <xsl:if test="$namespace = 'bipm'">
9421
+ <fo:inline font-style="normal">(</fo:inline>
9422
+ </xsl:if> -->
9423
+
9424
+ <!-- <xsl:if test="$namespace = 'plateau'">
9425
+ <xsl:text>※</xsl:text>
9426
+ </xsl:if> -->
9427
+
9428
+ <!-- <xsl:value-of select="@reference"/> -->
9429
+ <!-- <xsl:value-of select="normalize-space()"/> -->
9430
+ <xsl:apply-templates/>
9431
+
9432
+ <!-- <xsl:if test="$namespace = 'bipm'">
9433
+ <fo:inline font-style="normal">)</fo:inline>
9434
+ </xsl:if> -->
9435
+
9436
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
9437
+ <!-- <xsl:if test="$namespace = 'itu'">
9438
+ <xsl:text>)</xsl:text>
9439
+ </xsl:if> -->
9440
+
9441
+ <!-- <xsl:if test="$namespace = 'plateau'">
9442
+ <xsl:text>:</xsl:text>
9443
+ </xsl:if> -->
9444
+
9445
+ </fo:inline>
9446
+ </xsl:if>
9447
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
9448
+
9449
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
9450
+ <xsl:param name="process">false</xsl:param>
9451
+ <xsl:if test="$process = 'true'">
9452
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
9453
+
9454
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9455
+
9456
+ </xsl:if>
9457
+ </xsl:template>
9458
+
9459
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
9460
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
9461
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
9462
+ <xsl:apply-templates/>
9463
+ </fo:inline>
9464
+ </xsl:template>
9465
+
9466
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
9467
+ <!--
9312
9468
  <xsl:template name="create_fn">
9313
9469
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
9314
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
9470
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
9315
9471
  <xsl:attribute name="id">
9316
9472
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9317
9473
  </xsl:attribute>
9318
9474
  </xsl:if>
9319
-
9320
- <xsl:apply-templates/>
9475
+ <xsl:if test="$namespace = 'itu'">
9476
+ <xsl:if test="ancestor::*[local-name()='preface']">
9477
+ <xsl:attribute name="preface">true</xsl:attribute>
9478
+ </xsl:if>
9479
+ </xsl:if>
9480
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9481
+ <xsl:attribute name="id">
9482
+ <xsl:value-of select="@reference"/>
9483
+ <xsl:text>_</xsl:text>
9484
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9485
+ </xsl:attribute>
9486
+ </xsl:if>
9487
+ <xsl:apply-templates />
9321
9488
  </fn>
9322
- </xsl:template>
9489
+ </xsl:template> -->
9323
9490
 
9324
9491
  <!-- footnotes for table's name rendering -->
9325
9492
  <xsl:template name="table_name_fn_display">
@@ -9338,123 +9505,171 @@
9338
9505
  <!-- ============================ -->
9339
9506
  <!-- figure's footnotes rendering -->
9340
9507
  <!-- ============================ -->
9341
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
9342
9508
 
9343
- <!-- current figure id -->
9344
- <xsl:variable name="figure_id_">
9345
- <xsl:value-of select="@id"/>
9346
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
9347
- </xsl:variable>
9348
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
9509
+ <!-- figure/fmt-footnote-container -->
9510
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
9511
+
9512
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9513
+ <xsl:template name="figure_fn_display">
9349
9514
 
9350
- <!-- all footnotes relates to the current figure -->
9351
9515
  <xsl:variable name="references">
9352
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
9353
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
9354
- <xsl:apply-templates/>
9355
- </fn>
9516
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
9517
+ <xsl:variable name="curr_id" select="@id"/>
9518
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
9519
+ <curr><xsl:copy-of select="."/></curr>
9520
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
9521
+ <xsl:choose>
9522
+ <!-- skip figure/name/fn -->
9523
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
9524
+ <xsl:otherwise>
9525
+ <xsl:element name="figure" namespace="{$namespace_full}">
9526
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
9527
+ <xsl:copy-of select="."/>
9528
+ </xsl:element>
9529
+ </xsl:element>
9530
+ </xsl:otherwise>
9531
+ </xsl:choose>
9356
9532
  </xsl:for-each>
9357
9533
  </xsl:variable>
9534
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
9358
9535
 
9359
- <xsl:if test="xalan:nodeset($references)//fn">
9536
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
9360
9537
 
9361
9538
  <xsl:variable name="key_iso">
9362
9539
 
9363
9540
  </xsl:variable>
9364
9541
 
9365
9542
  <fo:block>
9543
+ <!-- current hierarchy is 'figure' element -->
9544
+ <xsl:variable name="following_dl_colwidths">
9545
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
9546
+ <xsl:variable name="simple-table">
9547
+ <!-- <xsl:variable name="doc_ns">
9548
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
9549
+ </xsl:variable>
9550
+ <xsl:variable name="ns">
9551
+ <xsl:choose>
9552
+ <xsl:when test="normalize-space($doc_ns) != ''">
9553
+ <xsl:value-of select="normalize-space($doc_ns)"/>
9554
+ </xsl:when>
9555
+ <xsl:otherwise>
9556
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
9557
+ </xsl:otherwise>
9558
+ </xsl:choose>
9559
+ </xsl:variable> -->
9366
9560
 
9367
- <!-- current hierarchy is 'figure' element -->
9368
- <xsl:variable name="following_dl_colwidths">
9369
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
9370
- <xsl:variable name="simple-table">
9371
- <!-- <xsl:variable name="doc_ns">
9372
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
9373
- </xsl:variable>
9374
- <xsl:variable name="ns">
9375
- <xsl:choose>
9376
- <xsl:when test="normalize-space($doc_ns) != ''">
9377
- <xsl:value-of select="normalize-space($doc_ns)"/>
9378
- </xsl:when>
9379
- <xsl:otherwise>
9380
- <xsl:value-of select="substring-before(name(/*), '-')"/>
9381
- </xsl:otherwise>
9382
- </xsl:choose>
9383
- </xsl:variable> -->
9561
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
9562
+ <tbody>
9563
+ <xsl:apply-templates mode="dl"/>
9564
+ </tbody>
9565
+ </xsl:for-each>
9566
+ </xsl:variable>
9384
9567
 
9385
- <xsl:for-each select="*[local-name() = 'dl'][1]">
9386
- <tbody>
9387
- <xsl:apply-templates mode="dl"/>
9388
- </tbody>
9389
- </xsl:for-each>
9390
- </xsl:variable>
9568
+ <xsl:call-template name="calculate-column-widths">
9569
+ <xsl:with-param name="cols-count" select="2"/>
9570
+ <xsl:with-param name="table" select="$simple-table"/>
9571
+ </xsl:call-template>
9391
9572
 
9392
- <xsl:call-template name="calculate-column-widths">
9393
- <xsl:with-param name="cols-count" select="2"/>
9394
- <xsl:with-param name="table" select="$simple-table"/>
9395
- </xsl:call-template>
9573
+ </xsl:if>
9574
+ </xsl:variable>
9396
9575
 
9397
- </xsl:if>
9398
- </xsl:variable>
9576
+ <xsl:variable name="maxlength_dt">
9577
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
9578
+ <xsl:call-template name="getMaxLength_dt"/>
9579
+ </xsl:for-each>
9580
+ </xsl:variable>
9399
9581
 
9400
- <xsl:variable name="maxlength_dt">
9401
- <xsl:for-each select="*[local-name() = 'dl'][1]">
9402
- <xsl:call-template name="getMaxLength_dt"/>
9403
- </xsl:for-each>
9404
- </xsl:variable>
9582
+ <fo:table width="95%" table-layout="fixed">
9583
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9584
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
9405
9585
 
9406
- <fo:table width="95%" table-layout="fixed">
9407
- <xsl:if test="normalize-space($key_iso) = 'true'">
9408
- <xsl:attribute name="font-size">10pt</xsl:attribute>
9586
+ </xsl:if>
9587
+ <xsl:choose>
9588
+ <!-- if there 'dl', then set same columns width -->
9589
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
9590
+ <xsl:call-template name="setColumnWidth_dl">
9591
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
9592
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
9593
+ </xsl:call-template>
9594
+ </xsl:when>
9595
+ <xsl:otherwise>
9596
+ <fo:table-column column-width="5%"/>
9597
+ <fo:table-column column-width="95%"/>
9598
+ </xsl:otherwise>
9599
+ </xsl:choose>
9600
+ <fo:table-body>
9601
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
9602
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
9409
9603
 
9410
- </xsl:if>
9411
- <xsl:choose>
9412
- <!-- if there 'dl', then set same columns width -->
9413
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
9414
- <xsl:call-template name="setColumnWidth_dl">
9415
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
9416
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
9417
- </xsl:call-template>
9418
- </xsl:when>
9419
- <xsl:otherwise>
9420
- <fo:table-column column-width="5%"/>
9421
- <fo:table-column column-width="95%"/>
9422
- </xsl:otherwise>
9423
- </xsl:choose>
9424
- <fo:table-body>
9425
- <xsl:for-each select="xalan:nodeset($references)//fn">
9426
- <xsl:variable name="reference" select="@reference"/>
9427
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
9428
- <fo:table-row>
9429
- <fo:table-cell>
9430
- <fo:block>
9431
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
9432
- <xsl:value-of select="@reference"/>
9604
+ <xsl:variable name="reference" select="@reference"/>
9605
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
9606
+ <fo:table-row>
9607
+ <fo:table-cell>
9608
+ <fo:block>
9609
+
9610
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
9611
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
9612
+ <!-- <xsl:value-of select="@reference"/> -->
9613
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
9433
9614
  </fo:inline>
9434
- </fo:block>
9435
- </fo:table-cell>
9436
- <fo:table-cell>
9437
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
9438
- <xsl:if test="normalize-space($key_iso) = 'true'">
9439
9615
 
9440
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
9616
+ </fo:block>
9617
+ </fo:table-cell>
9618
+ <fo:table-cell>
9619
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
9620
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9441
9621
 
9442
- </xsl:if>
9443
- <xsl:copy-of select="./node()"/>
9444
- </fo:block>
9445
- </fo:table-cell>
9446
- </fo:table-row>
9447
- </xsl:if>
9448
- </xsl:for-each>
9449
- </fo:table-body>
9450
- </fo:table>
9622
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
9623
+
9624
+ </xsl:if>
9451
9625
 
9626
+ <!-- <xsl:copy-of select="./node()"/> -->
9627
+ <xsl:apply-templates/>
9628
+ </fo:block>
9629
+ </fo:table-cell>
9630
+ </fo:table-row>
9631
+ <!-- </xsl:if> -->
9632
+ </xsl:for-each>
9633
+ </fo:table-body>
9634
+ </fo:table>
9452
9635
  </fo:block>
9453
9636
  </xsl:if>
9454
- </xsl:template> <!-- fn_display_figure -->
9637
+ </xsl:template> <!-- figure_fn_display -->
9638
+
9639
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
9640
+ <xsl:param name="process">false</xsl:param>
9641
+ <xsl:if test="$process = 'true'">
9642
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
9643
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9644
+
9645
+ <!-- tab is padding-right -->
9646
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
9647
+ <xsl:with-param name="process">true</xsl:with-param>
9648
+ </xsl:apply-templates>
9649
+
9650
+ <xsl:apply-templates/>
9651
+
9652
+ </fo:inline>
9653
+ </xsl:if>
9654
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
9655
+
9656
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
9657
+ <xsl:param name="process">false</xsl:param>
9658
+ <xsl:if test="$process = 'true'">
9659
+
9660
+ </xsl:if>
9661
+ </xsl:template>
9662
+
9663
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
9664
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
9665
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
9666
+ <xsl:apply-templates/>
9667
+ </fo:inline>
9668
+ </xsl:template>
9455
9669
 
9456
9670
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
9457
9671
  <!-- figure's footnote label -->
9672
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
9458
9673
  <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">
9459
9674
  <xsl:variable name="key_iso">
9460
9675
 
@@ -9463,7 +9678,7 @@
9463
9678
  <xsl:attribute name="font-size">10pt</xsl:attribute>
9464
9679
 
9465
9680
  </xsl:if>
9466
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
9681
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
9467
9682
  <!-- <xsl:value-of select="@reference"/> -->
9468
9683
  <xsl:apply-templates/>
9469
9684
  </fo:inline>
@@ -9473,38 +9688,65 @@
9473
9688
  <!-- END: figure's footnotes rendering -->
9474
9689
  <!-- ============================ -->
9475
9690
 
9476
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
9691
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
9692
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
9477
9693
  <xsl:template match="*[local-name()='fn']">
9478
9694
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
9479
9695
 
9480
9696
  <xsl:call-template name="refine_fn-reference-style"/>
9481
9697
 
9482
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9483
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
9484
- <xsl:attribute name="internal-destination">
9698
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9699
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9700
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9701
+ <!-- <xsl:attribute name="internal-destination">
9485
9702
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9486
9703
  </xsl:attribute>
9487
9704
  </xsl:if>
9705
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9706
+ <xsl:attribute name="internal-destination">
9707
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9708
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9709
+ </xsl:attribute>
9710
+ </xsl:if> -->
9711
+ <!-- <xsl:if test="$namespace = 'plateau'">
9712
+ <xsl:text>※</xsl:text>
9713
+ </xsl:if> -->
9714
+ <!-- <xsl:value-of select="@reference"/> -->
9488
9715
 
9489
- <xsl:value-of select="@reference"/>
9716
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9490
9717
 
9718
+ <!-- <xsl:if test="$namespace = 'bsi'">
9719
+ <xsl:text>)</xsl:text>
9720
+ </xsl:if> -->
9491
9721
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9492
9722
  <!-- <xsl:if test="$namespace = 'jis'">
9493
9723
  <fo:inline font-weight="normal">)</fo:inline>
9494
9724
  </xsl:if> -->
9495
9725
  </fo:basic-link>
9496
9726
  </fo:inline>
9497
- </xsl:template>
9727
+ </xsl:template> <!-- fn -->
9498
9728
 
9729
+ <!-- fn/text() -->
9499
9730
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
9500
9731
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
9501
9732
  </xsl:template>
9502
9733
 
9503
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
9734
+ <!-- fn//p fmt-fn-body//p -->
9735
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
9504
9736
  <fo:inline role="P">
9505
9737
  <xsl:apply-templates/>
9506
9738
  </fo:inline>
9507
9739
  </xsl:template>
9740
+
9741
+ <xsl:template name="insertFootnoteSeparatorCommon">
9742
+ <xsl:param name="leader_length">30%</xsl:param>
9743
+ <fo:static-content flow-name="xsl-footnote-separator">
9744
+ <fo:block>
9745
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
9746
+ </fo:block>
9747
+ </fo:static-content>
9748
+ </xsl:template>
9749
+
9508
9750
  <!-- ===================== -->
9509
9751
  <!-- END Footnotes processing -->
9510
9752
  <!-- ===================== -->
@@ -9781,11 +10023,11 @@
9781
10023
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
9782
10024
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
9783
10025
 
9784
- <xsl:call-template name="setColumnWidth_dl">
9785
- <xsl:with-param name="colwidths" select="$colwidths"/>
9786
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
9787
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
9788
- </xsl:call-template>
10026
+ <xsl:call-template name="setColumnWidth_dl">
10027
+ <xsl:with-param name="colwidths" select="$colwidths"/>
10028
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
10029
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
10030
+ </xsl:call-template>
9789
10031
 
9790
10032
  <fo:table-body>
9791
10033
 
@@ -9826,6 +10068,14 @@
9826
10068
 
9827
10069
  </xsl:template> <!-- END: dl -->
9828
10070
 
10071
+ <xsl:template match="@*|node()" mode="dt_clean">
10072
+ <xsl:copy>
10073
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
10074
+ </xsl:copy>
10075
+ </xsl:template>
10076
+
10077
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
10078
+
9829
10079
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
9830
10080
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
9831
10081
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -9855,10 +10105,12 @@
9855
10105
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
9856
10106
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
9857
10107
 
10108
+ <!-- dl/name -->
9858
10109
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
9859
10110
  <xsl:param name="process">false</xsl:param>
9860
10111
  <xsl:if test="$process = 'true'">
9861
10112
  <fo:block xsl:use-attribute-sets="dl-name-style">
10113
+
9862
10114
  <xsl:apply-templates/>
9863
10115
  </fo:block>
9864
10116
  </xsl:if>
@@ -9872,6 +10124,10 @@
9872
10124
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
9873
10125
 
9874
10126
  <xsl:choose>
10127
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
10128
+ <fo:table-column column-width="10%"/>
10129
+ <fo:table-column column-width="90%"/>
10130
+ </xsl:when> -->
9875
10131
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
9876
10132
  <xsl:call-template name="insertTableColumnWidth">
9877
10133
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -10684,7 +10940,7 @@
10684
10940
  <xsl:choose>
10685
10941
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
10686
10942
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
10687
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
10943
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
10688
10944
  </xsl:when>
10689
10945
  <xsl:otherwise>
10690
10946
  <xsl:apply-templates/>
@@ -10692,7 +10948,7 @@
10692
10948
  </xsl:choose>
10693
10949
  </xsl:template>
10694
10950
  <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">
10695
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
10951
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
10696
10952
  </xsl:template>
10697
10953
 
10698
10954
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -11732,24 +11988,26 @@
11732
11988
  <xsl:apply-templates select="." mode="mathml"/>
11733
11989
  </xsl:variable>
11734
11990
 
11735
- <fo:instream-foreign-object fox:alt-text="Math">
11991
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
11736
11992
 
11737
11993
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
11738
11994
 
11739
- <!-- put MathML in Actual Text -->
11740
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
11741
- <xsl:attribute name="fox:actual-text">
11742
- <xsl:value-of select="$mathml_content"/>
11743
- </xsl:attribute>
11744
-
11745
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
11746
- <xsl:if test="normalize-space($asciimath_text_) != ''">
11747
- <!-- put Mathin Alternate Text -->
11748
- <xsl:attribute name="fox:alt-text">
11749
- <xsl:value-of select="$asciimath_text_"/>
11995
+ <xsl:if test="$isGenerateTableIF = 'false'">
11996
+ <!-- put MathML in Actual Text -->
11997
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
11998
+ <xsl:attribute name="fox:actual-text">
11999
+ <xsl:value-of select="$mathml_content"/>
11750
12000
  </xsl:attribute>
12001
+
12002
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
12003
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
12004
+ <!-- put Mathin Alternate Text -->
12005
+ <xsl:attribute name="fox:alt-text">
12006
+ <xsl:value-of select="$asciimath_text_"/>
12007
+ </xsl:attribute>
12008
+ </xsl:if>
12009
+ <!-- </xsl:if> -->
11751
12010
  </xsl:if>
11752
- <!-- </xsl:if> -->
11753
12011
 
11754
12012
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
11755
12013
 
@@ -12012,6 +12270,27 @@
12012
12270
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12013
12271
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
12014
12272
  </xsl:when> -->
12273
+
12274
+ <!-- <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'))">
12275
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
12276
+ <xsl:variable name="filename">
12277
+ <xsl:call-template name="substring-after-last">
12278
+ <xsl:with-param name="value" select="$target_"/>
12279
+ <xsl:with-param name="delimiter" select="'/'"/>
12280
+ </xsl:call-template>
12281
+ </xsl:variable>
12282
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
12283
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
12284
+ <xsl:choose>
12285
+ <xsl:when test="$file_exists = 'true'">
12286
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
12287
+ </xsl:when>
12288
+ <xsl:otherwise>
12289
+ <xsl:value-of select="normalize-space(@target)"/>
12290
+ </xsl:otherwise>
12291
+ </xsl:choose>
12292
+ </xsl:when> -->
12293
+
12015
12294
  <xsl:otherwise>
12016
12295
  <xsl:value-of select="normalize-space(@target)"/>
12017
12296
  </xsl:otherwise>
@@ -12311,7 +12590,7 @@
12311
12590
 
12312
12591
  <xsl:template name="refine_note_block_style">
12313
12592
 
12314
- </xsl:template>
12593
+ </xsl:template> <!-- refine_note_block_style -->
12315
12594
 
12316
12595
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
12317
12596
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -12520,10 +12799,21 @@
12520
12799
  </xsl:template>
12521
12800
 
12522
12801
  <xsl:template name="showFigureKey">
12523
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
12524
- <xsl:call-template name="note"/>
12802
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
12803
+ <xsl:choose>
12804
+ <xsl:when test="local-name() = 'note'">
12805
+ <xsl:call-template name="note"/>
12806
+ </xsl:when>
12807
+ <xsl:when test="local-name() = 'example'">
12808
+ <xsl:call-template name="example"/>
12809
+ </xsl:when>
12810
+ <xsl:otherwise>
12811
+ <xsl:apply-templates select="."/>
12812
+ </xsl:otherwise>
12813
+ </xsl:choose>
12525
12814
  </xsl:for-each>
12526
- <xsl:call-template name="fn_display_figure"/>
12815
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
12816
+ <xsl:call-template name="figure_fn_display"/>
12527
12817
  </xsl:template>
12528
12818
 
12529
12819
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -13424,10 +13714,10 @@
13424
13714
  <xsl:when test="@type = 'section-title'">
13425
13715
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
13426
13716
  <xsl:text>: </xsl:text>
13427
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
13717
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
13428
13718
  </xsl:when>
13429
13719
  <xsl:otherwise>
13430
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
13720
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
13431
13721
  </xsl:otherwise>
13432
13722
  </xsl:choose>
13433
13723
  </xsl:when>
@@ -13492,6 +13782,8 @@
13492
13782
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
13493
13783
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
13494
13784
 
13785
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
13786
+
13495
13787
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
13496
13788
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
13497
13789
  <xsl:apply-templates mode="bookmarks"/>
@@ -13513,6 +13805,8 @@
13513
13805
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
13514
13806
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
13515
13807
 
13808
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
13809
+
13516
13810
  <!-- Bookmarks -->
13517
13811
  <xsl:template name="addBookmarks">
13518
13812
  <xsl:param name="contents"/>
@@ -13758,9 +14052,15 @@
13758
14052
  </xsl:if>
13759
14053
  </xsl:template>
13760
14054
 
14055
+ <!-- figure/fn -->
13761
14056
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
13762
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
14057
+ <!-- figure/note -->
14058
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
14059
+ <!-- figure/example -->
14060
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
13763
14061
 
14062
+ <!-- figure/note[@type = 'units'] -->
14063
+ <!-- image/note[@type = 'units'] -->
13764
14064
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
13765
14065
  <fo:block text-align="right" keep-with-next="always">
13766
14066
  <xsl:apply-templates/>
@@ -13881,6 +14181,7 @@
13881
14181
  </xsl:choose>
13882
14182
  </xsl:template>
13883
14183
 
14184
+ <!-- fn -->
13884
14185
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
13885
14186
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
13886
14187
 
@@ -14776,7 +15077,7 @@
14776
15077
  text line 1
14777
15078
  text line 2
14778
15079
  -->
14779
- <xsl:template match="*[local-name() = 'example']">
15080
+ <xsl:template match="*[local-name() = 'example']" name="example">
14780
15081
 
14781
15082
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
14782
15083
  <xsl:call-template name="setBlockSpanAll"/>
@@ -14829,6 +15130,7 @@
14829
15130
 
14830
15131
  </xsl:template>
14831
15132
 
15133
+ <!-- example/name -->
14832
15134
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
14833
15135
  <xsl:param name="fo_element">block</xsl:param>
14834
15136
 
@@ -14856,7 +15158,8 @@
14856
15158
 
14857
15159
  </xsl:template>
14858
15160
 
14859
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
15161
+ <!-- table/example/name, table/tfoot//example/name -->
15162
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
14860
15163
  <fo:inline xsl:use-attribute-sets="example-name-style">
14861
15164
 
14862
15165
  <xsl:if test="not($vertical_layout = 'true')">
@@ -15346,21 +15649,32 @@
15346
15649
  <!-- ========== -->
15347
15650
 
15348
15651
  <xsl:variable name="reviews_">
15349
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
15652
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
15350
15653
  <xsl:copy>
15351
15654
  <xsl:copy-of select="@from"/>
15352
15655
  <xsl:copy-of select="@id"/>
15353
15656
  </xsl:copy>
15354
15657
  </xsl:for-each>
15658
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
15659
+ <xsl:copy>
15660
+ <xsl:copy-of select="@source"/>
15661
+ <xsl:copy-of select="@id"/>
15662
+ </xsl:copy>
15663
+ </xsl:for-each>
15355
15664
  </xsl:variable>
15356
15665
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
15357
15666
 
15358
15667
  <xsl:template name="addReviewHelper">
15359
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
15360
- <xsl:variable name="curr_id" select="@id"/>
15361
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
15362
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
15363
- <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>
15668
+ <xsl:if test="$isGenerateTableIF = 'false'">
15669
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
15670
+ <xsl:variable name="curr_id" select="@id"/>
15671
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
15672
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
15673
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
15674
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
15675
+ <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>
15676
+ </xsl:if>
15677
+ </xsl:for-each>
15364
15678
  </xsl:if>
15365
15679
  <!-- <fo:block>
15366
15680
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -15497,14 +15811,61 @@
15497
15811
 
15498
15812
  </xsl:template>
15499
15813
 
15500
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
15814
+ <!-- document text (not figures, or tables) footnotes -->
15815
+ <xsl:variable name="reviews_container_">
15816
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
15817
+ <xsl:variable name="update_xml_step1">
15818
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
15819
+ </xsl:variable>
15820
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
15821
+ </xsl:for-each>
15822
+ </xsl:variable>
15823
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
15824
+
15825
+ <xsl:template match="*[local-name() = 'review-container']"/>
15826
+
15827
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
15828
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
15829
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
15830
+ <xsl:if test="$isGenerateTableIF = 'false'">
15831
+ <xsl:choose>
15832
+ <!-- if there isn't the attribute '@from', then -->
15833
+ <xsl:when test="$id_from = ''">
15834
+ <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>
15835
+ </xsl:when>
15836
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
15837
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
15838
+ <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>
15839
+ </xsl:when>
15840
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
15841
+ <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>
15842
+ </xsl:when>
15843
+ </xsl:choose>
15844
+ </xsl:if>
15845
+ </xsl:template>
15846
+
15847
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
15848
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
15501
15849
  <!-- comment 2019-11-29 -->
15502
15850
  <!-- <fo:block font-weight="bold">Review:</fo:block>
15503
15851
  <xsl:apply-templates /> -->
15504
15852
 
15505
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
15853
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
15506
15854
 
15507
- <xsl:if test="1 = 1">
15855
+ <xsl:variable name="source" select="normalize-space(@source)"/>
15856
+
15857
+ <xsl:if test="$isGenerateTableIF = 'false'">
15858
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
15859
+
15860
+ <!-- <xsl:if test="@source = @end"> -->
15861
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
15862
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
15863
+ <!-- <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> -->
15864
+ <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>
15865
+ <!-- </xsl:if> -->
15866
+ </xsl:if>
15867
+
15868
+ <xsl:if test="1 = 2">
15508
15869
  <xsl:choose>
15509
15870
  <!-- if there isn't the attribute '@from', then -->
15510
15871
  <xsl:when test="$id_from = ''">
@@ -15512,10 +15873,10 @@
15512
15873
  </xsl:when>
15513
15874
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
15514
15875
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
15515
- <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>
15876
+ <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>
15516
15877
  </xsl:when>
15517
15878
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
15518
- <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>
15879
+ <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>
15519
15880
  </xsl:when>
15520
15881
  </xsl:choose>
15521
15882
  </xsl:if>
@@ -15565,16 +15926,21 @@
15565
15926
  <xsl:variable name="list_level">
15566
15927
  <xsl:choose>
15567
15928
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
15568
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
15929
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
15930
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
15931
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
15569
15932
  </xsl:choose>
15570
15933
  </xsl:variable>
15571
15934
  <xsl:choose>
15572
15935
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
15573
15936
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
15574
15937
  </xsl:when>
15575
- <xsl:when test="$list_level mod 3 = 0">
15938
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
15576
15939
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
15577
15940
  </xsl:when>
15941
+ <xsl:when test="$list_level mod 3 = 0">
15942
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
15943
+ </xsl:when>
15578
15944
  <xsl:when test="$list_level mod 2 = 0">
15579
15945
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
15580
15946
  </xsl:when>
@@ -16142,10 +16508,22 @@
16142
16508
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
16143
16509
 
16144
16510
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
16145
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
16146
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
16147
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
16148
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
16511
+ <xsl:variable name="bookmark_id" select="@id"/>
16512
+ <xsl:choose>
16513
+ <!-- Example:
16514
+ <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"/>
16515
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
16516
+ <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"/> -->
16517
+ <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]">
16518
+ <!-- skip here, see the template 'fmt-review-start' -->
16519
+ </xsl:when>
16520
+ <xsl:otherwise>
16521
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
16522
+ <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>
16523
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
16524
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
16525
+ </xsl:otherwise>
16526
+ </xsl:choose>
16149
16527
  </xsl:template>
16150
16528
  <!-- =================== -->
16151
16529
  <!-- End of Index processing -->
@@ -16547,8 +16925,33 @@
16547
16925
 
16548
16926
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
16549
16927
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16928
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16929
+ <!-- <test><xsl:copy-of select="."/></test> -->
16930
+
16550
16931
  <xsl:variable name="target" select="@target"/>
16932
+
16551
16933
  <xsl:for-each select="*[local-name() = 'tab']">
16934
+
16935
+ <xsl:if test="position() = 1">
16936
+ <!-- first column (data before first `tab`) -->
16937
+ <fo:table-cell>
16938
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
16939
+ <xsl:call-template name="insert_basic_link">
16940
+ <xsl:with-param name="element">
16941
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
16942
+ <xsl:for-each select="preceding-sibling::node()">
16943
+ <xsl:choose>
16944
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
16945
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
16946
+ </xsl:choose>
16947
+ </xsl:for-each>
16948
+ </fo:basic-link>
16949
+ </xsl:with-param>
16950
+ </xsl:call-template>
16951
+ </fo:block>
16952
+ </fo:table-cell>
16953
+ </xsl:if>
16954
+
16552
16955
  <xsl:variable name="current_id" select="generate-id()"/>
16553
16956
  <fo:table-cell>
16554
16957
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -16599,11 +17002,25 @@
16599
17002
 
16600
17003
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
16601
17004
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
17005
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16602
17006
  <xsl:for-each select="*[local-name() = 'tab']">
17007
+ <xsl:if test="position() = 1">
17008
+ <td>
17009
+ <xsl:for-each select="preceding-sibling::node()">
17010
+ <xsl:choose>
17011
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
17012
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
17013
+ </xsl:choose>
17014
+ </xsl:for-each>
17015
+ </td>
17016
+ </xsl:if>
16603
17017
  <xsl:variable name="current_id" select="generate-id()"/>
16604
17018
  <td>
16605
17019
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
16606
- <xsl:copy-of select="."/>
17020
+ <xsl:choose>
17021
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
17022
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
17023
+ </xsl:choose>
16607
17024
  </xsl:for-each>
16608
17025
  </td>
16609
17026
  </xsl:for-each>
@@ -17473,6 +17890,9 @@
17473
17890
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
17474
17891
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
17475
17892
 
17893
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
17894
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
17895
+
17476
17896
  <!-- END: update new Presentation XML -->
17477
17897
 
17478
17898
  <!-- =========================================================================== -->
@@ -18100,6 +18520,7 @@
18100
18520
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
18101
18521
  </fn>
18102
18522
  -->
18523
+ <!-- fn in text -->
18103
18524
  <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">
18104
18525
  <xsl:variable name="p_fn_">
18105
18526
  <xsl:call-template name="get_fn_list"/>