metanorma-ogc 2.7.3 → 2.7.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/base_convert.rb +4 -17
  3. data/lib/isodoc/ogc/html/htmlstyle.css +1 -1
  4. data/lib/isodoc/ogc/html/htmlstyle.scss +1 -1
  5. data/lib/isodoc/ogc/html/ogc.css +1 -1
  6. data/lib/isodoc/ogc/html/ogc.scss +1 -1
  7. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +354 -82
  8. data/lib/isodoc/ogc/ogc.best-practice.xsl +354 -82
  9. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +354 -82
  10. data/lib/isodoc/ogc/ogc.community-practice.xsl +354 -82
  11. data/lib/isodoc/ogc/ogc.community-standard.xsl +354 -82
  12. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +354 -82
  13. data/lib/isodoc/ogc/ogc.draft-standard.xsl +354 -82
  14. data/lib/isodoc/ogc/ogc.engineering-report.xsl +354 -82
  15. data/lib/isodoc/ogc/ogc.other.xsl +354 -82
  16. data/lib/isodoc/ogc/ogc.policy.xsl +354 -82
  17. data/lib/isodoc/ogc/ogc.reference-model.xsl +354 -82
  18. data/lib/isodoc/ogc/ogc.release-notes.xsl +354 -82
  19. data/lib/isodoc/ogc/ogc.standard.xsl +354 -82
  20. data/lib/isodoc/ogc/ogc.test-suite.xsl +354 -82
  21. data/lib/isodoc/ogc/ogc.user-guide.xsl +354 -82
  22. data/lib/isodoc/ogc/ogc.white-paper.xsl +341 -68
  23. data/lib/isodoc/ogc/presentation_sections.rb +18 -14
  24. data/lib/isodoc/ogc/presentation_xml_convert.rb +18 -8
  25. data/lib/isodoc/ogc/sections.rb +0 -11
  26. data/lib/isodoc/ogc/xref.rb +9 -10
  27. data/lib/metanorma/ogc/basicdoc.rng +14 -8
  28. data/lib/metanorma/ogc/biblio-standoc.rng +37 -7
  29. data/lib/metanorma/ogc/biblio.rng +30 -18
  30. data/lib/metanorma/ogc/cleanup.rb +8 -18
  31. data/lib/metanorma/ogc/converter.rb +12 -12
  32. data/lib/metanorma/ogc/isodoc.rng +130 -96
  33. data/lib/metanorma/ogc/ogc.rng +2 -67
  34. data/lib/metanorma/ogc/relaton-ogc.rng +0 -16
  35. data/lib/metanorma/ogc/reqt.rng +7 -6
  36. data/lib/metanorma/ogc/validate.rb +18 -21
  37. data/lib/metanorma/ogc/version.rb +1 -1
  38. metadata +2 -2
@@ -372,9 +372,12 @@
372
372
  <xsl:template match="ogc:preface//ogc:clause[@type = 'toc']" priority="4">
373
373
  <fo:block break-after="page"/>
374
374
  <fo:block-container line-height="1.08" font-family="Lato">
375
+
376
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
377
+
375
378
  <fo:block role="TOC">
376
379
 
377
- <xsl:apply-templates/>
380
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
378
381
 
379
382
  <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
380
383
 
@@ -1496,6 +1499,7 @@
1496
1499
  </xsl:template> <!-- refine_table-style -->
1497
1500
 
1498
1501
  <xsl:attribute-set name="table-name-style">
1502
+ <xsl:attribute name="role">Caption</xsl:attribute>
1499
1503
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1500
1504
 
1501
1505
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1511,6 +1515,9 @@
1511
1515
 
1512
1516
  <xsl:template name="refine_table-name-style">
1513
1517
  <xsl:param name="continued"/>
1518
+ <xsl:if test="$continued = 'true'">
1519
+ <xsl:attribute name="role">SKIP</xsl:attribute>
1520
+ </xsl:if>
1514
1521
 
1515
1522
  </xsl:template> <!-- refine_table-name-style -->
1516
1523
 
@@ -3191,8 +3198,14 @@
3191
3198
  </xsl:choose>
3192
3199
  </xsl:variable>
3193
3200
 
3201
+ <xsl:call-template name="setNamedDestination"/>
3202
+
3194
3203
  <fo:block-container xsl:use-attribute-sets="table-container-style" role="SKIP">
3195
3204
 
3205
+ <xsl:for-each select="*[local-name() = 'name']">
3206
+ <xsl:call-template name="setIDforNamedDestination"/>
3207
+ </xsl:for-each>
3208
+
3196
3209
  <xsl:call-template name="refine_table-container-style">
3197
3210
  <xsl:with-param name="margin-side" select="$margin-side"/>
3198
3211
  </xsl:call-template>
@@ -3344,7 +3357,7 @@
3344
3357
  </xsl:if>
3345
3358
 
3346
3359
  </fo:block-container>
3347
- </xsl:variable>
3360
+ </xsl:variable> <!-- END: variable name="table" -->
3348
3361
 
3349
3362
  <xsl:variable name="isAdded" select="@added"/>
