metanorma-jis 0.5.3 → 0.5.5

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.
@@ -6267,6 +6267,7 @@
6267
6267
  </xsl:template> <!-- refine_table-style -->
6268
6268
 
6269
6269
  <xsl:attribute-set name="table-name-style">
6270
+ <xsl:attribute name="role">Caption</xsl:attribute>
6270
6271
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6271
6272
 
6272
6273
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -6276,6 +6277,9 @@
6276
6277
 
6277
6278
  <xsl:template name="refine_table-name-style">
6278
6279
  <xsl:param name="continued"/>
6280
+ <xsl:if test="$continued = 'true'">
6281
+ <xsl:attribute name="role">SKIP</xsl:attribute>
6282
+ </xsl:if>
6279
6283
 
6280
6284
  <xsl:if test="not($vertical_layout = 'true')">
6281
6285
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
@@ -8002,8 +8006,14 @@
8002
8006
  </xsl:choose>
8003
8007
  </xsl:variable>
8004
8008
 
8009
+ <xsl:call-template name="setNamedDestination"/>
8010
+
8005
8011
  <fo:block-container xsl:use-attribute-sets="table-container-style" role="SKIP">
8006
8012
 
8013
+ <xsl:for-each select="*[local-name() = 'name']">
8014
+ <xsl:call-template name="setIDforNamedDestination"/>
8015
+ </xsl:for-each>
8016
+
8007
8017
  <xsl:call-template name="refine_table-container-style">
8008
8018
  <xsl:with-param name="margin-side" select="$margin-side"/>
8009
8019
  </xsl:call-template>
@@ -8147,7 +8157,7 @@
8147
8157
  </xsl:if>
8148
8158
 
8149
8159
  </fo:block-container>
8150
- </xsl:variable>
8160
+ </xsl:variable> <!-- END: variable name="table" -->
8151
8161
 
8152
8162
  <xsl:variable name="isAdded" select="@added"/>
8153
8163
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8157,14 +8167,14 @@
8157
8167
 
8158
8168
  <!-- centered table when table name is centered (see table-name-style) -->
8159
8169
 
8160
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
8170
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
8161
8171
 
8162
8172
  <fo:table-column column-width="proportional-column-width(1)"/>
8163
8173
  <fo:table-column column-width="{@width}"/>
8164
8174
  <fo:table-column column-width="proportional-column-width(1)"/>
8165
- <fo:table-body>
8166
- <fo:table-row>
8167
- <fo:table-cell column-number="2">
8175
+ <fo:table-body role="SKIP">
8176
+ <fo:table-row role="SKIP">
8177
+ <fo:table-cell column-number="2" role="SKIP">
8168
8178
  <xsl:copy-of select="$table-preamble"/>
8169
8179
  <fo:block role="SKIP">
8170
8180
  <xsl:call-template name="setTrackChangesStyles">
@@ -8205,11 +8215,13 @@
8205
8215
 
8206
8216
  </xsl:template>
8207
8217
 
8218
+ <!-- table/name-->
8208
8219
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
8209
8220
  <xsl:param name="continued"/>
8221
+ <xsl:param name="cols-count"/>
8210
8222
  <xsl:if test="normalize-space() != ''">
8211
8223
 
8212
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
8224
+ <fo:block xsl:use-attribute-sets="table-name-style">
8213
8225
 
8214
8226
  <xsl:call-template name="refine_table-name-style">
8215
8227
  <xsl:with-param name="continued" select="$continued"/>
@@ -8228,9 +8240,30 @@
8228
8240
 
8229
8241
  <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
8230
8242
  <xsl:if test="$continued = 'true'">
8231
- <fo:block text-align="right">
8232
- <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
8233
- </fo:block>
8243
+
8244
+ <!-- to prevent the error 'THead element may contain only TR elements' -->
8245
+
8246
+ <xsl:choose>
8247
+ <xsl:when test="string(number($cols-count)) != 'NaN'">
8248
+ <fo:table width="100%" table-layout="fixed" role="SKIP">
8249
+ <fo:table-body role="SKIP">
8250
+ <fo:table-row>
8251
+ <fo:table-cell role="TH" number-columns-spanned="{$cols-count}">
8252
+ <fo:block text-align="right" role="SKIP">
8253
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
8254
+ </fo:block>
8255
+ </fo:table-cell>
8256
+ </fo:table-row>
8257
+ </fo:table-body>
8258
+ </fo:table>
8259
+ </xsl:when>
8260
+ <xsl:otherwise>
8261
+ <fo:block text-align="right">
8262
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
8263
+ </fo:block>
8264
+ </xsl:otherwise>
8265
+ </xsl:choose>
8266
+
8234
8267
  </xsl:if>
8235
8268
  <!-- </xsl:if> -->
8236
8269
 
@@ -8623,6 +8656,7 @@
8623
8656
 
8624
8657
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
8625
8658
  <xsl:with-param name="continued">true</xsl:with-param>
