metanorma-ogc 2.3.6 → 2.3.8

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.
@@ -46,6 +46,8 @@
46
46
  <xsl:otherwise>rgb(246, 223, 140)</xsl:otherwise>
47
47
  </xsl:choose>
48
48
  </xsl:variable>
49
+ <xsl:variable name="color_dl_dt">rgb(215,243,255)</xsl:variable>
50
+ <xsl:variable name="color_dl_dd">rgb(242,251,255)</xsl:variable>
49
51
  <xsl:variable name="color_blue">rgb(33, 55, 92)</xsl:variable>
50
52
 
51
53
  <xsl:variable name="toc_recommendations_">
@@ -845,9 +847,8 @@
845
847
  </xsl:template>
846
848
 
847
849
  <!-- ====== -->
848
- <!-- title -->
850
+ <!-- title -->
849
851
  <!-- ====== -->
850
-
851
852
  <xsl:template match="ogc:title" name="title">
852
853
 
853
854
  <xsl:variable name="level">
@@ -957,9 +958,9 @@
957
958
  </xsl:element>
958
959
  </xsl:otherwise>
959
960
  </xsl:choose>
960
-
961
961
  </xsl:template>
962
962
  <!-- ====== -->
963
+ <!-- END: title -->
963
964
  <!-- ====== -->
964
965
 
965
966
  <xsl:template match="ogc:p" name="paragraph">
@@ -993,6 +994,9 @@
993
994
  </xsl:if>
994
995
  <xsl:if test="ancestor::ogc:dd and not(ancestor::ogc:table)">
995
996
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
997
+ <xsl:if test="not(ancestor::ogc:dd[1]/following-sibling::ogc:dt)">
998
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
999
+ </xsl:if>
996
1000
  </xsl:if>
997
1001
 
998
1002
  <xsl:apply-templates>
@@ -1076,7 +1080,7 @@
1076
1080
  <xsl:call-template name="getLevelTermName"/>
1077
1081
  </xsl:variable>
1078
1082
  <fo:block space-before="36pt" margin-bottom="10pt" keep-with-next="always" role="H{$levelTerm}">
1079
- <fo:list-block color="{$color_blue}" keep-with-next="always" provisional-distance-between-starts="{string-length()*3.2}mm">
1083
+ <fo:list-block color="{$color_blue}" keep-with-next="always" provisional-distance-between-starts="{string-length()*3.25}mm">
1080
1084
  <fo:list-item>
1081
1085
  <fo:list-item-label end-indent="label-end()">
1082
1086
  <fo:block><fo:inline font-size="18pt"><xsl:apply-templates/></fo:inline></fo:block> <!-- padding-right="1mm" -->
@@ -2180,6 +2184,13 @@
2180
2184
  <!-- ========================== -->
2181
2185
  <!-- Definition's list styles -->
2182
2186
  <!-- ========================== -->
2187
+
2188
+ <xsl:attribute-set name="dl-block-style">
2189
+
2190
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2191
+
2192
+ </xsl:attribute-set>
2193
+
2183
2194
  <xsl:attribute-set name="dt-row-style">
2184
2195
 
2185
2196
  <xsl:attribute name="min-height">8.5mm</xsl:attribute>
@@ -2187,6 +2198,11 @@
2187
2198
  </xsl:attribute-set>
2188
2199
 
2189
2200
  <xsl:attribute-set name="dt-cell-style">
2201
+
2202
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2203
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
2204
+ <xsl:attribute name="padding-left">1mm</xsl:attribute>
2205
+
2190
2206
  </xsl:attribute-set>
2191
2207
 
2192
2208
  <xsl:attribute-set name="dt-block-style">
@@ -2207,6 +2223,9 @@
2207
2223
 
2208
2224
  <xsl:attribute-set name="dd-cell-style">
2209
2225
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
2226
+
2227
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2228
+
2210
2229
  </xsl:attribute-set>
2211
2230
 
2212
2231
  <!-- ========================== -->
@@ -2327,6 +2346,7 @@
2327
2346
  <xsl:attribute-set name="term-name-style">
