metanorma-jis 0.5.1 → 0.5.2

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">
@@ -8957,6 +9007,17 @@
8957
9007
  <xsl:attribute name="text-align">left</xsl:attribute>
8958
9008
  </xsl:if>
8959
9009
 
9010
+ <xsl:if test="$isGenerateTableIF = 'false'">
9011
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
9012
+ <xsl:attribute name="text-align">right</xsl:attribute>
9013
+ <xsl:attribute name="border">none</xsl:attribute>
9014
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
9015
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
9016
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
9017
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
9018
+ </xsl:if>
9019
+ </xsl:if>
9020
+
8960
9021
  <fo:block role="SKIP">
8961
9022
 
8962
9023
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -8978,7 +9039,8 @@
8978
9039
  </fo:table-cell>
8979
9040
  </xsl:template> <!-- td -->
8980
9041
 
8981
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
9042
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
9043
+ <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
9044
 
8983
9045
  <fo:list-block id="{@id}" xsl:use-attribute-sets="table-note-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
8984
9046
  <fo:list-item>
@@ -8998,51 +9060,46 @@
8998
9060
 
8999
9061
  </xsl:template> <!-- table/note -->
9000
9062
 
9001
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
9063
+ <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
9064
  <xsl:apply-templates/>
9003
9065
  </xsl:template>
9004
9066
 
9005
9067
  <!-- ===================== -->
9006
9068
  <!-- Footnotes processing -->
9007
9069
  <!-- ===================== -->
9070
+
9071
+ <!-- document text (not figures, or tables) footnotes -->
9072
+ <xsl:variable name="footnotes_">
9073
+ <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 -->
9074
+ <!-- <xsl:copy-of select="."/> -->
9075
+ <xsl:variable name="update_xml_step1">
9076
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
9077
+ </xsl:variable>
9078
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
9079
+ </xsl:for-each>
9080
+ </xsl:variable>
9081
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
9082
+
9008
9083
  <!--
9009
9084
  <fn reference="1">
9010
9085
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
9011
9086
  </fn>
9012
9087
  -->
9013
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
9088
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
9089
+ <!-- fn in text -->
9014
9090
  <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
9091
 
9016
- <!-- list of footnotes to calculate actual footnotes number -->
9092
+ <!-- list of unique footnotes -->
9017
9093
  <xsl:variable name="p_fn_">
9018
9094
  <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
9095
  </xsl:variable>
9028
9096
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9029
9097
 
9030
9098
  <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_)"/>
9099
+
9037
9100
  <!-- 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>
9101
+ <xsl:variable name="current_fn_number" select="@reference"/>
9102
+
9046
9103
  <xsl:variable name="current_fn_number_text">
9047
9104
 
9048
9105
  <xsl:choose>
@@ -9051,19 +9108,13 @@
9051
9108
  <xsl:value-of select="$numbers_japanese//jis:localized-string[@key = $current_fn_number]"/>
9052
9109
  <xsl:text> </xsl:text>
9053
9110
  </xsl:when>
9054
- <xsl:otherwise><xsl:value-of select="$current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></xsl:otherwise>
9111
+ <xsl:otherwise><xsl:value-of select="translate($current_fn_number, ')', '')"/><fo:inline font-weight="normal">)</fo:inline></xsl:otherwise>
9055
9112
  </xsl:choose>
9056
9113
 
9057
9114
  </xsl:variable>
9058
9115
 
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>
9116
+ <xsl:variable name="ref_id" select="@target"/>
9117
+
9067
9118
  <xsl:variable name="footnote_inline">
9068
9119
  <fo:inline role="Reference">
9069
9120
 
@@ -9109,15 +9160,19 @@
9109
9160
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
9110
9161
 
9111
9162
  <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>
9163
+ <fo:inline font-family="IPAexGothic">
9164
+ <xsl:call-template name="insertVerticalChar">
9165
+ <xsl:with-param name="str" select="'〔'"/>
9166
+ </xsl:call-template>
9167
+ </fo:inline>
9115
9168
 