8659
+ <xsl:with-param name="cols-count" select="$cols-count"/>
8626
8660
  </xsl:apply-templates>
8627
8661
 
8628
8662
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
@@ -8686,7 +8720,7 @@
8686
8720
 
8687
8721
  <xsl:variable name="tableWithNotesAndFootnotes">
8688
8722
 
8689
- <fo:table keep-with-previous="always">
8723
+ <fo:table keep-with-previous="always" role="SKIP">
8690
8724
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
8691
8725
  <xsl:variable name="name" select="local-name()"/>
8692
8726
  <xsl:choose>
@@ -8717,9 +8751,9 @@
8717
8751
  </xsl:otherwise>
8718
8752
  </xsl:choose>
8719
8753
 
8720
- <fo:table-body>
8721
- <fo:table-row>
8722
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
8754
+ <fo:table-body role="SKIP">
8755
+ <fo:table-row role="SKIP">
8756
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
8723
8757
 
8724
8758
  <xsl:call-template name="refine_table-footer-cell-style"/>
8725
8759
 
@@ -9000,8 +9034,8 @@
9000
9034
  <xsl:for-each select="xalan:nodeset($styles__)/item">
9001
9035
  <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
9002
9036
  <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>
9037
+ <xsl:if test="$key = 'color' or $key = 'background-color' or $key = 'border' or $key = 'border-top' or $key = 'border-right' or $key = 'border-left' or $key = 'border-bottom' or $key = 'border-style' or $key = 'border-width' or $key = 'border-color' or $key = 'border-top-style' or $key = 'border-top-width' or $key = 'border-top-color' or $key = 'border-right-style' or $key = 'border-right-width' or $key = 'border-right-color' or $key = 'border-left-style' or $key = 'border-left-width' or $key = 'border-left-color' or $key = 'border-bottom-style' or $key = 'border-bottom-width' or $key = 'border-bottom-color'">
9038
+ <style name="{$key}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($value), 'currentColor', 'inherit')"/></style>
9005
9039
  </xsl:if>
9006
9040
  </xsl:for-each>
9007
9041
  </xsl:variable>
@@ -9068,6 +9102,7 @@
9068
9102
  <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
9069
9103
  <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">
9070
9104
 
9105
+ <xsl:call-template name="setNamedDestination"/>
9071
9106
  <fo:list-block id="{@id}" xsl:use-attribute-sets="table-note-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
9072
9107
  <fo:list-item>
9073
9108
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
@@ -9114,6 +9149,7 @@
9114
9149
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
9115
9150
  <!-- fn in text -->
9116
9151
  <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">
9152
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
9117
9153
 
9118
9154
  <!-- list of unique footnotes -->
9119
9155
  <xsl:variable name="p_fn_">
@@ -9212,7 +9248,7 @@
9212
9248
  <xsl:copy-of select="$footnote_inline"/>
9213
9249
  </xsl:when>
9214
9250
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
9215
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
9251
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
9216
9252
 
9217
9253
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
9218
9254
  <xsl:copy-of select="$footnote_inline"/>
@@ -9691,39 +9727,51 @@
9691
9727
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
9692
9728
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
9693
9729
  <xsl:template match="*[local-name()='fn']">
9694
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
9695
-
9696
- <xsl:call-template name="refine_fn-reference-style"/>
9730
+ <xsl:variable name="target" select="@target"/>
9731
+ <xsl:choose>
9732
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
9733
+ <xsl:when test="not(ancestor::*[local-name() = 'table'][1]//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body'][@id = $target]) and $footnotes/*[local-name() = 'fmt-fn-body'][@id = $target]">
9734
+ <xsl:call-template name="fn">
9735
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
9736
+ </xsl:call-template>
9737
+ </xsl:when>
9738
+ <xsl:otherwise>
9697
9739
 
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">
9702
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9703
- </xsl:attribute>
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"/> -->
9740
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
9715
9741
 
9716
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9742
+ <xsl:call-template name="refine_fn-reference-style"/>
9717
9743
 
9718
- <!-- <xsl:if test="$namespace = 'bsi'">
9719
- <xsl:text>)</xsl:text>
9720
- </xsl:if> -->
9721
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9722
- <!-- <xsl:if test="$namespace = 'jis'">
9723
- <fo:inline font-weight="normal">)</fo:inline>
9724
- </xsl:if> -->
9725
- </fo:basic-link>
9726
- </fo:inline>
9744
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9745
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9746
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9747
+ <!-- <xsl:attribute name="internal-destination">
9748
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9749
+ </xsl:attribute>
9750
+ </xsl:if>
9751
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9752
+ <xsl:attribute name="internal-destination">
9753
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9754
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9755
+ </xsl:attribute>
9756
+ </xsl:if> -->
9757
+ <!-- <xsl:if test="$namespace = 'plateau'">
9758
+ <xsl:text>※</xsl:text>
9759
+ </xsl:if> -->
9760
+ <!-- <xsl:value-of select="@reference"/> -->
9761
+
9762
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9763
+
9764
+ <!-- <xsl:if test="$namespace = 'bsi'">
9765
+ <xsl:text>)</xsl:text>
9766
+ </xsl:if> -->
9767
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9768
+ <!-- <xsl:if test="$namespace = 'jis'">
9769
+ <fo:inline font-weight="normal">)</fo:inline>
9770
+ </xsl:if> -->
9771
+ </fo:basic-link>
9772
+ </fo:inline>
9773
+ </xsl:otherwise>
9774
+ </xsl:choose>
9727
9775
  </xsl:template> <!-- fn -->