2328
2347
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2329
2348
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2349
+
2330
2350
  </xsl:attribute-set>
2331
2351
 
2332
2352
  <xsl:attribute-set name="figure-block-style">
@@ -2351,6 +2371,10 @@
2351
2371
 
2352
2372
  </xsl:attribute-set>
2353
2373
 
2374
+ <xsl:attribute-set name="figure-source-style">
2375
+
2376
+ </xsl:attribute-set>
2377
+
2354
2378
  <!-- Formula's styles -->
2355
2379
  <xsl:attribute-set name="formula-style">
2356
2380
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2903,7 +2927,7 @@
2903
2927
 
2904
2928
  <xsl:template name="processTables_Contents">
2905
2929
  <tables>
2906
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2930
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2907
2931
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2908
2932
  <xsl:copy-of select="*[local-name() = 'name']"/>
2909
2933
  </table>
@@ -3270,7 +3294,7 @@
3270
3294
  </xsl:attribute>
3271
3295
  </xsl:for-each>
3272
3296
 
3273
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3297
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3274
3298
  <xsl:if test="$isNoteOrFnExist = 'true'">
3275
3299
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3276
3300
  </xsl:if>
@@ -3314,7 +3338,7 @@
3314
3338
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3315
3339
  </xsl:when>
3316
3340
  <xsl:otherwise>
3317
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
3341
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3318
3342
  </xsl:otherwise>
3319
3343
  </xsl:choose>
3320
3344
 
@@ -3415,6 +3439,11 @@
3415
3439
  </xsl:if>
3416
3440
  </xsl:template> <!-- table/name -->
3417
3441
 
3442
+ <!-- SOURCE: ... -->
3443
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3444
+ <xsl:call-template name="termsource"/>
3445
+ </xsl:template>
3446
+
3418
3447
  <xsl:template name="calculate-columns-numbers">
3419
3448
  <xsl:param name="table-row"/>
3420
3449
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3771,7 +3800,7 @@
3771
3800
  </fo:table-header>
3772
3801
  </xsl:template> <!-- thead -->
3773
3802
 
3774
- <!-- template is using for iso, jcgm, bsi only -->
3803
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3775
3804
  <xsl:template name="table-header-title">
3776
3805
  <xsl:param name="cols-count"/>
3777
3806
  <!-- row for title -->
@@ -3814,7 +3843,7 @@
3814
3843
  <xsl:param name="colwidths"/>
3815
3844
  <xsl:param name="colgroup"/>
3816
3845
 
3817
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3846
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3818
3847
 
3819
3848
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3820
3849
 
@@ -3882,7 +3911,9 @@
3882
3911
 
3883
3912
  <!-- except gb and bsi -->
3884
3913
 
3914
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3885
3915
  <xsl:apply-templates select="../*[local-name()='note']"/>
3916
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3886
3917
 
3887
3918
  <xsl:variable name="isDisplayRowSeparator">
3888
3919
 
@@ -4007,7 +4038,7 @@
4007
4038
  <!-- ===================== -->
4008
4039
  <!-- Table's row processing -->
4009
4040
  <!-- ===================== -->
4010
- <!-- row in table header (thead) -->
4041
+ <!-- row in table header (thead) thead/tr -->
4011
4042
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4012
4043
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4013
4044
 
@@ -4041,7 +4072,7 @@
4041
4072
  </xsl:choose>
4042
4073
  </xsl:template>
4043
4074
 
4044
- <!-- row in table footer (tfoot) -->
4075
+ <!-- row in table footer (tfoot), tfoot/tr -->
4045
4076
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4046
4077
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
4047
4078
 
@@ -4540,12 +4571,26 @@
4540
4571
  <xsl:variable name="isAdded" select="@added"/>
4541
4572
  <xsl:variable name="isDeleted" select="@deleted"/>
4542
4573
  <!-- <dl><xsl:copy-of select="."/></dl> -->
4543
- <fo:block-container>
4574
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
4575
+
4576
+ <xsl:call-template name="setBlockSpanAll"/>
4544
4577
 
4545
4578
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
4546
4579
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4547
4580
  </xsl:if>