3350
3363
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -3398,11 +3411,13 @@
3398
3411
 
3399
3412
  </xsl:template>
3400
3413
 
3414
+ <!-- table/name-->
3401
3415
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3402
3416
  <xsl:param name="continued"/>
3417
+ <xsl:param name="cols-count"/>
3403
3418
  <xsl:if test="normalize-space() != ''">
3404
3419
 
3405
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
3420
+ <fo:block xsl:use-attribute-sets="table-name-style">
3406
3421
 
3407
3422
  <xsl:call-template name="refine_table-name-style">
3408
3423
  <xsl:with-param name="continued" select="$continued"/>
@@ -3421,9 +3436,30 @@
3421
3436
 
3422
3437
  <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3423
3438
  <xsl:if test="$continued = 'true'">
3424
- <fo:block text-align="right">
3425
- <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3426
- </fo:block>
3439
+
3440
+ <!-- to prevent the error 'THead element may contain only TR elements' -->
3441
+
3442
+ <xsl:choose>
3443
+ <xsl:when test="string(number($cols-count)) != 'NaN'">
3444
+ <fo:table width="100%" table-layout="fixed" role="SKIP">
3445
+ <fo:table-body role="SKIP">
3446
+ <fo:table-row>
3447
+ <fo:table-cell role="TH" number-columns-spanned="{$cols-count}">
3448
+ <fo:block text-align="right" role="SKIP">
3449
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3450
+ </fo:block>
3451
+ </fo:table-cell>
3452
+ </fo:table-row>
3453
+ </fo:table-body>
3454
+ </fo:table>
3455
+ </xsl:when>
3456
+ <xsl:otherwise>
3457
+ <fo:block text-align="right">
3458
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3459
+ </fo:block>
3460
+ </xsl:otherwise>
3461
+ </xsl:choose>
3462
+
3427
3463
  </xsl:if>
3428
3464
  <!-- </xsl:if> -->
3429
3465
 
@@ -3816,6 +3852,7 @@
3816
3852
 
3817
3853
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3818
3854
  <xsl:with-param name="continued">true</xsl:with-param>
3855
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3819
3856
  </xsl:apply-templates>
3820
3857
 
3821
3858
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
@@ -3879,7 +3916,7 @@
3879
3916
 
3880
3917
  <xsl:variable name="tableWithNotesAndFootnotes">
3881
3918
 
3882
- <fo:table keep-with-previous="always">
3919
+ <fo:table keep-with-previous="always" role="SKIP">
3883
3920
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
3884
3921
  <xsl:variable name="name" select="local-name()"/>
3885
3922
  <xsl:choose>
@@ -3910,9 +3947,9 @@
3910
3947
  </xsl:otherwise>
3911
3948
  </xsl:choose>
3912
3949
 
3913
- <fo:table-body>
3914
- <fo:table-row>
3915
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3950
+ <fo:table-body role="SKIP">
3951
+ <fo:table-row role="SKIP">
3952
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
3916
3953
 
3917
3954
  <xsl:call-template name="refine_table-footer-cell-style"/>
3918
3955
 
@@ -4197,8 +4234,8 @@
4197
4234
  <xsl:for-each select="xalan:nodeset($styles__)/item">
4198
4235
  <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
4199
4236
  <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
4200
- <xsl:if test="$key = 'color' or $key = 'background-color'">
4201
- <style name="{$key}"><xsl:value-of select="$value"/></style>
4237
+ <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'">
4238
+ <style name="{$key}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($value), 'currentColor', 'inherit')"/></style>
4202
4239
  </xsl:if>
4203
4240
  </xsl:for-each>
4204
4241
  </xsl:variable>
@@ -4262,6 +4299,7 @@
4262
4299
  <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4263
4300
  <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">
4264
4301
 
4302
+ <xsl:call-template name="setNamedDestination"/>
4265
4303
  <fo:block xsl:use-attribute-sets="table-note-style">
4266
4304
  <xsl:copy-of select="@id"/>
4267
4305
 
@@ -4309,6 +4347,7 @@
4309
4347
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4310
4348
  <!-- fn in text -->
4311
4349
  <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">
4350
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
4312
4351
 
4313
4352
  <!-- list of unique footnotes -->
4314
4353
  <xsl:variable name="p_fn_">
@@ -4374,7 +4413,7 @@
4374
4413
  <xsl:copy-of select="$footnote_inline"/>
4375
4414
  </xsl:when>
4376
4415
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4377
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4416
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
4378
4417
 
4379
4418
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4380
4419
  <xsl:copy-of select="$footnote_inline"/>
@@ -4783,39 +4822,51 @@
4783
4822
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4784
4823
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4785
4824
  <xsl:template match="*[local-name()='fn']">
4786
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
4787
-
4788
- <xsl:call-template name="refine_fn-reference-style"/>
4825
+ <xsl:variable name="target" select="@target"/>
4826
+ <xsl:choose>
4827
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
4828
+ <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]">
4829
+ <xsl:call-template name="fn">
4830
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
4831
+ </xsl:call-template>
4832
+ </xsl:when>
4833
+ <xsl:otherwise>
4789
4834
 