9728
9776
 
9729
9777
  <!-- fn/text() -->
@@ -9778,6 +9826,10 @@
9778
9826
  <!-- <dl><xsl:copy-of select="."/></dl> -->
9779
9827
  <fo:block-container xsl:use-attribute-sets="dl-block-style" role="SKIP">
9780
9828
 
9829
+ <xsl:if test="@key = 'true' and ancestor::*[local-name() = 'figure']">
9830
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
9831
+ </xsl:if>
9832
+
9781
9833
  <xsl:call-template name="setBlockSpanAll"/>
9782
9834
 
9783
9835
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -10078,7 +10130,7 @@
10078
10130
 
10079
10131
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
10080
10132
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
10081
- <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
10133
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always" keep-with-previous="always">
10082
10134
  <xsl:call-template name="refine_figure_key_style"/>
10083
10135
  <xsl:apply-templates/>
10084
10136
  </fo:block>
@@ -10329,6 +10381,7 @@
10329
10381
 
10330
10382
  <xsl:call-template name="refine_dt-cell-style"/>
10331
10383
 
10384
+ <xsl:call-template name="setNamedDestination"/>
10332
10385
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
10333
10386
 
10334
10387
  <xsl:choose>
@@ -10773,7 +10826,7 @@
10773
10826
  <!-- ================= -->
10774
10827
 
10775
10828
  <!-- highlight text -->
10776
- <xsl:template match="*[local-name()='hi']">
10829
+ <xsl:template match="*[local-name()='hi'] | *[local-name() = 'span'][@class = 'fmt-hi']" priority="3">
10777
10830
  <fo:inline background-color="yellow">
10778
10831
  <xsl:apply-templates/>
10779
10832
  </fo:inline>
@@ -12377,6 +12430,7 @@
12377
12430
  <!-- Appendix processing -->
12378
12431
  <!-- ======================== -->
12379
12432
  <xsl:template match="*[local-name()='appendix']">
12433
+ <xsl:call-template name="setNamedDestination"/>
12380
12434
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
12381
12435
  <xsl:apply-templates select="*[local-name()='title']"/>
12382
12436
  </fo:block>
@@ -12387,13 +12441,14 @@
12387
12441
  <xsl:variable name="level">
12388
12442
  <xsl:call-template name="getLevel"/>
12389
12443
  </xsl:variable>
12390
- <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
12444
+ <fo:inline role="H{$level}"><xsl:call-template name="setIDforNamedDestination"/><xsl:apply-templates/></fo:inline>
12391
12445
  </xsl:template>
12392
12446
  <!-- ======================== -->
12393
12447
  <!-- END Appendix processing -->
12394
12448
  <!-- ======================== -->
12395
12449
 
12396
12450
  <xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
12451
+ <xsl:call-template name="setNamedDestination"/>
12397
12452
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
12398
12453
  <xsl:apply-templates select="*[local-name()='name']"/>
12399
12454
  </fo:block>
@@ -12423,6 +12478,7 @@
12423
12478
  <xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
12424
12479
  <xsl:param name="callout"/>
12425
12480
  <fo:inline id="{@id}">
12481
+ <xsl:call-template name="setNamedDestination"/>
12426
12482
  <!-- for first p in annotation, put <x> -->
12427
12483
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
12428
12484
  <xsl:apply-templates/>
@@ -12473,6 +12529,7 @@
12473
12529
 
12474
12530
  </xsl:if>
12475
12531
  <fo:block-container margin-left="0mm" role="SKIP">
12532
+ <xsl:call-template name="setNamedDestination"/>
12476
12533
  <fo:block id="{@id}">
12477
12534
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
12478
12535
  </fo:block>
@@ -12518,8 +12575,13 @@
12518
12575
  </fo:block>
12519
12576
  </fo:table-cell>
12520
12577
  <fo:table-cell display-align="center">
12578
+
12521
12579
  <fo:block xsl:use-attribute-sets="formula-stem-number-style" role="SKIP">
12522
12580
 
12581
+ <xsl:for-each select="../*[local-name() = 'name']">
12582
+ <xsl:call-template name="setIDforNamedDestination"/>
12583
+ </xsl:for-each>
12584
+
12523
12585
  <xsl:call-template name="refine_formula-stem-number-style"/>