9116
9169
  <xsl:copy-of select="$current_fn_number_text"/>
9117
9170
 
9118
- <xsl:call-template name="insertVerticalChar">
9119
- <xsl:with-param name="str" select="'〕'"/>
9120
- </xsl:call-template>
9171
+ <fo:inline font-family="IPAexGothic">
9172
+ <xsl:call-template name="insertVerticalChar">
9173
+ <xsl:with-param name="str" select="'〕'"/>
9174
+ </xsl:call-template>
9175
+ </fo:inline>
9121
9176
 
9122
9177
  </fo:inline>
9123
9178
  </fo:basic-link>
@@ -9130,7 +9185,9 @@
9130
9185
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
9131
9186
  <xsl:copy-of select="$footnote_inline"/>
9132
9187
  </xsl:when>
9188
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
9133
9189
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
9190
+
9134
9191
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
9135
9192
  <xsl:copy-of select="$footnote_inline"/>
9136
9193
  <fo:footnote-body role="Note">
@@ -9147,7 +9204,10 @@
9147
9204
  <xsl:value-of select="$current_fn_number_text"/>
9148
9205
 
9149
9206
  </fo:inline>
9150
- <xsl:apply-templates/>
9207
+ <!-- <xsl:apply-templates /> -->
9208
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
9209
+ <here><xsl:copy-of select="$footnotes"/></here> -->
9210
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
9151
9211
  </xsl:variable>
9152
9212
 
9153
9213
  <xsl:choose>
@@ -9176,14 +9236,16 @@
9176
9236
  </fo:list-item-label>
9177
9237
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style" role="SKIP">
9178
9238
  <fo:block role="SKIP">
9179
- <xsl:apply-templates/>
9239
+ <!-- <xsl:apply-templates /> -->
9240
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
9180
9241
  </fo:block>
9181
9242
  </fo:list-item-body>
9182
9243
  </fo:list-item>
9183
9244
  </fo:list-block>
9184
- </xsl:when>
9245
+ </xsl:when> <!-- $vertical_layout = 'true' -->
9185
9246
  <xsl:otherwise>
9186
9247
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
9248
+ <xsl:attribute name="text-align">left</xsl:attribute> <!-- because footer is centered -->
9187
9249
  <xsl:copy-of select="$fn_block"/>
9188
9250
  </fo:block>
9189
9251
  </xsl:otherwise>
@@ -9237,48 +9299,40 @@
9237
9299
  </xsl:choose>
9238
9300
  </xsl:template>
9239
9301
 
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
9302
  <!-- ============================ -->
9263
9303
  <!-- table's footnotes rendering -->
9264
9304
  <!-- ============================ -->
9265
- <xsl:template name="table_fn_display">
9266
- <xsl:variable name="references">
9267
9305
 
9306
+ <!-- table/fmt-footnote-container -->
9307
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
9308
+
9309
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
9310
+ <xsl:for-each select=".">
9311
+ <xsl:call-template name="table_fn_display"/>
9312
+ </xsl:for-each>
9313
+ </xsl:template>
9314
+
9315
+ <xsl:template name="table_fn_display">
9316
+ <!-- <xsl:variable name="references">
9317
+ <xsl:if test="$namespace = 'bsi'">
9318
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
9319
+ <xsl:call-template name="create_fn" />
9320
+ </xsl:for-each>
9321
+ </xsl:if>
9268
9322
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
9269
- <xsl:call-template name="create_fn"/>
9323
+ <xsl:call-template name="create_fn" />
9270
9324
  </xsl:for-each>
9271
- </xsl:variable>
9272
-
9273
- <xsl:for-each select="xalan:nodeset($references)//fn">
9325
+ </xsl:variable> -->
9326
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
9274
9327
  <xsl:variable name="reference" select="@reference"/>
9275
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
9328
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
9329
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
9276
9330
 