4790
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4791
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4792
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4793
- <!-- <xsl:attribute name="internal-destination">
4794
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4795
- </xsl:attribute>
4796
- </xsl:if>
4797
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4798
- <xsl:attribute name="internal-destination">
4799
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4800
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4801
- </xsl:attribute>
4802
- </xsl:if> -->
4803
- <!-- <xsl:if test="$namespace = 'plateau'">
4804
- <xsl:text>※</xsl:text>
4805
- </xsl:if> -->
4806
- <!-- <xsl:value-of select="@reference"/> -->
4835
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
4807
4836
 
4808
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4837
+ <xsl:call-template name="refine_fn-reference-style"/>
4809
4838
 
4810
- <!-- <xsl:if test="$namespace = 'bsi'">
4811
- <xsl:text>)</xsl:text>
4812
- </xsl:if> -->
4813
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4814
- <!-- <xsl:if test="$namespace = 'jis'">
4815
- <fo:inline font-weight="normal">)</fo:inline>
4816
- </xsl:if> -->
4817
- </fo:basic-link>
4818
- </fo:inline>
4839
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4840
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4841
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4842
+ <!-- <xsl:attribute name="internal-destination">
4843
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4844
+ </xsl:attribute>
4845
+ </xsl:if>
4846
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4847
+ <xsl:attribute name="internal-destination">
4848
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4849
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4850
+ </xsl:attribute>
4851
+ </xsl:if> -->
4852
+ <!-- <xsl:if test="$namespace = 'plateau'">
4853
+ <xsl:text>※</xsl:text>
4854
+ </xsl:if> -->
4855
+ <!-- <xsl:value-of select="@reference"/> -->
4856
+
4857
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4858
+
4859
+ <!-- <xsl:if test="$namespace = 'bsi'">
4860
+ <xsl:text>)</xsl:text>
4861
+ </xsl:if> -->
4862
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4863
+ <!-- <xsl:if test="$namespace = 'jis'">
4864
+ <fo:inline font-weight="normal">)</fo:inline>
4865
+ </xsl:if> -->
4866
+ </fo:basic-link>
4867
+ </fo:inline>
4868
+ </xsl:otherwise>
4869
+ </xsl:choose>
4819
4870
  </xsl:template> <!-- fn -->
4820
4871
 
4821
4872
  <!-- fn/text() -->
@@ -4870,6 +4921,10 @@
4870
4921
  <!-- <dl><xsl:copy-of select="."/></dl> -->
4871
4922
  <fo:block-container xsl:use-attribute-sets="dl-block-style" role="SKIP">
4872
4923
 
4924
+ <xsl:if test="@key = 'true' and ancestor::*[local-name() = 'figure']">
4925
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
4926
+ </xsl:if>
4927
+
4873
4928
  <xsl:call-template name="setBlockSpanAll"/>
4874
4929
 
4875
4930
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -5163,7 +5218,7 @@
5163
5218
 
5164
5219
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
5165
5220
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
5166
- <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
5221
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always" keep-with-previous="always">
5167
5222
  <xsl:call-template name="refine_figure_key_style"/>
5168
5223
  <xsl:apply-templates/>
5169
5224
  </fo:block>
@@ -5414,6 +5469,7 @@
5414
5469
 
5415
5470
  <xsl:call-template name="refine_dt-cell-style"/>
5416
5471
 
5472
+ <xsl:call-template name="setNamedDestination"/>
5417
5473
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
5418
5474
 
5419
5475
  <xsl:choose>
@@ -5853,7 +5909,7 @@
5853
5909
  <!-- ================= -->
5854
5910
 
5855
5911
  <!-- highlight text -->
5856
- <xsl:template match="*[local-name()='hi']">
5912
+ <xsl:template match="*[local-name()='hi'] | *[local-name() = 'span'][@class = 'fmt-hi']" priority="3">
5857
5913
  <fo:inline background-color="yellow">
5858
5914
  <xsl:apply-templates/>
5859
5915
  </fo:inline>
@@ -7448,6 +7504,7 @@
7448
7504
  <!-- Appendix processing -->
7449
7505
  <!-- ======================== -->
7450
7506
  <xsl:template match="*[local-name()='appendix']">
7507
+ <xsl:call-template name="setNamedDestination"/>
7451
7508
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
7452
7509
  <xsl:apply-templates select="*[local-name()='title']"/>
7453
7510
  </fo:block>
@@ -7458,13 +7515,14 @@
7458
7515
  <xsl:variable name="level">
7459
7516
  <xsl:call-template name="getLevel"/>
7460
7517
  </xsl:variable>
7461
- <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
7518
+ <fo:inline role="H{$level}"><xsl:call-template name="setIDforNamedDestination"/><xsl:apply-templates/></fo:inline>
7462
7519
  </xsl:template>
7463
7520
  <!-- ======================== -->
7464
7521
  <!-- END Appendix processing -->
7465
7522
  <!-- ======================== -->
7466
7523
 
7467
7524
  <xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