12524
12586
 
12525
12587
  <xsl:apply-templates select="../*[local-name() = 'name']"/>
@@ -12554,6 +12616,7 @@
12554
12616
 
12555
12617
  <xsl:template match="*[local-name() = 'note']" name="note">
12556
12618
 
12619
+ <xsl:call-template name="setNamedDestination"/>
12557
12620
  <fo:block id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
12558
12621
  <xsl:call-template name="setBlockSpanAll"/>
12559
12622
 
@@ -12609,6 +12672,7 @@
12609
12672
  </xsl:template>
12610
12673
 
12611
12674
  <xsl:template match="*[local-name() = 'termnote']">
12675
+ <xsl:call-template name="setNamedDestination"/>
12612
12676
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
12613
12677
 
12614
12678
  <xsl:call-template name="setBlockSpanAll"/>
@@ -12715,12 +12779,14 @@
12715
12779
 
12716
12780
  <xsl:template match="*[local-name() = 'terms']">
12717
12781
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
12782
+ <xsl:call-template name="setNamedDestination"/>
12718
12783
  <fo:block id="{@id}">
12719
12784
  <xsl:apply-templates/>
12720
12785
  </fo:block>
12721
12786
  </xsl:template>
12722
12787
 
12723
12788
  <xsl:template match="*[local-name() = 'term']">
12789
+ <xsl:call-template name="setNamedDestination"/>
12724
12790
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
12725
12791
 
12726
12792
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
@@ -12752,6 +12818,7 @@
12752
12818
  <xsl:template match="*[local-name() = 'figure']" name="figure">
12753
12819
  <xsl:variable name="isAdded" select="@added"/>
12754
12820
  <xsl:variable name="isDeleted" select="@deleted"/>
12821
+ <xsl:call-template name="setNamedDestination"/>
12755
12822
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
12756
12823
  <xsl:call-template name="refine_figure-block-style"/>
12757
12824
 
@@ -12773,6 +12840,11 @@
12773
12840
  </xsl:variable>
12774
12841
 
12775
12842
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
12843
+
12844
+ <xsl:for-each select="*[local-name() = 'name']"> <!-- set context -->
12845
+ <xsl:call-template name="setIDforNamedDestination"/>
12846
+ </xsl:for-each>
12847
+
12776
12848
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
12777
12849
  </fo:block>
12778
12850
 
@@ -12817,6 +12889,7 @@
12817
12889
  </xsl:template>
12818
12890
 
12819
12891
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
12892
+ <xsl:call-template name="setNamedDestination"/>
12820
12893
  <fo:block id="{@id}">
12821
12894
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
12822
12895
  </fo:block>
@@ -12830,6 +12903,7 @@
12830
12903
  </xsl:template>
12831
12904
 
12832
12905
  <!-- SOURCE: ... -->
12906
+ <!-- figure/source -->
12833
12907
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
12834
12908
 
12835
12909
  <xsl:call-template name="termsource"/>
@@ -13762,6 +13836,13 @@
13762
13836
  <xsl:apply-templates select="."/>
13763
13837
  </xsl:template>
13764
13838
 
13839
+ <!-- prevent missing stem for table and figures in ToC -->
13840
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
13841
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
13842
+ <xsl:apply-templates select="."/>
13843
+ </xsl:if>
13844
+ </xsl:template>
13845
+
13765
13846
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
13766
13847
 
13767
13848
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -13985,7 +14066,8 @@
13985
14066
 
13986
14067
  <xsl:for-each select="$contents_nodes//tables/table">
13987
14068
  <fo:bookmark internal-destination="{@id}">
13988
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
14069
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
14070
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
13989
14071
  </fo:bookmark>
13990
14072
  </xsl:for-each>
13991
14073
  </fo:bookmark>
@@ -13994,6 +14076,26 @@
13994
14076
  </xsl:template> <!-- insertTableBookmarks -->
13995
14077
  <!-- End Bookmarks -->
13996
14078
 
14079
+ <!-- ============================ -->
14080
+ <!-- mode="bookmark_clean" -->
14081
+ <!-- ============================ -->
14082
+ <xsl:template match="node()" mode="bookmark_clean">
14083
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
14084
+ </xsl:template>
14085
+
14086
+ <xsl:template match="text()" mode="bookmark_clean">
14087
+ <xsl:value-of select="."/>
14088
+ </xsl:template>
14089
+
14090
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
14091
+ <xsl:value-of select="normalize-space(.)"/>
14092
+ </xsl:template>
14093
+
14094
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
14095
+ <!-- ============================ -->
14096
+ <!-- END: mode="bookmark_clean" -->
14097
+ <!-- ============================ -->
14098
+
13997
14099
  <xsl:template name="getLangVersion">
13998
14100
  <xsl:param name="lang"/>
13999
14101
  <xsl:param name="doctype" select="''"/>
@@ -14041,6 +14143,7 @@
14041
14143
  <xsl:template match="title" mode="bookmark"/>