9277
9331
  <fo:list-block id="{@id}" xsl:use-attribute-sets="table-fn-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
9278
9332
  <fo:list-item>
9279
9333
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
9280
9334
  <fo:block>
9281
- <fo:inline font-size="9pt">
9335
+ <!-- <fo:inline font-size="9pt">
9282
9336
  <xsl:if test="not($vertical_layout = 'true')">
9283
9337
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
9284
9338
  </xsl:if>
@@ -9286,40 +9340,127 @@
9286
9340
  <xsl:with-param name="key">table_footnote</xsl:with-param>
9287
9341
  </xsl:call-template>
9288
9342
  </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')">
9343
+ <xsl:text> </xsl:text> -->
9344
+
9345
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9346
+ <xsl:with-param name="process">true</xsl:with-param>
9347
+ </xsl:apply-templates>
9348
+
9349
+ <!-- <fo:inline xsl:use-attribute-sets="table-fn-number-style table-fmt-fn-label-style"> -->
9350
+ <!-- <xsl:if test="not($vertical_layout = 'true')">
9292
9351
  <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
9293
- </xsl:if>
9294
- <xsl:value-of select="@reference"/>
9352
+ </xsl:if> -->
9353
+ <!-- <xsl:value-of select="@reference"/> -->
9354
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9355
+ <xsl:with-param name="process">true</xsl:with-param>
9356
+ </xsl:apply-templates> -->
9357
+ <!-- <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/> -->
9358
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9359
+ <xsl:with-param name="process">true</xsl:with-param>
9360
+ </xsl:apply-templates> -->
9361
+
9295
9362
  <!-- <fo:inline font-weight="normal">)</fo:inline> --> <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9296
- </fo:inline>
9363
+ <!-- </fo:inline> -->
9297
9364
  </fo:block>
9298
9365
  </fo:list-item-label>
9299
9366
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">
9300
9367
  <fo:block>
9301
- <xsl:copy-of select="./node()"/>
9368
+ <!-- <xsl:copy-of select="./node()"/> -->
9369
+ <xsl:apply-templates/>
9302
9370
  </fo:block>
9303
9371
  </fo:list-item-body>
9304
9372
  </fo:list-item>
9305
9373
  </fo:list-block>
9306
9374
  <!-- jis -->
9307
9375
 
9308
- </xsl:if>
9376
+ <!-- </xsl:if> -->
9309
9377
  </xsl:for-each>
9310
9378
  </xsl:template> <!-- table_fn_display -->
9311
9379
 
9380
+ <!-- fmt-fn-body/fmt-fn-label in text -->
9381
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
9382
+
9383
+ <!-- table//fmt-fn-body//fmt-fn-label -->
9384
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
9385
+ <xsl:param name="process">false</xsl:param>
9386
+ <xsl:if test="$process = 'true'">
9387
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
9388
+
9389
+ <!-- tab is padding-right -->
9390
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
9391
+ <xsl:with-param name="process">true</xsl:with-param>
9392
+ </xsl:apply-templates>
9393
+
9394
+ <!-- <xsl:if test="$namespace = 'bipm'">
9395
+ <fo:inline font-style="normal">(</fo:inline>
9396
+ </xsl:if> -->
9397
+
9398
+ <!-- <xsl:if test="$namespace = 'plateau'">
9399
+ <xsl:text>※</xsl:text>
9400
+ </xsl:if> -->
9401
+
9402
+ <!-- <xsl:value-of select="@reference"/> -->
9403
+ <!-- <xsl:value-of select="normalize-space()"/> -->
9404
+ <xsl:apply-templates/>
9405
+
9406
+ <!-- <xsl:if test="$namespace = 'bipm'">
9407
+ <fo:inline font-style="normal">)</fo:inline>
9408
+ </xsl:if> -->
9409
+
9410
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
9411
+ <!-- <xsl:if test="$namespace = 'itu'">
9412
+ <xsl:text>)</xsl:text>
9413
+ </xsl:if> -->
9414
+
9415
+ <!-- <xsl:if test="$namespace = 'plateau'">
9416
+ <xsl:text>:</xsl:text>
9417
+ </xsl:if> -->
9418
+
9419
+ </fo:inline>
9420
+ </xsl:if>
9421
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
9422
+
9423
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
9424
+ <xsl:param name="process">false</xsl:param>
9425
+ <xsl:if test="$process = 'true'">
9426
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
9427
+
9428
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9429
+
9430
+ </xsl:if>
9431
+ </xsl:template>
9432
+
9433
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
9434
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
9435
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
9436
+ <xsl:apply-templates/>
9437
+ </fo:inline>
9438
+ </xsl:template>
9439
+
9440
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
9441
+ <!--
9312
9442
  <xsl:template name="create_fn">