4548
4581
 
4582
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
4583
+ <!-- set font-size as sourcecode font-size -->
4584
+ <xsl:variable name="sourcecode_attributes">
4585
+ <xsl:call-template name="get_sourcecode_attributes"/>
4586
+ </xsl:variable>
4587
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
4588
+ <xsl:attribute name="{local-name()}">
4589
+ <xsl:value-of select="."/>
4590
+ </xsl:attribute>
4591
+ </xsl:for-each>
4592
+ </xsl:if>
4593
+
4549
4594
  <xsl:if test="parent::*[local-name() = 'note']">
4550
4595
  <xsl:attribute name="margin-left">
4551
4596
  <xsl:choose>
@@ -4979,6 +5024,11 @@
4979
5024
  <xsl:param name="split_keep-within-line"/>
4980
5025
 
4981
5026
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5027
+
5028
+ <xsl:if test="not(following-sibling::ogc:dt) or ancestor::ogc:sourcecode"> <!-- last item -->
5029
+ <xsl:attribute name="min-height">3mm</xsl:attribute>
5030
+ </xsl:if>
5031
+
4982
5032
  <xsl:call-template name="insert_dt_cell">
4983
5033
  <xsl:with-param name="key_iso" select="$key_iso"/>
4984
5034
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5000,8 +5050,17 @@
5000
5050
  <!-- border is mandatory, to calculate real width -->
5001
5051
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5002
5052
  <xsl:attribute name="text-align">left</xsl:attribute>
5053
+
5054
+ <xsl:attribute name="padding-left">6mm</xsl:attribute>
5055
+ <!-- <xsl:attribute name="padding-left">6.5mm</xsl:attribute> -->
5056
+
5003
5057
  </xsl:if>
5004
5058
 
5059
+ <xsl:if test="not(ancestor::ogc:sourcecode)">
5060
+ <!-- <xsl:attribute name="border-left">1pt solid <xsl:value-of select="$color_design"/></xsl:attribute> -->
5061
+ <xsl:attribute name="background-color"><xsl:value-of select="$color_dl_dt"/></xsl:attribute>
5062
+ </xsl:if>
5063
+
5005
5064
  <fo:block xsl:use-attribute-sets="dt-block-style">
5006
5065
  <xsl:copy-of select="@id"/>
5007
5066
 
@@ -5009,6 +5068,13 @@
5009
5068
  <xsl:attribute name="margin-top">0</xsl:attribute>
5010
5069
  </xsl:if>
5011
5070
 
5071
+ <xsl:if test="ancestor::ogc:sourcecode">
5072
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
5073
+ </xsl:if>
5074
+ <xsl:if test="not(following-sibling::ogc:dt)"> <!-- last dt -->
5075
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5076
+ </xsl:if>
5077
+
5012
5078
  <xsl:apply-templates>
5013
5079
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
5014
5080
  </xsl:apply-templates>
@@ -5028,6 +5094,10 @@
5028
5094
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5029
5095
  </xsl:if>
5030
5096
 
5097
+ <xsl:if test="not(ancestor::ogc:sourcecode)">
5098
+ <xsl:attribute name="background-color"><xsl:value-of select="$color_dl_dd"/></xsl:attribute>
5099
+ </xsl:if>
5100
+
5031
5101
  <fo:block>
5032
5102
 
5033
5103
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5447,6 +5517,7 @@
5447
5517
  <fo:inline>
5448
5518
  <xsl:for-each select="$styles/style">
5449
5519
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5520
+
5450
5521
  </xsl:for-each>
5451
5522
  <xsl:apply-templates/>
5452
5523
  </fo:inline>
@@ -6609,13 +6680,21 @@
6609
6680
  </xsl:template>
6610
6681
 
6611
6682
  <xsl:template match="*[local-name() = 'callout']">
6612
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
6683
+ <xsl:choose>
6684
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
6685
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
6686
+ </xsl:choose>
6613
6687
  </xsl:template>
6614
6688
 
6615
6689
  <xsl:template match="*[local-name() = 'annotation']">