14042
14144
  <xsl:template match="text()" mode="bookmark"/>
14043
14145
 
14146
+ <!-- figure/name -->
14044
14147
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']">
14045
14148
  <xsl:if test="normalize-space() != ''">
14046
14149
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -14755,6 +14858,7 @@
14755
14858
  <!-- permission -->
14756
14859
  <!-- ========== -->
14757
14860
  <xsl:template match="*[local-name() = 'permission']">
14861
+ <xsl:call-template name="setNamedDestination"/>
14758
14862
  <fo:block id="{@id}" xsl:use-attribute-sets="permission-style">
14759
14863
  <xsl:apply-templates select="*[local-name()='name']"/>
14760
14864
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -14763,10 +14867,12 @@
14763
14867
 
14764
14868
  <xsl:template match="*[local-name() = 'permission']/*[local-name() = 'name']">
14765
14869
  <xsl:if test="normalize-space() != ''">
14766
- <fo:block xsl:use-attribute-sets="permission-name-style">
14767
- <xsl:apply-templates/>
14768
14870
 
14769
- </fo:block>
14871
+ <fo:block xsl:use-attribute-sets="permission-name-style">
14872
+ <xsl:apply-templates/>
14873
+
14874
+ </fo:block>
14875
+
14770
14876
  </xsl:if>
14771
14877
  </xsl:template>
14772
14878
 
@@ -14782,6 +14888,7 @@
14782
14888
  <!-- requirement -->
14783
14889
  <!-- ========== -->
14784
14890
  <xsl:template match="*[local-name() = 'requirement']">
14891
+ <xsl:call-template name="setNamedDestination"/>
14785
14892
  <fo:block id="{@id}" xsl:use-attribute-sets="requirement-style">
14786
14893
  <xsl:apply-templates select="*[local-name()='name']"/>
14787
14894
  <xsl:apply-templates select="*[local-name()='label']"/>
@@ -14793,11 +14900,13 @@
14793
14900
 
14794
14901
  <xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'name']">
14795
14902
  <xsl:if test="normalize-space() != ''">
14796
- <fo:block xsl:use-attribute-sets="requirement-name-style">
14797
14903
 
14798
- <xsl:apply-templates/>
14904
+ <fo:block xsl:use-attribute-sets="requirement-name-style">
14905
+
14906
+ <xsl:apply-templates/>
14907
+
14908
+ </fo:block>
14799
14909
 
14800
- </fo:block>
14801
14910
  </xsl:if>
14802
14911
  </xsl:template>
14803
14912
 
@@ -14826,6 +14935,7 @@
14826
14935
  <!-- recommendation -->
14827
14936
  <!-- ========== -->
14828
14937
  <xsl:template match="*[local-name() = 'recommendation']">
14938
+ <xsl:call-template name="setNamedDestination"/>
14829
14939
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
14830
14940
  <xsl:apply-templates select="*[local-name()='name']"/>
14831
14941
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -14834,10 +14944,12 @@
14834
14944
 
14835
14945
  <xsl:template match="*[local-name() = 'recommendation']/*[local-name() = 'name']">
14836
14946
  <xsl:if test="normalize-space() != ''">
14837
- <fo:block xsl:use-attribute-sets="recommendation-name-style">
14838
- <xsl:apply-templates/>
14839
14947
 
14840
- </fo:block>
14948
+ <fo:block xsl:use-attribute-sets="recommendation-name-style">
14949
+ <xsl:apply-templates/>
14950
+
14951
+ </fo:block>
14952
+
14841
14953
  </xsl:if>
14842
14954
  </xsl:template>
14843
14955
 
@@ -14916,6 +15028,7 @@
14916
15028
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
14917
15029
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
14918
15030
  </xsl:if>
15031
+ <xsl:call-template name="setNamedDestination"/>
14919
15032
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
14920
15033
  <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
14921
15034
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -15025,6 +15138,7 @@
15025
15138
  <!-- termexample -->
15026
15139
  <!-- ====== -->
15027
15140
  <xsl:template match="*[local-name() = 'termexample']">
15141
+ <xsl:call-template name="setNamedDestination"/>
15028
15142
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
15029
15143
  <xsl:call-template name="refine_termexample-style"/>
15030
15144
  <xsl:call-template name="setBlockSpanAll"/>
@@ -15079,6 +15193,7 @@
15079
15193
  -->
15080
15194
  <xsl:template match="*[local-name() = 'example']" name="example">
15081
15195
 
15196
+ <xsl:call-template name="setNamedDestination"/>
15082
15197
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
15083
15198
  <xsl:call-template name="setBlockSpanAll"/>
15084
15199
 
@@ -15551,12 +15666,17 @@
15551
15666
  </xsl:if>
15552
15667
 
15553
15668
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
15669
+
15554
15670
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
15555
15671
 
15556
15672
  <xsl:if test="not($vertical_layout = 'true')">