9313
9443
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
9314
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
9444
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
9315
9445
  <xsl:attribute name="id">
9316
9446
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9317
9447
  </xsl:attribute>
9318
9448
  </xsl:if>
9319
-
9320
- <xsl:apply-templates/>
9449
+ <xsl:if test="$namespace = 'itu'">
9450
+ <xsl:if test="ancestor::*[local-name()='preface']">
9451
+ <xsl:attribute name="preface">true</xsl:attribute>
9452
+ </xsl:if>
9453
+ </xsl:if>
9454
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9455
+ <xsl:attribute name="id">
9456
+ <xsl:value-of select="@reference"/>
9457
+ <xsl:text>_</xsl:text>
9458
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9459
+ </xsl:attribute>
9460
+ </xsl:if>
9461
+ <xsl:apply-templates />
9321
9462
  </fn>
9322
- </xsl:template>
9463
+ </xsl:template> -->
9323
9464
 
9324
9465
  <!-- footnotes for table's name rendering -->
9325
9466
  <xsl:template name="table_name_fn_display">
@@ -9338,123 +9479,171 @@
9338
9479
  <!-- ============================ -->
9339
9480
  <!-- figure's footnotes rendering -->
9340
9481
  <!-- ============================ -->
9341
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
9342
9482
 
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_)"/>
9483
+ <!-- figure/fmt-footnote-container -->
9484
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
9485
+
9486
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9487
+ <xsl:template name="figure_fn_display">
9349
9488
 
9350
- <!-- all footnotes relates to the current figure -->
9351
9489
  <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>
9490
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
9491
+ <xsl:variable name="curr_id" select="@id"/>
9492
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
9493
+ <curr><xsl:copy-of select="."/></curr>
9494
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
9495
+ <xsl:choose>
9496
+ <!-- skip figure/name/fn -->
9497
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
9498
+ <xsl:otherwise>
9499
+ <xsl:element name="figure" namespace="{$namespace_full}">
9500
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
9501
+ <xsl:copy-of select="."/>
9502
+ </xsl:element>
9503
+ </xsl:element>
9504
+ </xsl:otherwise>
9505
+ </xsl:choose>
9356
9506
  </xsl:for-each>
9357
9507
  </xsl:variable>
9508
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
9358
9509
 
9359
- <xsl:if test="xalan:nodeset($references)//fn">
9510
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
9360
9511
 
9361
9512
  <xsl:variable name="key_iso">
9362
9513
 
9363
9514
  </xsl:variable>
9364
9515
 
9365
9516
  <fo:block>