7525
+ <xsl:call-template name="setNamedDestination"/>
7468
7526
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
7469
7527
  <xsl:apply-templates select="*[local-name()='name']"/>
7470
7528
  </fo:block>
@@ -7494,6 +7552,7 @@
7494
7552
  <xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
7495
7553
  <xsl:param name="callout"/>
7496
7554
  <fo:inline id="{@id}">
7555
+ <xsl:call-template name="setNamedDestination"/>
7497
7556
  <!-- for first p in annotation, put <x> -->
7498
7557
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
7499
7558
  <xsl:apply-templates/>
@@ -7540,6 +7599,7 @@
7540
7599
 
7541
7600
  </xsl:if>
7542
7601
  <fo:block-container margin-left="0mm" role="SKIP">
7602
+ <xsl:call-template name="setNamedDestination"/>
7543
7603
  <fo:block id="{@id}">
7544
7604
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
7545
7605
  </fo:block>
@@ -7585,8 +7645,13 @@
7585
7645
  </fo:block>
7586
7646
  </fo:table-cell>
7587
7647
  <fo:table-cell display-align="center">
7648
+
7588
7649
  <fo:block xsl:use-attribute-sets="formula-stem-number-style" role="SKIP">
7589
7650
 
7651
+ <xsl:for-each select="../*[local-name() = 'name']">
7652
+ <xsl:call-template name="setIDforNamedDestination"/>
7653
+ </xsl:for-each>
7654
+
7590
7655
  <xsl:call-template name="refine_formula-stem-number-style"/>
7591
7656
 
7592
7657
  <xsl:apply-templates select="../*[local-name() = 'name']"/>
@@ -7621,6 +7686,8 @@
7621
7686
 
7622
7687
  <xsl:template match="*[local-name() = 'note']" name="note">
7623
7688
 
7689
+ <xsl:call-template name="setNamedDestination"/>
7690
+
7624
7691
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
7625
7692
 
7626
7693
  <xsl:call-template name="setBlockSpanAll"/>
@@ -7685,6 +7752,7 @@
7685
7752
  </xsl:template>
7686
7753
 
7687
7754
  <xsl:template match="*[local-name() = 'termnote']">
7755
+ <xsl:call-template name="setNamedDestination"/>
7688
7756
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
7689
7757
 
7690
7758
  <xsl:call-template name="setBlockSpanAll"/>
@@ -7791,12 +7859,14 @@
7791
7859
 
7792
7860
  <xsl:template match="*[local-name() = 'terms']">
7793
7861
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
7862
+ <xsl:call-template name="setNamedDestination"/>
7794
7863
  <fo:block id="{@id}">
7795
7864
  <xsl:apply-templates/>
7796
7865
  </fo:block>
7797
7866
  </xsl:template>
7798
7867
 
7799
7868
  <xsl:template match="*[local-name() = 'term']">
7869
+ <xsl:call-template name="setNamedDestination"/>
7800
7870
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
7801
7871
 
7802
7872
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
@@ -7828,6 +7898,7 @@
7828
7898
  <xsl:template match="*[local-name() = 'figure']" name="figure">
7829
7899
  <xsl:variable name="isAdded" select="@added"/>
7830
7900
  <xsl:variable name="isDeleted" select="@deleted"/>
7901
+ <xsl:call-template name="setNamedDestination"/>
7831
7902
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
7832
7903
  <xsl:call-template name="refine_figure-block-style"/>
7833
7904
 
@@ -7844,6 +7915,11 @@
7844
7915
  </xsl:variable>
7845
7916
 
7846
7917
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
7918
+
7919
+ <xsl:for-each select="*[local-name() = 'name']"> <!-- set context -->
7920
+ <xsl:call-template name="setIDforNamedDestination"/>
7921
+ </xsl:for-each>
7922
+
7847
7923
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
7848
7924
  </fo:block>
7849
7925
 
@@ -7876,6 +7952,7 @@
7876
7952
  </xsl:template>
7877
7953
 
7878
7954
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
7955
+ <xsl:call-template name="setNamedDestination"/>
7879
7956
  <fo:block id="{@id}">
7880
7957
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7881
7958
  </fo:block>
@@ -7889,6 +7966,7 @@
7889
7966
  </xsl:template>
7890
7967
 
7891
7968
  <!-- SOURCE: ... -->
7969
+ <!-- figure/source -->
7892
7970
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7893
7971
 
7894
7972
  <xsl:call-template name="termsource"/>
@@ -8814,6 +8892,13 @@
8814
8892
  <xsl:apply-templates select="."/>
8815
8893
  </xsl:template>
8816
8894
 
8895
+ <!-- prevent missing stem for table and figures in ToC -->
8896
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
8897
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
8898
+ <xsl:apply-templates select="."/>
8899
+ </xsl:if>
8900
+ </xsl:template>
8901
+
8817
8902
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
8818
8903
 
8819
8904
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -9012,6 +9097,26 @@
9012
9097
  </xsl:template> <!-- insertTableBookmarks -->
9013
9098
  <!-- End Bookmarks -->
9014
9099
 