6616
6690
  <xsl:variable name="annotation-id" select="@id"/>
6617
6691
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
6618
6692
  <fo:block id="{$annotation-id}" white-space="nowrap">
6693
+
6694
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'annotation'])">
6695
+ <xsl:attribute name="space-before">6pt</xsl:attribute>
6696
+ </xsl:if>
6697
+
6619
6698
  <fo:inline>
6620
6699
  <xsl:apply-templates>
6621
6700
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -6720,6 +6799,10 @@
6720
6799
  <!-- ====== -->
6721
6800
  <!-- ====== -->
6722
6801
 
6802
+ <xsl:template name="setBlockSpanAll">
6803
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
6804
+ </xsl:template>
6805
+
6723
6806
  <!-- ====== -->
6724
6807
  <!-- note -->
6725
6808
  <!-- termnote -->
@@ -6729,6 +6812,8 @@
6729
6812
 
6730
6813
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
6731
6814
 
6815
+ <xsl:call-template name="setBlockSpanAll"/>
6816
+
6732
6817
  <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol and not(ancestor::ogc:note[1]/following-sibling::*)">
6733
6818
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
6734
6819
  </xsl:if>
@@ -6783,6 +6868,8 @@
6783
6868
  <xsl:template match="*[local-name() = 'termnote']">
6784
6869
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
6785
6870
 
6871
+ <xsl:call-template name="setBlockSpanAll"/>
6872
+
6786
6873
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6787
6874
 
6788
6875
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -6940,6 +7027,13 @@
6940
7027
  </fo:block>
6941
7028
  </xsl:template>
6942
7029
 
7030
+ <!-- SOURCE: ... -->
7031
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7032
+
7033
+ <xsl:call-template name="termsource"/>
7034
+
7035
+ </xsl:template>
7036
+
6943
7037
  <xsl:template match="*[local-name() = 'image']">
6944
7038
  <xsl:variable name="isAdded" select="../@added"/>
6945
7039
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -8100,9 +8194,11 @@
8100
8194
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8101
8195
  </xsl:if>
8102
8196
 
8103
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8197
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
8104
8198
  </fo:block>
8105
8199
 
8200
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
8201
+
8106
8202
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8107
8203
 
8108
8204
  <xsl:if test="parent::*[local-name() = 'example']">
@@ -8138,11 +8234,22 @@
8138
8234
  <!-- add sourcecode highlighting -->
8139
8235
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
8140
8236
  <xsl:variable name="class" select="@class"/>
8237
+
8238
+ <!-- Example: <1> -->
8239
+ <xsl:variable name="is_callout">
8240
+ <xsl:if test="parent::*[local-name() = 'dt']">
8241
+ <xsl:variable name="dt_id" select="../@id"/>
8242
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
8243
+ </xsl:if>
8244
+ </xsl:variable>
8245
+
8141
8246
  <xsl:choose>
8142
8247
  <xsl:when test="$sourcecode_css//class[@name = $class]">
8143
8248
  <fo:inline>
8144
8249
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
8250
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
8145
8251
  <xsl:apply-templates/>
8252
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
8146
8253
  </fo:inline>
8147
8254
  </xsl:when>
8148
8255
  <xsl:otherwise>
@@ -8574,6 +8681,10 @@
8574
8681
  </fo:block>
8575
8682
  </xsl:template>
8576
8683
 
8684
+ <xsl:template match="*[local-name() = 'div']">
8685
+ <fo:block><xsl:apply-templates/></fo:block>
8686
+ </xsl:template>
8687
+
8577
8688
  <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
8578
8689
  <fo:block xsl:use-attribute-sets="inherit-style">
8579
8690
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8751,6 +8862,9 @@
8751
8862
  <!-- ====== -->
8752
8863
  <xsl:template match="*[local-name() = 'termexample']">
8753
8864
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8865
+
8866
+ <xsl:call-template name="setBlockSpanAll"/>
8867
+
8754
8868
  <xsl:apply-templates select="*[local-name()='name']"/>
8755
8869
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8756
8870
  </fo:block>
@@ -8802,6 +8916,8 @@
8802
8916
 