15557
15673
  <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
15558
15674
  </xsl:if>
15559
15675
 
15676
+ <xsl:for-each select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"><!-- change context -->
15677
+ <xsl:call-template name="setIDforNamedDestination"/>
15678
+ </xsl:for-each>
15679
+
15560
15680
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
15561
15681
  </fo:block>
15562
15682
  </xsl:if>
@@ -15685,6 +15805,7 @@
15685
15805
  <!-- main sections -->
15686
15806
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
15687
15807
 
15808
+ <xsl:call-template name="setNamedDestination"/>
15688
15809
  <fo:block>
15689
15810
  <xsl:call-template name="setId"/>
15690
15811
 
@@ -15725,6 +15846,7 @@
15725
15846
 
15726
15847
  <fo:block break-after="page"/>
15727
15848
 
15849
+ <xsl:call-template name="setNamedDestination"/>
15728
15850
  <fo:block>
15729
15851
  <xsl:call-template name="setId"/>
15730
15852
  <xsl:call-template name="addReviewHelper"/>
@@ -15753,6 +15875,7 @@
15753
15875
  </xsl:template>
15754
15876
 
15755
15877
  <xsl:template match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
15878
+ <xsl:call-template name="setNamedDestination"/>
15756
15879
  <fo:block>
15757
15880
  <xsl:if test="parent::*[local-name() = 'copyright-statement']">
15758
15881
  <xsl:attribute name="role">SKIP</xsl:attribute>
@@ -15775,6 +15898,7 @@
15775
15898
  </xsl:template> <!-- refine_clause_style -->
15776
15899
 
15777
15900
  <xsl:template match="*[local-name() = 'definitions']">
15901
+ <xsl:call-template name="setNamedDestination"/>
15778
15902
  <fo:block id="{@id}">
15779
15903
  <xsl:apply-templates/>
15780
15904
  </fo:block>
@@ -15790,6 +15914,8 @@
15790
15914
  <xsl:otherwise>
15791
15915
 
15792
15916
  <fo:block break-after="page"/>
15917
+ <xsl:call-template name="setNamedDestination"/>
15918
+
15793
15919
  <fo:block id="{@id}">
15794
15920
 
15795
15921
  <xsl:call-template name="setBlockSpanAll"/>
@@ -15861,6 +15987,7 @@
15861
15987
  <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
15862
15988
  following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
15863
15989
  <!-- <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> -->
15990
+ <xsl:call-template name="setNamedDestination"/>
15864
15991
  <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
15992
  <!-- </xsl:if> -->
15866
15993
  </xsl:if>
@@ -15961,9 +16088,15 @@
15961
16088
  <xsl:when test="local-name(..) = 'ul'">
15962
16089
  <xsl:choose>
15963
16090
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
16091
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
16092
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
15964
16093
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
15965
16094
  </xsl:choose>
15966
16095
  </xsl:when>
16096
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
16097
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
16098
+ <xsl:value-of select="@label"/>
16099
+ </xsl:when>
15967
16100
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
15968
16101
 
15969
16102
  <xsl:variable name="type" select="../@type"/>
@@ -16088,7 +16221,7 @@
16088
16221
 
16089
16222
  </xsl:otherwise>
16090
16223
  </xsl:choose>
16091
- </xsl:template>
16224
+ </xsl:template> <!-- getListItemFormat -->
16092
16225
 
16093
16226
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
16094
16227
  <xsl:param name="indent">0</xsl:param>
@@ -16245,6 +16378,11 @@
16245
16378
 
16246
16379
  <xsl:call-template name="refine_list-item-label-style"/>
16247
16380
 
16381
+ <xsl:if test="local-name(..) = 'ul'">
16382
+ <xsl:variable name="li_label" select="@label"/>
16383
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
16384
+ </xsl:if>
16385
+
16248
16386
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
16249
16387
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
16250
16388
  <xsl:call-template name="append_add-style"/>
@@ -16591,6 +16729,7 @@
16591
16729
  <!-- Normative references -->
16592
16730
  <xsl:template match="*[local-name() = 'references'][@normative='true']" priority="2">
16593
16731
 
16732
+ <xsl:call-template name="setNamedDestination"/>
16594
16733
  <fo:block id="{@id}">
16595
16734
  <xsl:apply-templates/>
16596
16735
 
@@ -16621,6 +16760,7 @@
16621
16760
  </xsl:if>
16622
16761
  </xsl:if> -->
16623
16762
 
16763
+ <xsl:call-template name="setNamedDestination"/>
16624
16764
  <fo:block id="{@id}"/>
16625
16765
 
16626
16766
  <xsl:apply-templates select="*[local-name() = 'title'][@columns = 1]"/>
@@ -16645,6 +16785,7 @@
16645
16785
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
16646
16786
  <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
16647
16787
 
16788
+ <xsl:call-template name="setNamedDestination"/>
16648
16789
  <fo:block-container margin-left="6mm" role="SKIP">