9100
+ <!-- ============================ -->
9101
+ <!-- mode="bookmark_clean" -->
9102
+ <!-- ============================ -->
9103
+ <xsl:template match="node()" mode="bookmark_clean">
9104
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
9105
+ </xsl:template>
9106
+
9107
+ <xsl:template match="text()" mode="bookmark_clean">
9108
+ <xsl:value-of select="."/>
9109
+ </xsl:template>
9110
+
9111
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
9112
+ <xsl:value-of select="normalize-space(.)"/>
9113
+ </xsl:template>
9114
+
9115
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
9116
+ <!-- ============================ -->
9117
+ <!-- END: mode="bookmark_clean" -->
9118
+ <!-- ============================ -->
9119
+
9015
9120
  <xsl:template name="getLangVersion">
9016
9121
  <xsl:param name="lang"/>
9017
9122
  <xsl:param name="doctype" select="''"/>
@@ -9059,6 +9164,7 @@
9059
9164
  <xsl:template match="title" mode="bookmark"/>
9060
9165
  <xsl:template match="text()" mode="bookmark"/>
9061
9166
 
9167
+ <!-- figure/name -->
9062
9168
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']">
9063
9169
  <xsl:if test="normalize-space() != ''">
9064
9170
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -9778,6 +9884,7 @@
9778
9884
  <!-- permission -->
9779
9885
  <!-- ========== -->
9780
9886
  <xsl:template match="*[local-name() = 'permission']">
9887
+ <xsl:call-template name="setNamedDestination"/>
9781
9888
  <fo:block id="{@id}" xsl:use-attribute-sets="permission-style">
9782
9889
  <xsl:apply-templates select="*[local-name()='name']"/>
9783
9890
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -9786,12 +9893,14 @@
9786
9893
 
9787
9894
  <xsl:template match="*[local-name() = 'permission']/*[local-name() = 'name']">
9788
9895
  <xsl:if test="normalize-space() != ''">
9789
- <fo:block xsl:use-attribute-sets="permission-name-style">
9790
- <xsl:apply-templates/>
9791
9896
 
9792
- <xsl:text>:</xsl:text>
9897
+ <fo:block xsl:use-attribute-sets="permission-name-style">
9898
+ <xsl:apply-templates/>
9899
+
9900
+ <xsl:text>:</xsl:text>
9901
+
9902
+ </fo:block>
9793
9903
 
9794
- </fo:block>
9795
9904
  </xsl:if>
9796
9905
  </xsl:template>
9797
9906
 
@@ -9807,6 +9916,7 @@
9807
9916
  <!-- requirement -->
9808
9917
  <!-- ========== -->
9809
9918
  <xsl:template match="*[local-name() = 'requirement']">
9919
+ <xsl:call-template name="setNamedDestination"/>
9810
9920
  <fo:block id="{@id}" xsl:use-attribute-sets="requirement-style">
9811
9921
  <xsl:apply-templates select="*[local-name()='name']"/>
9812
9922
  <xsl:apply-templates select="*[local-name()='label']"/>
@@ -9818,17 +9928,19 @@
9818
9928
 
9819
9929
  <xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'name']">
9820
9930
  <xsl:if test="normalize-space() != ''">
9821
- <fo:block xsl:use-attribute-sets="requirement-name-style">
9822
9931
 
9823
- <xsl:if test="../@type = 'class'">
9824
- <xsl:attribute name="background-color">white</xsl:attribute>
9825
- </xsl:if>
9932
+ <fo:block xsl:use-attribute-sets="requirement-name-style">
9826
9933
 
9827
- <xsl:apply-templates/>
9934
+ <xsl:if test="../@type = 'class'">
9935
+ <xsl:attribute name="background-color">white</xsl:attribute>
9936
+ </xsl:if>
9828
9937
 
9829
- <xsl:text>:</xsl:text>
9938
+ <xsl:apply-templates/>
9939
+
9940
+ <xsl:text>:</xsl:text>
9941
+
9942
+ </fo:block>
9830
9943
 
9831
- </fo:block>
9832
9944
  </xsl:if>
9833
9945
  </xsl:template>
9834
9946
 
@@ -9857,6 +9969,7 @@
9857
9969
  <!-- recommendation -->
9858
9970
  <!-- ========== -->
9859
9971
  <xsl:template match="*[local-name() = 'recommendation']">
9972
+ <xsl:call-template name="setNamedDestination"/>
9860
9973
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
9861
9974
  <xsl:apply-templates select="*[local-name()='name']"/>
9862
9975
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -9865,10 +9978,12 @@
9865
9978
 
9866
9979
  <xsl:template match="*[local-name() = 'recommendation']/*[local-name() = 'name']">
9867
9980
  <xsl:if test="normalize-space() != ''">
9868
- <fo:block xsl:use-attribute-sets="recommendation-name-style">
9869
- <xsl:apply-templates/>
9870
9981
 
9871
- </fo:block>
9982
+ <fo:block xsl:use-attribute-sets="recommendation-name-style">
9983
+ <xsl:apply-templates/>
9984
+
9985
+ </fo:block>
9986
+
9872
9987
  </xsl:if>
