metanorma-ogc 2.7.4 → 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.
@@ -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
 
@@ -3195,8 +3198,14 @@
3195
3198
  </xsl:choose>
3196
3199
  </xsl:variable>
3197
3200
 
3201
+ <xsl:call-template name="setNamedDestination"/>
3202
+
3198
3203
  <fo:block-container xsl:use-attribute-sets="table-container-style" role="SKIP">
3199
3204
 
3205
+ <xsl:for-each select="*[local-name() = 'name']">
3206
+ <xsl:call-template name="setIDforNamedDestination"/>
3207
+ </xsl:for-each>
3208
+
3200
3209
  <xsl:call-template name="refine_table-container-style">
3201
3210
  <xsl:with-param name="margin-side" select="$margin-side"/>
3202
3211
  </xsl:call-template>
@@ -3405,6 +3414,7 @@
3405
3414
  <!-- table/name-->
3406
3415
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3407
3416
  <xsl:param name="continued"/>
3417
+ <xsl:param name="cols-count"/>
3408
3418
  <xsl:if test="normalize-space() != ''">
3409
3419
 
3410
3420
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -3426,9 +3436,30 @@
3426
3436
 
3427
3437
  <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3428
3438
  <xsl:if test="$continued = 'true'">
3429
- <fo:block text-align="right">
3430
- <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3431
- </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
+
3432
3463
  </xsl:if>
3433
3464
  <!-- </xsl:if> -->
3434
3465
 
@@ -3821,6 +3852,7 @@
3821
3852
 
3822
3853
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3823
3854
  <xsl:with-param name="continued">true</xsl:with-param>
3855
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3824
3856
  </xsl:apply-templates>
3825
3857
 
3826
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 -->
@@ -4202,8 +4234,8 @@
4202
4234
  <xsl:for-each select="xalan:nodeset($styles__)/item">
4203
4235
  <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
4204
4236
  <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
4205
- <xsl:if test="$key = 'color' or $key = 'background-color'">
4206
- <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>
4207
4239
  </xsl:if>
4208
4240
  </xsl:for-each>
4209
4241
  </xsl:variable>
@@ -4267,6 +4299,7 @@
4267
4299
  <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4268
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">
4269
4301
 
4302
+ <xsl:call-template name="setNamedDestination"/>
4270
4303
  <fo:block xsl:use-attribute-sets="table-note-style">
4271
4304
  <xsl:copy-of select="@id"/>
4272
4305
 
@@ -4792,7 +4825,7 @@
4792
4825
  <xsl:variable name="target" select="@target"/>
4793
4826
  <xsl:choose>
4794
4827
  <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
4795
- <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]">
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]">
4796
4829
  <xsl:call-template name="fn">
4797
4830
  <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
4798
4831
  </xsl:call-template>
@@ -4888,6 +4921,10 @@
4888
4921
  <!-- <dl><xsl:copy-of select="."/></dl> -->
4889
4922
  <fo:block-container xsl:use-attribute-sets="dl-block-style" role="SKIP">
4890
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
+
4891
4928
  <xsl:call-template name="setBlockSpanAll"/>
4892
4929
 
4893
4930
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -5181,7 +5218,7 @@
5181
5218
 
5182
5219
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
5183
5220
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
5184
- <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">
5185
5222
  <xsl:call-template name="refine_figure_key_style"/>
5186
5223
  <xsl:apply-templates/>
5187
5224
  </fo:block>
@@ -5432,6 +5469,7 @@
5432
5469
 
5433
5470
  <xsl:call-template name="refine_dt-cell-style"/>
5434
5471
 
5472
+ <xsl:call-template name="setNamedDestination"/>
5435
5473
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
5436
5474
 
5437
5475
  <xsl:choose>
@@ -5871,7 +5909,7 @@
5871
5909
  <!-- ================= -->
5872
5910
 
5873
5911
  <!-- highlight text -->
5874
- <xsl:template match="*[local-name()='hi']">
5912
+ <xsl:template match="*[local-name()='hi'] | *[local-name() = 'span'][@class = 'fmt-hi']" priority="3">
5875
5913
  <fo:inline background-color="yellow">
5876
5914
  <xsl:apply-templates/>
5877
5915
  </fo:inline>
@@ -7466,6 +7504,7 @@
7466
7504
  <!-- Appendix processing -->
7467
7505
  <!-- ======================== -->
7468
7506
  <xsl:template match="*[local-name()='appendix']">