9517
+ <!-- current hierarchy is 'figure' element -->
9518
+ <xsl:variable name="following_dl_colwidths">
9519
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
9520
+ <xsl:variable name="simple-table">
9521
+ <!-- <xsl:variable name="doc_ns">
9522
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
9523
+ </xsl:variable>
9524
+ <xsl:variable name="ns">
9525
+ <xsl:choose>
9526
+ <xsl:when test="normalize-space($doc_ns) != ''">
9527
+ <xsl:value-of select="normalize-space($doc_ns)"/>
9528
+ </xsl:when>
9529
+ <xsl:otherwise>
9530
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
9531
+ </xsl:otherwise>
9532
+ </xsl:choose>
9533
+ </xsl:variable> -->
9366
9534
 
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> -->
9535
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
9536
+ <tbody>
9537
+ <xsl:apply-templates mode="dl"/>
9538
+ </tbody>
9539
+ </xsl:for-each>
9540
+ </xsl:variable>
9384
9541
 
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>
9542
+ <xsl:call-template name="calculate-column-widths">
9543
+ <xsl:with-param name="cols-count" select="2"/>
9544
+ <xsl:with-param name="table" select="$simple-table"/>
9545
+ </xsl:call-template>
9391
9546
 
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>
9547
+ </xsl:if>
9548
+ </xsl:variable>
9396
9549
 
9397
- </xsl:if>
9398
- </xsl:variable>
9550
+ <xsl:variable name="maxlength_dt">
9551
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
9552
+ <xsl:call-template name="getMaxLength_dt"/>
9553
+ </xsl:for-each>
9554
+ </xsl:variable>
9399
9555
 
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>
9556
+ <fo:table width="95%" table-layout="fixed">
9557
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9558
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
9405
9559
 
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>
9560
+ </xsl:if>
9561
+ <xsl:choose>
9562
+ <!-- if there 'dl', then set same columns width -->
9563
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
9564
+ <xsl:call-template name="setColumnWidth_dl">
9565
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
9566
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
9567
+ </xsl:call-template>
9568
+ </xsl:when>
9569
+ <xsl:otherwise>
9570
+ <fo:table-column column-width="5%"/>
9571
+ <fo:table-column column-width="95%"/>
9572
+ </xsl:otherwise>
9573
+ </xsl:choose>
9574
+ <fo:table-body>
9575
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
9576
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
9409
9577
 
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"/>
9578
+ <xsl:variable name="reference" select="@reference"/>
9579
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
9580
+ <fo:table-row>
9581
+ <fo:table-cell>
9582
+ <fo:block>
9583
+
9584
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
9585
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
9586
+ <!-- <xsl:value-of select="@reference"/> -->
9587
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
9433
9588
  </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
9589
 
9440
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
9590
+ </fo:block>
9591
+ </fo:table-cell>
9592
+ <fo:table-cell>
9593
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
9594
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9441
9595
 
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>
9596
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
9451
9597
 
9598
+ </xsl:if>
9599
+
9600
+ <!-- <xsl:copy-of select="./node()"/> -->
9601
+ <xsl:apply-templates/>
9602
+ </fo:block>
9603
+ </fo:table-cell>
9604
+ </fo:table-row>
9605
+ <!-- </xsl:if> -->
9606
+ </xsl:for-each>
9607
+ </fo:table-body>
9608
+ </fo:table>
9452
9609
  </fo:block>
9453
9610
  </xsl:if>
9454
- </xsl:template> <!-- fn_display_figure -->
9611
+ </xsl:template> <!-- figure_fn_display -->
9612
+
9613
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
9614
+ <xsl:param name="process">false</xsl:param>
9615
+ <xsl:if test="$process = 'true'">
9616
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
9617
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9618
+
9619
+ <!-- tab is padding-right -->
9620
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
9621
+ <xsl:with-param name="process">true</xsl:with-param>
9622
+ </xsl:apply-templates>
9623
+
9624
+ <xsl:apply-templates/>
9625
+
9626
+ </fo:inline>
9627
+ </xsl:if>
9628
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
9629
+
9630
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
9631
+ <xsl:param name="process">false</xsl:param>
9632
+ <xsl:if test="$process = 'true'">
9633
+
9634
+ </xsl:if>
9635
+ </xsl:template>
9636
+
9637
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
9638
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
9639
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
9640
+ <xsl:apply-templates/>
9641
+ </fo:inline>
9642
+ </xsl:template>
9455
9643
 
9456
9644
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
9457
9645
  <!-- figure's footnote label -->
9646
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
9458
9647
  <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