8803
8917
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
8804
8918
 
8919
+ <xsl:call-template name="setBlockSpanAll"/>
8920
+
8805
8921
  <xsl:variable name="fo_element">
8806
8922
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8807
8923
  inline
@@ -8829,6 +8945,35 @@
8829
8945
  </fo:block-container>
8830
8946
  </xsl:when> <!-- end block -->
8831
8947
 
8948
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
8949
+
8950
+ <xsl:variable name="provisional_distance_between_starts">
8951
+ 7
8952
+ </xsl:variable>
8953
+ <xsl:variable name="indent">
8954
+ 0
8955
+ </xsl:variable>
8956
+
8957
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
8958
+ <fo:list-item>
8959
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
8960
+ <fo:block>
8961
+ <xsl:apply-templates select="*[local-name()='name']">
8962
+ <xsl:with-param name="fo_element">block</xsl:with-param>
8963
+ </xsl:apply-templates>
8964
+ </fo:block>
8965
+ </fo:list-item-label>
8966
+ <fo:list-item-body start-indent="body-start()">
8967
+ <fo:block>
8968
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8969
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8970
+ </xsl:apply-templates>
8971
+ </fo:block>
8972
+ </fo:list-item-body>
8973
+ </fo:list-item>
8974
+ </fo:list-block>
8975
+ </xsl:when> <!-- end list -->
8976
+
8832
8977
  <xsl:otherwise> <!-- inline -->
8833
8978
 
8834
8979
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -8904,6 +9049,11 @@
8904
9049
  </fo:block>
8905
9050
  </fo:block-container>
8906
9051
  </xsl:when>
9052
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
9053
+ <fo:block xsl:use-attribute-sets="example-p-style">
9054
+ <xsl:apply-templates/>
9055
+ </fo:block>
9056
+ </xsl:when>
8907
9057
  <xsl:otherwise>
8908
9058
  <fo:inline xsl:use-attribute-sets="example-p-style">
8909
9059
  <xsl:apply-templates/>
@@ -9021,6 +9171,9 @@
9021
9171
  <!-- ====== -->
9022
9172
  <xsl:template match="*[local-name() = 'quote']">
9023
9173
  <fo:block-container margin-left="0mm">
9174
+
9175
+ <xsl:call-template name="setBlockSpanAll"/>
9176
+
9024
9177
  <xsl:if test="parent::*[local-name() = 'note']">
9025
9178
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
9026
9179
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -9238,13 +9391,8 @@
9238
9391
  </xsl:template>
9239
9392
 
9240
9393
  <xsl:template match="*[local-name() = 'deprecates']">
9241
- <xsl:variable name="title-deprecated">
9242
- <xsl:call-template name="getLocalizedString">
9243
- <xsl:with-param name="key">deprecated</xsl:with-param>
9244
- </xsl:call-template>
9245
- </xsl:variable>
9246
9394
  <fo:block xsl:use-attribute-sets="deprecates-style">
9247
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
9395
+ <xsl:apply-templates/>
9248
9396
  </fo:block>
9249
9397
  </xsl:template>
9250
9398
 
@@ -9309,6 +9457,8 @@
9309
9457
  <fo:block>
9310
9458
  <xsl:call-template name="setId"/>
9311
9459
 
9460
+ <xsl:call-template name="setBlockSpanAll"/>
9461
+
9312
9462
  <xsl:apply-templates/>
9313
9463
  </fo:block>
9314
9464
  </xsl:template>
@@ -9323,6 +9473,8 @@
9323
9473
  <fo:block break-after="page"/>
9324
9474
  <fo:block id="{@id}">
9325
9475
 
9476
+ <xsl:call-template name="setBlockSpanAll"/>
9477
+
9326
9478
  </fo:block>
9327
9479
  <xsl:apply-templates/>
9328
9480
  </xsl:template>
@@ -10281,6 +10433,8 @@
10281
10433
  <!-- text in the box -->
10282
10434
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
10283
10435
 
10436
+ <xsl:call-template name="setBlockSpanAll"/>
10437
+
10284
10438
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
10285
10439
 