7507
+ <xsl:call-template name="setNamedDestination"/>
7469
7508
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
7470
7509
  <xsl:apply-templates select="*[local-name()='title']"/>
7471
7510
  </fo:block>
@@ -7476,13 +7515,14 @@
7476
7515
  <xsl:variable name="level">
7477
7516
  <xsl:call-template name="getLevel"/>
7478
7517
  </xsl:variable>
7479
- <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>
7480
7519
  </xsl:template>
7481
7520
  <!-- ======================== -->
7482
7521
  <!-- END Appendix processing -->
7483
7522
  <!-- ======================== -->
7484
7523
 
7485
7524
  <xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
7525
+ <xsl:call-template name="setNamedDestination"/>
7486
7526
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
7487
7527
  <xsl:apply-templates select="*[local-name()='name']"/>
7488
7528
  </fo:block>
@@ -7512,6 +7552,7 @@
7512
7552
  <xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
7513
7553
  <xsl:param name="callout"/>
7514
7554
  <fo:inline id="{@id}">
7555
+ <xsl:call-template name="setNamedDestination"/>
7515
7556
  <!-- for first p in annotation, put <x> -->
7516
7557
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
7517
7558
  <xsl:apply-templates/>
@@ -7558,6 +7599,7 @@
7558
7599
 
7559
7600
  </xsl:if>
7560
7601
  <fo:block-container margin-left="0mm" role="SKIP">
7602
+ <xsl:call-template name="setNamedDestination"/>
7561
7603
  <fo:block id="{@id}">
7562
7604
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
7563
7605
  </fo:block>
@@ -7603,8 +7645,13 @@
7603
7645
  </fo:block>
7604
7646
  </fo:table-cell>
7605
7647
  <fo:table-cell display-align="center">
7648
+
7606
7649
  <fo:block xsl:use-attribute-sets="formula-stem-number-style" role="SKIP">
7607
7650
 
7651
+ <xsl:for-each select="../*[local-name() = 'name']">
7652
+ <xsl:call-template name="setIDforNamedDestination"/>
7653
+ </xsl:for-each>
7654
+
7608
7655
  <xsl:call-template name="refine_formula-stem-number-style"/>
7609
7656
 
7610
7657
  <xsl:apply-templates select="../*[local-name() = 'name']"/>
@@ -7639,6 +7686,8 @@
7639
7686
 
7640
7687
  <xsl:template match="*[local-name() = 'note']" name="note">
7641
7688
 
7689
+ <xsl:call-template name="setNamedDestination"/>
7690
+
7642
7691
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
7643
7692
 
7644
7693
  <xsl:call-template name="setBlockSpanAll"/>
@@ -7703,6 +7752,7 @@
7703
7752
  </xsl:template>
7704
7753
 
7705
7754
  <xsl:template match="*[local-name() = 'termnote']">
7755
+ <xsl:call-template name="setNamedDestination"/>
7706
7756
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
7707
7757
 
7708
7758
  <xsl:call-template name="setBlockSpanAll"/>
@@ -7809,12 +7859,14 @@
7809
7859
 
7810
7860
  <xsl:template match="*[local-name() = 'terms']">
7811
7861
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
7862
+ <xsl:call-template name="setNamedDestination"/>
7812
7863
  <fo:block id="{@id}">
7813
7864
  <xsl:apply-templates/>
7814
7865
  </fo:block>
7815
7866
  </xsl:template>
7816
7867
 
7817
7868
  <xsl:template match="*[local-name() = 'term']">
7869
+ <xsl:call-template name="setNamedDestination"/>
7818
7870
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
7819
7871
 
7820
7872
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
@@ -7846,6 +7898,7 @@
7846
7898
  <xsl:template match="*[local-name() = 'figure']" name="figure">
7847
7899
  <xsl:variable name="isAdded" select="@added"/>
7848
7900
  <xsl:variable name="isDeleted" select="@deleted"/>
7901
+ <xsl:call-template name="setNamedDestination"/>
7849
7902
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
7850
7903
  <xsl:call-template name="refine_figure-block-style"/>
7851
7904
 
@@ -7862,6 +7915,11 @@
7862
7915
  </xsl:variable>
7863
7916
 
7864
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
+
7865
7923
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
7866
7924
  </fo:block>
7867
7925
 
@@ -7894,6 +7952,7 @@
7894
7952
  </xsl:template>
7895
7953
 