9648
  <xsl:variable name="key_iso">
9460
9649
 
@@ -9463,7 +9652,7 @@
9463
9652
  <xsl:attribute name="font-size">10pt</xsl:attribute>
9464
9653
 
9465
9654
  </xsl:if>
9466
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
9655
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
9467
9656
  <!-- <xsl:value-of select="@reference"/> -->
9468
9657
  <xsl:apply-templates/>
9469
9658
  </fo:inline>
@@ -9473,38 +9662,65 @@
9473
9662
  <!-- END: figure's footnotes rendering -->
9474
9663
  <!-- ============================ -->
9475
9664
 
9476
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
9665
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
9666
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
9477
9667
  <xsl:template match="*[local-name()='fn']">
9478
9668
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
9479
9669
 
9480
9670
  <xsl:call-template name="refine_fn-reference-style"/>
9481
9671
 
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">
9672
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9673
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9674
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9675
+ <!-- <xsl:attribute name="internal-destination">
9485
9676
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9486
9677
  </xsl:attribute>
9487
9678
  </xsl:if>
9679
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9680
+ <xsl:attribute name="internal-destination">
9681
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9682
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9683
+ </xsl:attribute>
9684
+ </xsl:if> -->
9685
+ <!-- <xsl:if test="$namespace = 'plateau'">
9686
+ <xsl:text>※</xsl:text>
9687
+ </xsl:if> -->
9688
+ <!-- <xsl:value-of select="@reference"/> -->
9488
9689
 
9489
- <xsl:value-of select="@reference"/>
9690
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9490
9691
 
9692
+ <!-- <xsl:if test="$namespace = 'bsi'">
9693
+ <xsl:text>)</xsl:text>
9694
+ </xsl:if> -->
9491
9695
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9492
9696
  <!-- <xsl:if test="$namespace = 'jis'">
9493
9697
  <fo:inline font-weight="normal">)</fo:inline>
9494
9698
  </xsl:if> -->
9495
9699
  </fo:basic-link>
9496
9700
  </fo:inline>
9497
- </xsl:template>
9701
+ </xsl:template> <!-- fn -->
9498
9702
 
9703
+ <!-- fn/text() -->
9499
9704
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
9500
9705
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
9501
9706
  </xsl:template>
9502
9707
 
9503
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
9708
+ <!-- fn//p fmt-fn-body//p -->
9709
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
9504
9710
  <fo:inline role="P">
9505
9711
  <xsl:apply-templates/>
9506
9712
  </fo:inline>
9507
9713
  </xsl:template>
9714
+
9715
+ <xsl:template name="insertFootnoteSeparatorCommon">
9716
+ <xsl:param name="leader_length">30%</xsl:param>
9717
+ <fo:static-content flow-name="xsl-footnote-separator">
9718
+ <fo:block>
9719
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
9720
+ </fo:block>
9721
+ </fo:static-content>
9722
+ </xsl:template>
9723
+
9508
9724
  <!-- ===================== -->
9509
9725
  <!-- END Footnotes processing -->
9510
9726
  <!-- ===================== -->
@@ -9781,11 +9997,11 @@
9781
9997
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
9782
9998
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
9783
9999
 
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>
10000
+ <xsl:call-template name="setColumnWidth_dl">
10001
+ <xsl:with-param name="colwidths" select="$colwidths"/>
10002
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
10003
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
10004
+ </xsl:call-template>
9789
10005
 
9790
10006
  <fo:table-body>
9791
10007
 
@@ -9826,6 +10042,14 @@
9826
10042
 
9827
10043
  </xsl:template> <!-- END: dl -->
9828
10044
 
10045
+ <xsl:template match="@*|node()" mode="dt_clean">
10046
+ <xsl:copy>
10047
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
10048
+ </xsl:copy>
10049
+ </xsl:template>
10050
+
10051
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
10052
+
9829
10053
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
9830
10054
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
9831
10055
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -9855,10 +10079,12 @@
9855
10079
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
9856
10080
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
9857
10081
 