10286
10440
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -10459,6 +10613,33 @@
10459
10613
  <xsl:apply-templates mode="update_xml_step1"/>
10460
10614
  </xsl:copy>
10461
10615
  </xsl:template>
10616
+
10617
+ <!-- remove semantic xml -->
10618
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
10619
+
10620
+ <!-- remove image/emf -->
10621
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
10622
+
10623
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
10624
+ <xsl:copy-of select="."/>
10625
+ </xsl:template>
10626
+
10627
+ <!-- add @id, redundant for table auto-layout algorithm -->
10628
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
10629
+ <xsl:copy>
10630
+ <xsl:copy-of select="@*"/>
10631
+ <xsl:call-template name="add_id"/>
10632
+ <xsl:apply-templates mode="update_xml_step1"/>
10633
+ </xsl:copy>
10634
+ </xsl:template>
10635
+
10636
+ <xsl:template name="add_id">
10637
+ <xsl:if test="not(@id)">
10638
+ <!-- add @id - first element with @id plus '_element_name' -->
10639
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
10640
+ </xsl:if>
10641
+ </xsl:template>
10642
+
10462
10643
  <!-- =========================================================================== -->
10463
10644
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10464
10645
  <!-- =========================================================================== -->
@@ -10480,7 +10661,7 @@
10480
10661
 
10481
10662
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
10482
10663
 
10483
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
10664
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
10484
10665
 
10485
10666
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
10486
10667
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -10554,6 +10735,10 @@
10554
10735
 
10555
10736
  </xsl:template>
10556
10737
 
10738
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
10739
+ <xsl:copy-of select="."/>
10740
+ </xsl:template>
10741
+
10557
10742
  <xsl:template name="replace_text_tags">
10558
10743
  <xsl:param name="tag_open"/>
10559
10744
  <xsl:param name="tag_close"/>
@@ -10580,6 +10765,194 @@
10580
10765
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
10581
10766
  <!-- ===================================== -->
10582
10767
 