7896
7954
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
7955
+ <xsl:call-template name="setNamedDestination"/>
7897
7956
  <fo:block id="{@id}">
7898
7957
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7899
7958
  </fo:block>
@@ -7907,6 +7966,7 @@
7907
7966
  </xsl:template>
7908
7967
 
7909
7968
  <!-- SOURCE: ... -->
7969
+ <!-- figure/source -->
7910
7970
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7911
7971
 
7912
7972
  <xsl:call-template name="termsource"/>
@@ -9104,6 +9164,7 @@
9104
9164
  <xsl:template match="title" mode="bookmark"/>
9105
9165
  <xsl:template match="text()" mode="bookmark"/>
9106
9166
 
9167
+ <!-- figure/name -->
9107
9168
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']">
9108
9169
  <xsl:if test="normalize-space() != ''">
9109
9170
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -9823,6 +9884,7 @@
9823
9884
  <!-- permission -->
9824
9885
  <!-- ========== -->
9825
9886
  <xsl:template match="*[local-name() = 'permission']">
9887
+ <xsl:call-template name="setNamedDestination"/>
9826
9888
  <fo:block id="{@id}" xsl:use-attribute-sets="permission-style">
9827
9889
  <xsl:apply-templates select="*[local-name()='name']"/>
9828
9890
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -9831,12 +9893,14 @@
9831
9893
 
9832
9894
  <xsl:template match="*[local-name() = 'permission']/*[local-name() = 'name']">
9833
9895
  <xsl:if test="normalize-space() != ''">
9834
- <fo:block xsl:use-attribute-sets="permission-name-style">
9835
- <xsl:apply-templates/>
9836
9896
 
9837
- <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>
9838
9903
 
9839
- </fo:block>
9840
9904
  </xsl:if>
9841
9905
  </xsl:template>
9842
9906
 
@@ -9852,6 +9916,7 @@
9852
9916
  <!-- requirement -->
9853
9917
  <!-- ========== -->
9854
9918
  <xsl:template match="*[local-name() = 'requirement']">
9919
+ <xsl:call-template name="setNamedDestination"/>
9855
9920
  <fo:block id="{@id}" xsl:use-attribute-sets="requirement-style">
9856
9921
  <xsl:apply-templates select="*[local-name()='name']"/>
9857
9922
  <xsl:apply-templates select="*[local-name()='label']"/>
@@ -9863,17 +9928,19 @@
9863
9928
 
9864
9929
  <xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'name']">
9865
9930
  <xsl:if test="normalize-space() != ''">
9866
- <fo:block xsl:use-attribute-sets="requirement-name-style">
9867
9931
 
9868
- <xsl:if test="../@type = 'class'">
9869
- <xsl:attribute name="background-color">white</xsl:attribute>
9870
- </xsl:if>
9932
+ <fo:block xsl:use-attribute-sets="requirement-name-style">
9871
9933
 
9872
- <xsl:apply-templates/>
9934
+ <xsl:if test="../@type = 'class'">
9935
+ <xsl:attribute name="background-color">white</xsl:attribute>
9936
+ </xsl:if>
9937
+
9938
+ <xsl:apply-templates/>
9873
9939
 
9874
- <xsl:text>:</xsl:text>
9940
+ <xsl:text>:</xsl:text>
9941
+
9942
+ </fo:block>
9875
9943
 
9876
- </fo:block>
9877
9944
  </xsl:if>
9878
9945
  </xsl:template>
9879
9946
 
@@ -9902,6 +9969,7 @@
9902
9969
  <!-- recommendation -->
9903
9970
  <!-- ========== -->
9904
9971
  <xsl:template match="*[local-name() = 'recommendation']">
9972
+ <xsl:call-template name="setNamedDestination"/>
9905
9973
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
9906
9974
  <xsl:apply-templates select="*[local-name()='name']"/>
9907
9975
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -9910,10 +9978,12 @@
9910
9978
 
9911
9979
  <xsl:template match="*[local-name() = 'recommendation']/*[local-name() = 'name']">
9912
9980
  <xsl:if test="normalize-space() != ''">
9913
- <fo:block xsl:use-attribute-sets="recommendation-name-style">
9914
- <xsl:apply-templates/>
9915
9981
 
9916
- </fo:block>
9982
+ <fo:block xsl:use-attribute-sets="recommendation-name-style">
9983
+ <xsl:apply-templates/>
9984
+
9985
+ </fo:block>
9986
+
9917
9987
  </xsl:if>
9918
9988
  </xsl:template>