10082
+ <!-- dl/name -->
9858
10083
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
9859
10084
  <xsl:param name="process">false</xsl:param>
9860
10085
  <xsl:if test="$process = 'true'">
9861
10086
  <fo:block xsl:use-attribute-sets="dl-name-style">
10087
+
9862
10088
  <xsl:apply-templates/>
9863
10089
  </fo:block>
9864
10090
  </xsl:if>
@@ -9872,6 +10098,10 @@
9872
10098
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
9873
10099
 
9874
10100
  <xsl:choose>
10101
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
10102
+ <fo:table-column column-width="10%"/>
10103
+ <fo:table-column column-width="90%"/>
10104
+ </xsl:when> -->
9875
10105
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
9876
10106
  <xsl:call-template name="insertTableColumnWidth">
9877
10107
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -12012,6 +12242,27 @@
12012
12242
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12013
12243
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
12014
12244
  </xsl:when> -->
12245
+
12246
+ <!-- <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'))">
12247
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
12248
+ <xsl:variable name="filename">
12249
+ <xsl:call-template name="substring-after-last">
12250
+ <xsl:with-param name="value" select="$target_"/>
12251
+ <xsl:with-param name="delimiter" select="'/'"/>
12252
+ </xsl:call-template>
12253
+ </xsl:variable>
12254
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
12255
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
12256
+ <xsl:choose>
12257
+ <xsl:when test="$file_exists = 'true'">
12258
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
12259
+ </xsl:when>
12260
+ <xsl:otherwise>
12261
+ <xsl:value-of select="normalize-space(@target)"/>
12262
+ </xsl:otherwise>
12263
+ </xsl:choose>
12264
+ </xsl:when> -->
12265
+
12015
12266
  <xsl:otherwise>
12016
12267
  <xsl:value-of select="normalize-space(@target)"/>
12017
12268
  </xsl:otherwise>
@@ -12311,7 +12562,7 @@
12311
12562
 
12312
12563
  <xsl:template name="refine_note_block_style">
12313
12564
 
12314
- </xsl:template>
12565
+ </xsl:template> <!-- refine_note_block_style -->
12315
12566
 
12316
12567
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
12317
12568
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -12520,10 +12771,21 @@
12520
12771
  </xsl:template>
12521
12772
 
12522
12773
  <xsl:template name="showFigureKey">
12523
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
12524
- <xsl:call-template name="note"/>
12774
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
12775
+ <xsl:choose>
12776
+ <xsl:when test="local-name() = 'note'">
12777
+ <xsl:call-template name="note"/>
12778
+ </xsl:when>
12779
+ <xsl:when test="local-name() = 'example'">
12780
+ <xsl:call-template name="example"/>
12781
+ </xsl:when>
12782
+ <xsl:otherwise>
12783
+ <xsl:apply-templates select="."/>
12784
+ </xsl:otherwise>
12785
+ </xsl:choose>
12525
12786
  </xsl:for-each>
12526
- <xsl:call-template name="fn_display_figure"/>
12787
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
12788
+ <xsl:call-template name="figure_fn_display"/>
12527
12789
  </xsl:template>
12528
12790
 
12529
12791
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -13424,10 +13686,10 @@
13424
13686
  <xsl:when test="@type = 'section-title'">
13425
13687
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
13426
13688
  <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')]"/>
13689
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
13428
13690
  </xsl:when>
13429
13691
  <xsl:otherwise>
13430
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
13692
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
13431
13693
  </xsl:otherwise>
13432
13694
  </xsl:choose>
13433
13695
  </xsl:when>
@@ -13758,9 +14020,15 @@
13758
14020
  </xsl:if>
13759
14021
  </xsl:template>
13760
14022
 
14023
+ <!-- figure/fn -->
13761
14024
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
13762
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
14025
+ <!-- figure/note -->
14026
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
14027
+ <!-- figure/example -->
14028
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
13763
14029
 