9873
9988
  </xsl:template>
9874
9989
 
@@ -9947,6 +10062,7 @@
9947
10062
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
9948
10063
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
9949
10064
  </xsl:if>
10065
+ <xsl:call-template name="setNamedDestination"/>
9950
10066
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
9951
10067
  <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
9952
10068
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -10070,6 +10186,7 @@
10070
10186
  <!-- termexample -->
10071
10187
  <!-- ====== -->
10072
10188
  <xsl:template match="*[local-name() = 'termexample']">
10189
+ <xsl:call-template name="setNamedDestination"/>
10073
10190
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10074
10191
  <xsl:call-template name="refine_termexample-style"/>
10075
10192
  <xsl:call-template name="setBlockSpanAll"/>
@@ -10124,6 +10241,7 @@
10124
10241
  -->
10125
10242
  <xsl:template match="*[local-name() = 'example']" name="example">
10126
10243
 
10244
+ <xsl:call-template name="setNamedDestination"/>
10127
10245
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10128
10246
 
10129
10247
  <xsl:call-template name="setBlockSpanAll"/>
@@ -10653,8 +10771,13 @@
10653
10771
  <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
10654
10772
 
10655
10773
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
10774
+
10656
10775
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
10657
10776
 
10777
+ <xsl:for-each select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"><!-- change context -->
10778
+ <xsl:call-template name="setIDforNamedDestination"/>
10779
+ </xsl:for-each>
10780
+
10658
10781
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
10659
10782
  </fo:block>
10660
10783
  </xsl:if>
@@ -10774,6 +10897,7 @@
10774
10897
  <!-- main sections -->
10775
10898
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
10776
10899
 
10900
+ <xsl:call-template name="setNamedDestination"/>
10777
10901
  <fo:block>
10778
10902
  <xsl:call-template name="setId"/>
10779
10903
 
@@ -10819,6 +10943,7 @@
10819
10943
 
10820
10944
  <fo:block break-after="page"/>
10821
10945
 
10946
+ <xsl:call-template name="setNamedDestination"/>
10822
10947
  <fo:block>
10823
10948
  <xsl:call-template name="setId"/>
10824
10949
  <xsl:call-template name="addReviewHelper"/>
@@ -10847,6 +10972,7 @@
10847
10972
  </xsl:template>
10848
10973
 
10849
10974
  <xsl:template match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
10975
+ <xsl:call-template name="setNamedDestination"/>
10850
10976
  <fo:block>
10851
10977
  <xsl:if test="parent::*[local-name() = 'copyright-statement']">
10852
10978
  <xsl:attribute name="role">SKIP</xsl:attribute>
@@ -10869,6 +10995,7 @@
10869
10995
  </xsl:template> <!-- refine_clause_style -->
10870
10996
 
10871
10997
  <xsl:template match="*[local-name() = 'definitions']">
10998
+ <xsl:call-template name="setNamedDestination"/>
10872
10999
  <fo:block id="{@id}">
10873
11000
  <xsl:apply-templates/>
10874
11001
  </fo:block>
@@ -10884,6 +11011,8 @@
10884
11011
  <xsl:otherwise>
10885
11012
 
10886
11013
  <fo:block break-after="page"/>
11014
+ <xsl:call-template name="setNamedDestination"/>
11015
+
10887
11016
  <fo:block id="{@id}">
10888
11017
 
10889
11018
  <xsl:call-template name="setBlockSpanAll"/>
@@ -10955,6 +11084,7 @@
10955
11084
  <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
10956
11085
  following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
10957
11086
  <!-- <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> -->
11087
+ <xsl:call-template name="setNamedDestination"/>
10958
11088
  <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>
10959
11089
  <!-- </xsl:if> -->
10960
11090
  </xsl:if>
@@ -11054,9 +11184,15 @@
11054
11184
  <xsl:when test="local-name(..) = 'ul'">
11055
11185
  <xsl:choose>
11056
11186
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
11187
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
11188
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
11057
11189
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
11058
11190
  </xsl:choose>
11059
11191
  </xsl:when>
11192
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
11193
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
11194
+ <xsl:value-of select="@label"/>
11195
+ </xsl:when>
11060
11196
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11061
11197
 
11062
11198
  <xsl:variable name="type" select="../@type"/>
@@ -11181,7 +11317,7 @@
11181
11317
 
11182
11318
  </xsl:otherwise>
11183
11319
  </xsl:choose>
11184
- </xsl:template>
11320
+ </xsl:template> <!-- getListItemFormat -->
11185
11321
 
11186
11322
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
11187
11323
  <xsl:param name="indent">0</xsl:param>
@@ -11313,6 +11449,11 @@
11313
11449
 
11314
11450
  <xsl:call-template name="refine_list-item-label-style"/>
11315
11451
 
11452
+ <xsl:if test="local-name(..) = 'ul'">
11453
+ <xsl:variable name="li_label" select="@label"/>
11454
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
11455
+ </xsl:if>
11456
+
11316
11457
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
11317
11458
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
11318
11459
  <xsl:call-template name="append_add-style"/>