16649
16790
  <fo:block-container margin-left="0mm" role="SKIP">
16650
16791
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
@@ -16661,6 +16802,7 @@
16661
16802
  <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
16662
16803
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
16663
16804
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
16805
+ <xsl:call-template name="setNamedDestination"/>
16664
16806
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
16665
16807
 
16666
16808
  <fo:list-item>
@@ -16690,6 +16832,7 @@
16690
16832
  <xsl:choose>
16691
16833
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
16692
16834
  <xsl:otherwise>
16835
+ <xsl:call-template name="setNamedDestination"/>
16693
16836
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
16694
16837
 
16695
16838
  <fo:list-item-label end-indent="label-end()">
@@ -17086,6 +17229,7 @@
17086
17229
  <xsl:template match="*[local-name() = 'admonition']">
17087
17230
 
17088
17231
  <!-- text in the box -->
17232
+ <xsl:call-template name="setNamedDestination"/>
17089
17233
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
17090
17234
 
17091
17235
  <xsl:call-template name="setBlockSpanAll"/>
@@ -17341,7 +17485,7 @@
17341
17485
  </xsl:template>
17342
17486
 
17343
17487
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
17344
- <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear' or @class = 'horizontal' or @class = 'norotate' or @class = 'halffontsize']" mode="update_xml_step1" priority="2">
17488
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear' or @class = 'fmt-hi' or @class = 'horizontal' or @class = 'norotate' or @class = 'halffontsize']" mode="update_xml_step1" priority="2">
17345
17489
  <xsl:copy>
17346
17490
  <xsl:copy-of select="@*"/>
17347
17491
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -17373,28 +17517,56 @@
17373
17517
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_step1"/>
17374
17518
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_pres"/>
17375
17519
 
17376
- <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_step1">
17520
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="update_xml_step1">
17377
17521
  <xsl:element name="stem" namespace="{$namespace_full}">
17378
17522
  <xsl:copy-of select="@*"/>
17379
17523
  <xsl:choose>
17380
17524
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
17381
- <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
17525
+ <xsl:choose>
17526
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
17527
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
17528
+ </xsl:when>
17529
+ <xsl:otherwise>
17530
+ <xsl:apply-templates select="*[local-name() = 'semx']/node()" mode="update_xml_step1"/>
17531
+ </xsl:otherwise>
17532
+ </xsl:choose>
17382
17533
  </xsl:when>
17383
17534
  <xsl:otherwise>
17384
- <xsl:copy-of select="node()"/>
17535
+ <xsl:choose>
17536
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
17537
+ <xsl:copy-of select="node()"/>
17538
+ </xsl:when>
17539
+ <xsl:otherwise>
17540
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
17541
+ </xsl:otherwise>
17542
+ </xsl:choose>
17385
17543
  </xsl:otherwise>
17386
17544
  </xsl:choose>
17387
17545
  </xsl:element>
17388
17546
  </xsl:template>
17389
- <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_pres">
17547
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="update_xml_pres">
17390
17548
  <xsl:element name="stem" namespace="{$namespace_full}">
17391
17549
  <xsl:copy-of select="@*"/>
17392
17550
  <xsl:choose>
17393
17551
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
17394
- <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
17552
+ <xsl:choose>
17553
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
17554
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
17555
+ </xsl:when>
17556
+ <xsl:otherwise>
17557
+ <xsl:apply-templates select="*[local-name() = 'semx']/node()" mode="update_xml_pres"/>
17558
+ </xsl:otherwise>
17559
+ </xsl:choose>
17395
17560
  </xsl:when>
17396
17561
  <xsl:otherwise>
17397
- <xsl:copy-of select="node()"/>
17562
+ <xsl:choose>
17563
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
17564
+ <xsl:copy-of select="node()"/>
17565
+ </xsl:when>
17566
+ <xsl:otherwise>
17567
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
17568
+ </xsl:otherwise>
17569
+ </xsl:choose>
17398
17570
  </xsl:otherwise>
17399
17571
  </xsl:choose>
17400
17572
  </xsl:element>
@@ -17623,16 +17795,24 @@
17623
17795
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
17624
17796
  <xsl:element name="title" namespace="{$namespace_full}">
17625
17797
  <xsl:copy-of select="@*"/>
17798
+ <xsl:call-template name="addNamedDestinationAttribute"/>
17799
+
17626
17800
  <xsl:apply-templates mode="update_xml_step1"/>
17627
17801
  </xsl:element>
17628
17802
  </xsl:template>
17629
17803
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
17630
17804
  <xsl:element name="title" namespace="{$namespace_full}">
17631
17805
  <xsl:copy-of select="@*"/>
17806
+ <xsl:call-template name="addNamedDestinationAttribute"/>
17807
+
17632
17808
  <xsl:apply-templates mode="update_xml_pres"/>
17633
17809
  </xsl:element>
17634
17810
  </xsl:template>