9919
9989
 
@@ -9992,6 +10062,7 @@
9992
10062
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
9993
10063
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
9994
10064
  </xsl:if>
10065
+ <xsl:call-template name="setNamedDestination"/>
9995
10066
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
9996
10067
  <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
9997
10068
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -10115,6 +10186,7 @@
10115
10186
  <!-- termexample -->
10116
10187
  <!-- ====== -->
10117
10188
  <xsl:template match="*[local-name() = 'termexample']">
10189
+ <xsl:call-template name="setNamedDestination"/>
10118
10190
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10119
10191
  <xsl:call-template name="refine_termexample-style"/>
10120
10192
  <xsl:call-template name="setBlockSpanAll"/>
@@ -10169,6 +10241,7 @@
10169
10241
  -->
10170
10242
  <xsl:template match="*[local-name() = 'example']" name="example">
10171
10243
 
10244
+ <xsl:call-template name="setNamedDestination"/>
10172
10245
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10173
10246
 
10174
10247
  <xsl:call-template name="setBlockSpanAll"/>
@@ -10698,8 +10771,13 @@
10698
10771
  <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
10699
10772
 
10700
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
+
10701
10775
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
10702
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
+
10703
10781
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
10704
10782
  </fo:block>
10705
10783
  </xsl:if>
@@ -10819,6 +10897,7 @@
10819
10897
  <!-- main sections -->
10820
10898
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
10821
10899
 
10900
+ <xsl:call-template name="setNamedDestination"/>
10822
10901
  <fo:block>
10823
10902
  <xsl:call-template name="setId"/>
10824
10903
 
@@ -10864,6 +10943,7 @@
10864
10943
 
10865
10944
  <fo:block break-after="page"/>
10866
10945
 
10946
+ <xsl:call-template name="setNamedDestination"/>
10867
10947
  <fo:block>
10868
10948
  <xsl:call-template name="setId"/>
10869
10949
  <xsl:call-template name="addReviewHelper"/>
@@ -10892,6 +10972,7 @@
10892
10972
  </xsl:template>
10893
10973
 
10894
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"/>
10895
10976
  <fo:block>
10896
10977
  <xsl:if test="parent::*[local-name() = 'copyright-statement']">
10897
10978
  <xsl:attribute name="role">SKIP</xsl:attribute>
@@ -10914,6 +10995,7 @@
10914
10995
  </xsl:template> <!-- refine_clause_style -->
10915
10996
 
10916
10997
  <xsl:template match="*[local-name() = 'definitions']">
10998
+ <xsl:call-template name="setNamedDestination"/>
10917
10999
  <fo:block id="{@id}">
10918
11000
  <xsl:apply-templates/>
10919
11001
  </fo:block>
@@ -10929,6 +11011,8 @@
10929
11011
  <xsl:otherwise>
10930
11012
 
10931
11013
  <fo:block break-after="page"/>
11014
+ <xsl:call-template name="setNamedDestination"/>
11015
+
10932
11016
  <fo:block id="{@id}">
10933
11017
 
10934
11018
  <xsl:call-template name="setBlockSpanAll"/>
@@ -11000,6 +11084,7 @@
11000
11084
  <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
11001
11085
  following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
11002
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"/>
11003
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>
11004
11089
  <!-- </xsl:if> -->
11005
11090
  </xsl:if>
@@ -11715,6 +11800,7 @@
11715
11800
  <!-- Normative references -->
11716
11801
  <xsl:template match="*[local-name() = 'references'][@normative='true']" priority="2">
11717
11802
 
11803
+ <xsl:call-template name="setNamedDestination"/>
11718
11804
  <fo:block id="{@id}">
11719
11805
  <xsl:apply-templates/>
11720
11806
 
@@ -11735,6 +11821,7 @@
11735
11821
  </xsl:if>
11736
11822
  </xsl:if> -->
11737
11823
 
11824
+ <xsl:call-template name="setNamedDestination"/>
11738
11825
  <fo:block id="{@id}"/>
11739
11826
 
11740
11827
  <xsl:apply-templates select="*[local-name() = 'title'][@columns = 1]"/>
@@ -11754,6 +11841,7 @@
11754
11841
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
11755
11842
  <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
11756
11843
 
11844
+ <xsl:call-template name="setNamedDestination"/>
11757
11845
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
11758
11846
 
11759
11847
  <xsl:call-template name="processBibitem"/>
@@ -11767,6 +11855,7 @@
11767
11855
  <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