14030
+ <!-- figure/note[@type = 'units'] -->
14031
+ <!-- image/note[@type = 'units'] -->
13764
14032
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
13765
14033
  <fo:block text-align="right" keep-with-next="always">
13766
14034
  <xsl:apply-templates/>
@@ -13881,6 +14149,7 @@
13881
14149
  </xsl:choose>
13882
14150
  </xsl:template>
13883
14151
 
14152
+ <!-- fn -->
13884
14153
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
13885
14154
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
13886
14155
 
@@ -14776,7 +15045,7 @@
14776
15045
  text line 1
14777
15046
  text line 2
14778
15047
  -->
14779
- <xsl:template match="*[local-name() = 'example']">
15048
+ <xsl:template match="*[local-name() = 'example']" name="example">
14780
15049
 
14781
15050
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
14782
15051
  <xsl:call-template name="setBlockSpanAll"/>
@@ -14829,6 +15098,7 @@
14829
15098
 
14830
15099
  </xsl:template>
14831
15100
 
15101
+ <!-- example/name -->
14832
15102
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
14833
15103
  <xsl:param name="fo_element">block</xsl:param>
14834
15104
 
@@ -14856,7 +15126,8 @@
14856
15126
 
14857
15127
  </xsl:template>
14858
15128
 
14859
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
15129
+ <!-- table/example/name, table/tfoot//example/name -->
15130
+ <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
15131
  <fo:inline xsl:use-attribute-sets="example-name-style">
14861
15132
 
14862
15133
  <xsl:if test="not($vertical_layout = 'true')">
@@ -16547,8 +16818,33 @@
16547
16818
 
16548
16819
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
16549
16820
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16821
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16822
+ <!-- <test><xsl:copy-of select="."/></test> -->
16823
+
16550
16824
  <xsl:variable name="target" select="@target"/>
16825
+
16551
16826
  <xsl:for-each select="*[local-name() = 'tab']">
16827
+
16828
+ <xsl:if test="position() = 1">
16829
+ <!-- first column (data before first `tab`) -->
16830
+ <fo:table-cell>
16831
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
16832
+ <xsl:call-template name="insert_basic_link">
16833
+ <xsl:with-param name="element">
16834
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
16835
+ <xsl:for-each select="preceding-sibling::node()">
16836
+ <xsl:choose>
16837
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
16838
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
16839
+ </xsl:choose>
16840
+ </xsl:for-each>
16841
+ </fo:basic-link>
16842
+ </xsl:with-param>
16843
+ </xsl:call-template>
16844
+ </fo:block>
16845
+ </fo:table-cell>
16846
+ </xsl:if>
16847
+
16552
16848
  <xsl:variable name="current_id" select="generate-id()"/>
16553
16849
  <fo:table-cell>
16554
16850
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -16599,11 +16895,25 @@
16599
16895
 
16600
16896
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
16601
16897
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16898
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
16602
16899
  <xsl:for-each select="*[local-name() = 'tab']">
16900
+ <xsl:if test="position() = 1">
16901
+ <td>
16902
+ <xsl:for-each select="preceding-sibling::node()">
16903
+ <xsl:choose>
16904
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
16905
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
16906
+ </xsl:choose>
16907
+ </xsl:for-each>
16908
+ </td>
16909
+ </xsl:if>
16603
16910
  <xsl:variable name="current_id" select="generate-id()"/>
16604
16911
  <td>
16605
16912
  <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="."/>
16913
+ <xsl:choose>
16914
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
16915
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
16916
+ </xsl:choose>
16607
16917
  </xsl:for-each>
16608
16918
  </td>
16609
16919
  </xsl:for-each>
@@ -18100,6 +18410,7 @@
18100
18410
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
18101
18411
  </fn>
18102
18412
  -->
18413
+ <!-- fn in text -->
18103
18414
  <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
18415
  <xsl:variable name="p_fn_">
18105
18416
  <xsl:call-template name="get_fn_list"/>