@@ -11659,6 +11800,7 @@
11659
11800
  <!-- Normative references -->
11660
11801
  <xsl:template match="*[local-name() = 'references'][@normative='true']" priority="2">
11661
11802
 
11803
+ <xsl:call-template name="setNamedDestination"/>
11662
11804
  <fo:block id="{@id}">
11663
11805
  <xsl:apply-templates/>
11664
11806
 
@@ -11679,6 +11821,7 @@
11679
11821
  </xsl:if>
11680
11822
  </xsl:if> -->
11681
11823
 
11824
+ <xsl:call-template name="setNamedDestination"/>
11682
11825
  <fo:block id="{@id}"/>
11683
11826
 
11684
11827
  <xsl:apply-templates select="*[local-name() = 'title'][@columns = 1]"/>
@@ -11698,6 +11841,7 @@
11698
11841
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
11699
11842
  <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
11700
11843
 
11844
+ <xsl:call-template name="setNamedDestination"/>
11701
11845
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
11702
11846
 
11703
11847
  <xsl:call-template name="processBibitem"/>
@@ -11711,6 +11855,7 @@
11711
11855
  <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
11712
11856
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
11713
11857
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
11858
+ <xsl:call-template name="setNamedDestination"/>
11714
11859
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
11715
11860
 
11716
11861
  <fo:list-item>
@@ -11740,6 +11885,7 @@
11740
11885
  <xsl:choose>
11741
11886
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
11742
11887
  <xsl:otherwise>
11888
+ <xsl:call-template name="setNamedDestination"/>
11743
11889
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11744
11890
 
11745
11891
  <fo:list-item-label end-indent="label-end()">
@@ -12134,6 +12280,7 @@
12134
12280
  <xsl:template match="*[local-name() = 'admonition']">
12135
12281
 
12136
12282
  <!-- text in the box -->
12283
+ <xsl:call-template name="setNamedDestination"/>
12137
12284
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
12138
12285
 
12139
12286
  <xsl:call-template name="setBlockSpanAll"/>
@@ -12396,7 +12543,7 @@
12396
12543
  </xsl:template>
12397
12544
 
12398
12545
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12399
- <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">
12546
+ <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">
12400
12547
  <xsl:copy>
12401
12548
  <xsl:copy-of select="@*"/>
12402
12549
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12428,28 +12575,56 @@
12428
12575
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_step1"/>
12429
12576
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_pres"/>
12430
12577
 
12431
- <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_step1">
12578
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="update_xml_step1">
12432
12579
  <xsl:element name="stem" namespace="{$namespace_full}">
12433
12580
  <xsl:copy-of select="@*"/>
12434
12581
  <xsl:choose>
12435
12582
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
12436
- <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
12583
+ <xsl:choose>
12584
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
12585
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
12586
+ </xsl:when>
12587
+ <xsl:otherwise>
12588
+ <xsl:apply-templates select="*[local-name() = 'semx']/node()" mode="update_xml_step1"/>
12589
+ </xsl:otherwise>
12590
+ </xsl:choose>
12437
12591
  </xsl:when>
12438
12592
  <xsl:otherwise>
12439
- <xsl:copy-of select="node()"/>
12593
+ <xsl:choose>
12594
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
12595
+ <xsl:copy-of select="node()"/>
12596
+ </xsl:when>
12597
+ <xsl:otherwise>
12598
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
12599
+ </xsl:otherwise>
12600
+ </xsl:choose>
12440
12601
  </xsl:otherwise>
12441
12602
  </xsl:choose>
12442
12603
  </xsl:element>
12443
12604
  </xsl:template>
12444
- <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_pres">
12605
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="update_xml_pres">
12445
12606
  <xsl:element name="stem" namespace="{$namespace_full}">
12446
12607
  <xsl:copy-of select="@*"/>
12447
12608
  <xsl:choose>
12448
12609
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
12449
- <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
12610
+ <xsl:choose>
12611
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
12612
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
12613
+ </xsl:when>
12614
+ <xsl:otherwise>
12615
+ <xsl:apply-templates select="*[local-name() = 'semx']/node()" mode="update_xml_pres"/>
12616
+ </xsl:otherwise>
12617
+ </xsl:choose>
12450
12618
  </xsl:when>
12451
12619
  <xsl:otherwise>
12452
- <xsl:copy-of select="node()"/>
12620
+ <xsl:choose>
12621
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
12622
+ <xsl:copy-of select="node()"/>
12623
+ </xsl:when>
12624
+ <xsl:otherwise>
12625
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
12626
+ </xsl:otherwise>
12627
+ </xsl:choose>
12453
12628
  </xsl:otherwise>
12454
12629
  </xsl:choose>
12455
12630
  </xsl:element>
@@ -12678,16 +12853,24 @@
12678
12853
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
12679
12854
  <xsl:element name="title" namespace="{$namespace_full}">
12680
12855
  <xsl:copy-of select="@*"/>
12856
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12857
+
12681
12858
  <xsl:apply-templates mode="update_xml_step1"/>
12682
12859
  </xsl:element>
12683
12860
  </xsl:template>