11768
11856
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
11769
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"/>
11770
11859
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
11771
11860
 
11772
11861
  <fo:list-item>
@@ -11796,6 +11885,7 @@
11796
11885
  <xsl:choose>
11797
11886
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
11798
11887
  <xsl:otherwise>
11888
+ <xsl:call-template name="setNamedDestination"/>
11799
11889
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11800
11890
 
11801
11891
  <fo:list-item-label end-indent="label-end()">
@@ -12190,6 +12280,7 @@
12190
12280
  <xsl:template match="*[local-name() = 'admonition']">
12191
12281
 
12192
12282
  <!-- text in the box -->
12283
+ <xsl:call-template name="setNamedDestination"/>
12193
12284
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
12194
12285
 
12195
12286
  <xsl:call-template name="setBlockSpanAll"/>
@@ -12452,7 +12543,7 @@
12452
12543
  </xsl:template>
12453
12544
 
12454
12545
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12455
- <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">
12456
12547
  <xsl:copy>
12457
12548
  <xsl:copy-of select="@*"/>
12458
12549
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12484,28 +12575,56 @@
12484
12575
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_step1"/>
12485
12576
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_pres"/>
12486
12577
 
12487
- <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">
12488
12579
  <xsl:element name="stem" namespace="{$namespace_full}">
12489
12580
  <xsl:copy-of select="@*"/>
12490
12581
  <xsl:choose>
12491
12582
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
12492
- <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>
12493
12591
  </xsl:when>
12494
12592
  <xsl:otherwise>
12495
- <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>
12496
12601
  </xsl:otherwise>
12497
12602
  </xsl:choose>
12498
12603
  </xsl:element>
12499
12604
  </xsl:template>
12500
- <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">
12501
12606
  <xsl:element name="stem" namespace="{$namespace_full}">
12502
12607
  <xsl:copy-of select="@*"/>
12503
12608
  <xsl:choose>
12504
12609
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
12505
- <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>
12506
12618
  </xsl:when>
12507
12619
  <xsl:otherwise>
12508
- <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>
12509
12628
  </xsl:otherwise>
12510
12629
  </xsl:choose>
12511
12630
  </xsl:element>
@@ -12734,16 +12853,24 @@
12734
12853
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
12735
12854
  <xsl:element name="title" namespace="{$namespace_full}">
12736
12855
  <xsl:copy-of select="@*"/>
12856
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12857
+
12737
12858
  <xsl:apply-templates mode="update_xml_step1"/>
12738
12859
  </xsl:element>
12739
12860
  </xsl:template>
12740
12861
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
12741
12862
  <xsl:element name="title" namespace="{$namespace_full}">
12742
12863
  <xsl:copy-of select="@*"/>
12864
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12865
+
12743
12866
  <xsl:apply-templates mode="update_xml_pres"/>
12744
12867
  </xsl:element>
12745
12868
  </xsl:template>
12746
12869
 
12870
+ <xsl:template name="addNamedDestinationAttribute">
12871
+
12872
+ </xsl:template>
12873
+
12747
12874
  <xsl:template match="*[local-name() = 'fmt-name']"/>
12748
12875
  <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
12749
12876
  <xsl:choose>
@@ -12753,6 +12880,8 @@
12753
12880
  <xsl:otherwise>
12754
12881
  <xsl:element name="name" namespace="{$namespace_full}">
12755
12882
  <xsl:copy-of select="@*"/>
12883
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12884
+
12756
12885
  <xsl:apply-templates mode="update_xml_step1"/>
12757
12886
  </xsl:element>
12758
12887
  </xsl:otherwise>
@@ -12766,6 +12895,8 @@
12766
12895
  <xsl:otherwise>
12767
12896
  <xsl:element name="name" namespace="{$namespace_full}">
12768
12897
  <xsl:copy-of select="@*"/>
12898
+ <xsl:call-template name="addNamedDestinationAttribute"/>
12899
+
12769
12900
  <xsl:apply-templates mode="update_xml_pres"/>
12770
12901
  </xsl:element>
12771
12902
  </xsl:otherwise>
@@ -14223,6 +14354,24 @@
14223
14354
  </xsl:attribute>
14224
14355
  </xsl:template>
14225
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
+
14226
14375
  <xsl:template name="add-letter-spacing">
14227
14376
  <xsl:param name="text"/>
14228
14377
  <xsl:param name="letter-spacing" select="'0.15'"/>