10768
+ <!-- ===================================== -->
10769
+ <!-- ===================================== -->
10770
+ <!-- Make linear XML (need for landscape orientation) -->
10771
+ <!-- ===================================== -->
10772
+ <!-- ===================================== -->
10773
+ <xsl:template match="@*|node()" mode="linear_xml">
10774
+ <xsl:copy>
10775
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
10776
+ </xsl:copy>
10777
+ </xsl:template>
10778
+
10779
+ <xsl:template match="processing-instruction()" mode="linear_xml">
10780
+ <xsl:copy-of select="."/>
10781
+ </xsl:template>
10782
+
10783
+ <!-- From:
10784
+ <clause>
10785
+ <title>...</title>
10786
+ <p>...</p>
10787
+ </clause>
10788
+ To:
10789
+ <clause/>
10790
+ <title>...</title>
10791
+ <p>...</p>
10792
+ -->
10793
+ <xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
10794
+
10795
+ <xsl:copy>
10796
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10797
+
10798
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10799
+
10800
+ <xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
10801
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10802
+ </xsl:if>
10803
+ </xsl:copy>
10804
+
10805
+ <xsl:apply-templates mode="linear_xml"/>
10806
+ </xsl:template>
10807
+
10808
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
10809
+ <xsl:copy>
10810
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10811
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10812
+ <xsl:variable name="level">
10813
+ <xsl:call-template name="getLevel"/>
10814
+ </xsl:variable>
10815
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10816
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
10817
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
10818
+ </xsl:copy>
10819
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
10820
+ </xsl:template>
10821
+
10822
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
10823
+ <xsl:copy>
10824
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10825
+
10826
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
10827
+
10828
+ <xsl:variable name="level">
10829
+ <xsl:call-template name="getLevel"/>
10830
+ </xsl:variable>
10831
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
10832
+
10833
+ <xsl:if test="parent::*[local-name() = 'annex']">
10834
+ <xsl:attribute name="depth">1</xsl:attribute>
10835
+ </xsl:if>
10836
+
10837
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
10838
+ <xsl:copy-of select="../@inline-header"/>
10839
+ </xsl:if>
10840
+
10841
+ <xsl:attribute name="ancestor">
10842
+ <xsl:choose>
10843
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
10844
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
10845
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
10846
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
10847
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
10848
+ </xsl:choose>
10849
+ </xsl:attribute>
10850
+
10851
+ <xsl:apply-templates mode="linear_xml"/>
10852
+ </xsl:copy>
10853
+ </xsl:template>
10854
+
10855
+ <!-- add @to = figure, table, clause -->
10856
+ <!-- add @depth = from -->
10857
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
10858
+ <xsl:copy>
10859
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10860
+ <xsl:variable name="target" select="@target"/>
10861
+ <xsl:attribute name="to">
10862
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
10863
+ </xsl:attribute>
10864
+ <xsl:attribute name="depth">
10865
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
10866
+ </xsl:attribute>
10867
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10868
+ </xsl:copy>
10869
+ </xsl:template>
10870
+
10871
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
10872
+ <xsl:choose>
10873
+ <xsl:when test="contains(., $non_breaking_hyphen)">
10874
+ <xsl:call-template name="replaceChar">
10875
+ <xsl:with-param name="text" select="."/>
10876
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
10877
+ <xsl:with-param name="by" select="'-'"/>
10878
+ </xsl:call-template>
10879
+ </xsl:when>
10880
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10881
+ </xsl:choose>
10882
+ </xsl:template>
10883
+
10884
+ <xsl:template name="replaceChar">
10885
+ <xsl:param name="text"/>
10886
+ <xsl:param name="replace"/>
10887
+ <xsl:param name="by"/>
10888
+ <xsl:choose>
10889
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
10890
+ <xsl:value-of select="$text"/>
10891
+ </xsl:when>
10892
+ <xsl:when test="contains($text, $replace)">
10893
+ <xsl:value-of select="substring-before($text,$replace)"/>
10894
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
10895
+ <xsl:call-template name="replaceChar">
10896
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
10897
+ <xsl:with-param name="replace" select="$replace"/>
10898
+ <xsl:with-param name="by" select="$by"/>
10899
+ </xsl:call-template>
10900
+ </xsl:when>
10901
+ <xsl:otherwise>
10902
+ <xsl:value-of select="$text"/>
10903
+ </xsl:otherwise>
10904
+ </xsl:choose>
10905
+ </xsl:template>
10906
+
10907
+ <xsl:template match="*[local-name() = 'inlineChar']">
10908
+ <fo:inline><xsl:value-of select="."/></fo:inline>
10909
+ </xsl:template>
10910
+
10911
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
10912
+ <!--
10913
+ <fn reference="1">
10914
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
10915
+ </fn>
10916
+ -->
10917
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
10918
+ <xsl:variable name="p_fn_">
10919
+ <xsl:call-template name="get_fn_list"/>
10920
+ </xsl:variable>
10921
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10922
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
10923
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10924
+ <xsl:variable name="reference" select="@reference"/>
10925
+ <!-- fn sequence number in document -->
10926
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
10927
+
10928
+ <xsl:copy>
10929
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10930
+ <!-- put actual reference number -->
10931
+ <xsl:attribute name="current_fn_number">
10932
+ <xsl:value-of select="$current_fn_number"/>
10933
+ </xsl:attribute>
10934
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10935
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10936
+ </xsl:attribute>
10937
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10938
+ </xsl:copy>
10939
+ </xsl:template>
10940
+
10941
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
10942
+ <xsl:copy>
10943
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10944
+ <xsl:if test="@depth = '1'">
10945
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10946
+ </xsl:if>
10947
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10948
+ </xsl:copy>
10949
+ </xsl:template>
10950
+ <!-- ===================================== -->
10951
+ <!-- ===================================== -->
10952
+ <!-- END: Make linear XML (need for landscape orientation) -->
10953
+ <!-- ===================================== -->
10954
+ <!-- ===================================== -->
10955
+
10583
10956
  <!-- for correct rendering combining chars -->
10584
10957
  <xsl:template match="*[local-name() = 'lang_none']">
10585
10958
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>