12684
12861
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
12685
12862
  <xsl:element name="title" namespace="{$namespace_full}">
12686
12863
  <xsl:copy-of select="@*"/>
12864
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12865
+
12687
12866
  <xsl:apply-templates mode="update_xml_pres"/>
12688
12867
  </xsl:element>
12689
12868
  </xsl:template>
12690
12869
 
12870
+ <xsl:template name="addNamedDestinationAttribute">
12871
+
12872
+ </xsl:template>
12873
+
12691
12874
  <xsl:template match="*[local-name() = 'fmt-name']"/>
12692
12875
  <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
12693
12876
  <xsl:choose>
@@ -12697,6 +12880,8 @@
12697
12880
  <xsl:otherwise>
12698
12881
  <xsl:element name="name" namespace="{$namespace_full}">
12699
12882
  <xsl:copy-of select="@*"/>
12883
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12884
+
12700
12885
  <xsl:apply-templates mode="update_xml_step1"/>
12701
12886
  </xsl:element>
12702
12887
  </xsl:otherwise>
@@ -12710,12 +12895,24 @@
12710
12895
  <xsl:otherwise>
12711
12896
  <xsl:element name="name" namespace="{$namespace_full}">
12712
12897
  <xsl:copy-of select="@*"/>
12898
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12899
+
12713
12900
  <xsl:apply-templates mode="update_xml_pres"/>
12714
12901
  </xsl:element>
12715
12902
  </xsl:otherwise>
12716
12903
  </xsl:choose>
12717
12904
  </xsl:template>
12718
12905
 
12906
+ <!-- li/fmt-name -->
12907
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
12908
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
12909
+ <xsl:attribute name="full">true</xsl:attribute>
12910
+ </xsl:template>
12911
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
12912
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
12913
+ <xsl:attribute name="full">true</xsl:attribute>
12914
+ </xsl:template>
12915
+
12719
12916
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
12720
12917
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
12721
12918
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13530,6 +13727,64 @@
13530
13727
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
13531
13728
  </xsl:template>
13532
13729
 
13730
+ <!-- ===================================== -->
13731
+ <!-- ===================================== -->
13732
+ <!-- Ruby text (CJK languages) rendering -->
13733
+ <!-- ===================================== -->
13734
+ <!-- ===================================== -->
13735
+ <xsl:template match="*[local-name() = 'ruby']">
13736
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
13737
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
13738
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
13739
+ </xsl:if>
13740
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
13741
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
13742
+ <!-- Example: width="2em" -->
13743
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
13744
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
13745
+ <xsl:variable name="text_width">
13746
+ <xsl:choose>
13747
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
13748
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
13749
+ </xsl:choose>
13750
+ </xsl:variable>
13751
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
13752
+
13753
+ <xsl:choose>
13754
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
13755
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
13756
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
13757
+ </xsl:when>
13758
+ <xsl:otherwise>
13759
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
13760
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
13761
+ </xsl:otherwise>
13762
+ </xsl:choose>
13763
+
13764
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
13765
+ </fo:inline-container>
13766
+ </xsl:template>
13767
+
13768
+ <xsl:template match="*[local-name() = 'rb']">
13769
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
13770
+ </xsl:template>
13771
+
13772
+ <xsl:template match="*[local-name() = 'rt']">
13773
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
13774
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
13775
+ <xsl:attribute name="space-before">0em</xsl:attribute>
13776
+ </xsl:if>
13777
+ <xsl:apply-templates/>
13778
+ </fo:block>
13779
+
13780
+ </xsl:template>
13781
+
13782
+ <!-- ===================================== -->
13783
+ <!-- ===================================== -->
13784
+ <!-- END: Ruby text (CJK languages) rendering -->
13785
+ <!-- ===================================== -->
13786
+ <!-- ===================================== -->
13787
+
13533
13788
  <xsl:template name="printEdition">
13534
13789
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
13535
13790
 
@@ -14099,6 +14354,24 @@
14099
14354
  </xsl:attribute>
14100
14355
  </xsl:template>
14101
14356
 
14357
+ <xsl:template name="setIDforNamedDestination">
14358
+ <xsl:if test="@named_dest">
14359
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
14360
+ </xsl:if>
14361
+ </xsl:template>
14362
+
14363
+ <xsl:template name="setNamedDestination">
14364
+ <!-- skip GUID, e.g. _33eac3cb-9663-4291-ae26-1d4b6f4635fc -->
14365
+ <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'">
14366
+ <fox:destination internal-destination="{@id}"/>
14367
+ </xsl:if>
14368
+ <xsl:for-each select=". | *[local-name() = 'title'] | *[local-name() = 'name']">
14369
+ <xsl:if test="@named_dest">
14370
+ <fox:destination internal-destination="{@named_dest}"/>
14371
+ </xsl:if>
14372
+ </xsl:for-each>
14373
+ </xsl:template>
14374
+
14102
14375
  <xsl:template name="add-letter-spacing">
14103
14376
  <xsl:param name="text"/>
14104
14377
  <xsl:param name="letter-spacing" select="'0.15'"/>