17635
17811
 
17812
+ <xsl:template name="addNamedDestinationAttribute">
17813
+
17814
+ </xsl:template>
17815
+
17636
17816
  <xsl:template match="*[local-name() = 'fmt-name']"/>
17637
17817
  <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
17638
17818
  <xsl:choose>
@@ -17642,6 +17822,8 @@
17642
17822
  <xsl:otherwise>
17643
17823
  <xsl:element name="name" namespace="{$namespace_full}">
17644
17824
  <xsl:copy-of select="@*"/>
17825
+ <xsl:call-template name="addNamedDestinationAttribute"/>
17826
+
17645
17827
  <xsl:apply-templates mode="update_xml_step1"/>
17646
17828
  </xsl:element>
17647
17829
  </xsl:otherwise>
@@ -17655,12 +17837,24 @@
17655
17837
  <xsl:otherwise>
17656
17838
  <xsl:element name="name" namespace="{$namespace_full}">
17657
17839
  <xsl:copy-of select="@*"/>
17840
+ <xsl:call-template name="addNamedDestinationAttribute"/>
17841
+
17658
17842
  <xsl:apply-templates mode="update_xml_pres"/>
17659
17843
  </xsl:element>
17660
17844
  </xsl:otherwise>
17661
17845
  </xsl:choose>
17662
17846
  </xsl:template>
17663
17847
 
17848
+ <!-- li/fmt-name -->
17849
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
17850
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
17851
+ <xsl:attribute name="full">true</xsl:attribute>
17852
+ </xsl:template>
17853
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
17854
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
17855
+ <xsl:attribute name="full">true</xsl:attribute>
17856
+ </xsl:template>
17857
+
17664
17858
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
17665
17859
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
17666
17860
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -18582,6 +18776,64 @@
18582
18776
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
18583
18777
  </xsl:template>
18584
18778
 
18779
+ <!-- ===================================== -->
18780
+ <!-- ===================================== -->
18781
+ <!-- Ruby text (CJK languages) rendering -->
18782
+ <!-- ===================================== -->
18783
+ <!-- ===================================== -->
18784
+ <xsl:template match="*[local-name() = 'ruby']">
18785
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
18786
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
18787
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
18788
+ </xsl:if>
18789
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
18790
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
18791
+ <!-- Example: width="2em" -->
18792
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
18793
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
18794
+ <xsl:variable name="text_width">
18795
+ <xsl:choose>
18796
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
18797
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
18798
+ </xsl:choose>
18799
+ </xsl:variable>
18800
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
18801
+
18802
+ <xsl:choose>
18803
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
18804
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
18805
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
18806
+ </xsl:when>
18807
+ <xsl:otherwise>
18808
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
18809
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
18810
+ </xsl:otherwise>
18811
+ </xsl:choose>
18812
+
18813
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
18814
+ </fo:inline-container>
18815
+ </xsl:template>
18816
+
18817
+ <xsl:template match="*[local-name() = 'rb']">
18818
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
18819
+ </xsl:template>
18820
+
18821
+ <xsl:template match="*[local-name() = 'rt']">
18822
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
18823
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
18824
+ <xsl:attribute name="space-before">0em</xsl:attribute>
18825
+ </xsl:if>
18826
+ <xsl:apply-templates/>
18827
+ </fo:block>
18828
+
18829
+ </xsl:template>
18830
+
18831
+ <!-- ===================================== -->
18832
+ <!-- ===================================== -->
18833
+ <!-- END: Ruby text (CJK languages) rendering -->
18834
+ <!-- ===================================== -->
18835
+ <!-- ===================================== -->
18836
+
18585
18837
  <xsl:template name="printEdition">
18586
18838
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
18587
18839
 
@@ -19156,6 +19408,24 @@
19156
19408
  </xsl:attribute>
19157
19409
  </xsl:template>
19158
19410
 
19411
+ <xsl:template name="setIDforNamedDestination">
19412
+ <xsl:if test="@named_dest">
19413
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
19414
+ </xsl:if>
19415
+ </xsl:template>
19416
+
19417
+ <xsl:template name="setNamedDestination">
19418
+ <!-- skip GUID, e.g. _33eac3cb-9663-4291-ae26-1d4b6f4635fc -->
19419
+ <xsl:if test="@id and normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}')) = 'false'">
19420
+ <fox:destination internal-destination="{@id}"/>
19421
+ </xsl:if>
19422
+ <xsl:for-each select=". | *[local-name() = 'title'] | *[local-name() = 'name']">
19423
+ <xsl:if test="@named_dest">
19424
+ <fox:destination internal-destination="{@named_dest}"/>
19425
+ </xsl:if>
19426
+ </xsl:for-each>
19427
+ </xsl:template>
19428
+
19159
19429
  <xsl:template name="add-letter-spacing">
19160
19430
  <xsl:param name="text"/>
19161
19431
  <xsl:param name="letter-spacing" select="'0.15'"/>