metanorma-iso 2.4.0 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2824,6 +2824,7 @@
2824
2824
  <xsl:variable name="table-border_">
2825
2825
 
2826
2826
  1pt solid black
2827
+
2827
2828
  </xsl:variable>
2828
2829
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
2829
2830
 
@@ -2973,11 +2974,17 @@
2973
2974
  <!-- ========================== -->
2974
2975
  <!-- Definition's list styles -->
2975
2976
  <!-- ========================== -->
2977
+
2978
+ <xsl:attribute-set name="dl-block-style">
2979
+
2980
+ </xsl:attribute-set>
2981
+
2976
2982
  <xsl:attribute-set name="dt-row-style">
2977
2983
 
2978
2984
  </xsl:attribute-set>
2979
2985
 
2980
2986
  <xsl:attribute-set name="dt-cell-style">
2987
+
2981
2988
  </xsl:attribute-set>
2982
2989
 
2983
2990
  <xsl:attribute-set name="dt-block-style">
@@ -2995,6 +3002,7 @@
2995
3002
 
2996
3003
  <xsl:attribute-set name="dd-cell-style">
2997
3004
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
3005
+
2998
3006
  </xsl:attribute-set>
2999
3007
 
3000
3008
  <!-- ========================== -->
@@ -3112,6 +3120,7 @@
3112
3120
  <xsl:attribute-set name="term-name-style">
3113
3121
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3114
3122
  <xsl:attribute name="font-weight">bold</xsl:attribute>
3123
+
3115
3124
  </xsl:attribute-set>
3116
3125
 
3117
3126
  <xsl:attribute-set name="figure-block-style">
@@ -3134,6 +3143,10 @@
3134
3143
 
3135
3144
  </xsl:attribute-set>
3136
3145
 
3146
+ <xsl:attribute-set name="figure-source-style">
3147
+
3148
+ </xsl:attribute-set>
3149
+
3137
3150
  <!-- Formula's styles -->
3138
3151
  <xsl:attribute-set name="formula-style">
3139
3152
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -3669,7 +3682,7 @@
3669
3682
 
3670
3683
  <xsl:template name="processTables_Contents">
3671
3684
  <tables>
3672
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3685
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3673
3686
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3674
3687
  <xsl:copy-of select="*[local-name() = 'name']"/>
3675
3688
  </table>
@@ -4025,7 +4038,7 @@
4025
4038
  </xsl:attribute>
4026
4039
  </xsl:for-each>
4027
4040
 
4028
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4041
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4029
4042
  <xsl:if test="$isNoteOrFnExist = 'true'">
4030
4043
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4031
4044
  </xsl:if>
@@ -4069,7 +4082,7 @@
4069
4082
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4070
4083
  </xsl:when>
4071
4084
  <xsl:otherwise>
4072
- <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 -->
4085
+ <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 -->
4073
4086
  </xsl:otherwise>
4074
4087
  </xsl:choose>
4075
4088
 
@@ -4192,6 +4205,11 @@
4192
4205
  </xsl:if>
4193
4206
  </xsl:template> <!-- table/name -->
4194
4207
 
4208
+ <!-- SOURCE: ... -->
4209
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4210
+ <xsl:call-template name="termsource"/>
4211
+ </xsl:template>
4212
+
4195
4213
  <xsl:template name="calculate-columns-numbers">
4196
4214
  <xsl:param name="table-row"/>
4197
4215
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -4552,7 +4570,7 @@
4552
4570
  </fo:table-header>
4553
4571
  </xsl:template> <!-- thead -->
4554
4572
 
4555
- <!-- template is using for iso, jcgm, bsi only -->
4573
+ <!-- template is using for iec, iso, jcgm, bsi only -->
4556
4574
  <xsl:template name="table-header-title">
4557
4575
  <xsl:param name="cols-count"/>
4558
4576
  <!-- row for title -->
@@ -4605,7 +4623,7 @@
4605
4623
  <xsl:param name="colwidths"/>
4606
4624
  <xsl:param name="colgroup"/>
4607
4625
 
4608
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
4626
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4609
4627
 
4610
4628
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4611
4629
 
@@ -4673,7 +4691,9 @@
4673
4691
 
4674
4692
  <!-- except gb and bsi -->
4675
4693
 
4694
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
4676
4695
  <xsl:apply-templates select="../*[local-name()='note']"/>
4696
+ <xsl:apply-templates select="../*[local-name()='source']"/>
4677
4697
 
4678
4698
  <xsl:variable name="isDisplayRowSeparator">
4679
4699
 
@@ -4842,7 +4862,7 @@
4842
4862
  <!-- ===================== -->
4843
4863
  <!-- Table's row processing -->
4844
4864
  <!-- ===================== -->
4845
- <!-- row in table header (thead) -->
4865
+ <!-- row in table header (thead) thead/tr -->
4846
4866
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4847
4867
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4848
4868
 
@@ -4887,7 +4907,7 @@
4887
4907
  </xsl:choose>
4888
4908
  </xsl:template>
4889
4909
 
4890
- <!-- row in table footer (tfoot) -->
4910
+ <!-- row in table footer (tfoot), tfoot/tr -->
4891
4911
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
4892
4912
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
4893
4913
 
@@ -5388,12 +5408,26 @@
5388
5408
  <xsl:variable name="isAdded" select="@added"/>
5389
5409
  <xsl:variable name="isDeleted" select="@deleted"/>
5390
5410
  <!-- <dl><xsl:copy-of select="."/></dl> -->
5391
- <fo:block-container>
5411
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
5412
+
5413
+ <xsl:call-template name="setBlockSpanAll"/>
5392
5414
 
5393
5415
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
5394
5416
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5395
5417
  </xsl:if>
5396
5418
 
5419
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5420
+ <!-- set font-size as sourcecode font-size -->
5421
+ <xsl:variable name="sourcecode_attributes">
5422
+ <xsl:call-template name="get_sourcecode_attributes"/>
5423
+ </xsl:variable>
5424
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
5425
+ <xsl:attribute name="{local-name()}">
5426
+ <xsl:value-of select="."/>
5427
+ </xsl:attribute>
5428
+ </xsl:for-each>
5429
+ </xsl:if>
5430
+
5397
5431
  <xsl:if test="parent::*[local-name() = 'note']">
5398
5432
  <xsl:attribute name="margin-left">
5399
5433
  <xsl:choose>
@@ -5845,6 +5879,7 @@
5845
5879
  <xsl:param name="split_keep-within-line"/>
5846
5880
 
5847
5881
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5882
+
5848
5883
  <xsl:call-template name="insert_dt_cell">
5849
5884
  <xsl:with-param name="key_iso" select="$key_iso"/>
5850
5885
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5866,6 +5901,7 @@
5866
5901
  <!-- border is mandatory, to calculate real width -->
5867
5902
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5868
5903
  <xsl:attribute name="text-align">left</xsl:attribute>
5904
+
5869
5905
  </xsl:if>
5870
5906
 
5871
5907
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -6379,6 +6415,7 @@
6379
6415
  <fo:inline>
6380
6416
  <xsl:for-each select="$styles/style">
6381
6417
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
6418
+
6382
6419
  </xsl:for-each>
6383
6420
  <xsl:apply-templates/>
6384
6421
  </fo:inline>
@@ -7548,13 +7585,17 @@
7548
7585
  </xsl:template>
7549
7586
 
7550
7587
  <xsl:template match="*[local-name() = 'callout']">
7551
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
7588
+ <xsl:choose>
7589
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
7590
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
7591
+ </xsl:choose>
7552
7592
  </xsl:template>
7553
7593
 
7554
7594
  <xsl:template match="*[local-name() = 'annotation']">
7555
7595
  <xsl:variable name="annotation-id" select="@id"/>
7556
7596
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
7557
7597
  <fo:block id="{$annotation-id}" white-space="nowrap">
7598
+
7558
7599
  <fo:inline>
7559
7600
  <xsl:apply-templates>
7560
7601
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -7659,6 +7700,10 @@
7659
7700
  <!-- ====== -->
7660
7701
  <!-- ====== -->
7661
7702
 
7703
+ <xsl:template name="setBlockSpanAll">
7704
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
7705
+ </xsl:template>
7706
+
7662
7707
  <!-- ====== -->
7663
7708
  <!-- note -->
7664
7709
  <!-- termnote -->
@@ -7668,6 +7713,8 @@
7668
7713
 
7669
7714
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
7670
7715
 
7716
+ <xsl:call-template name="setBlockSpanAll"/>
7717
+
7671
7718
  <xsl:if test="$doctype = 'amendment' and parent::*[local-name() = 'quote']">
7672
7719
  <xsl:attribute name="font-size">inherit</xsl:attribute>
7673
7720
  </xsl:if>
@@ -7722,6 +7769,8 @@
7722
7769
  <xsl:template match="*[local-name() = 'termnote']">
7723
7770
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
7724
7771
 
7772
+ <xsl:call-template name="setBlockSpanAll"/>
7773
+
7725
7774
  <xsl:if test="$doctype = 'amendment' and parent::*[local-name() = 'quote']">
7726
7775
  <xsl:attribute name="font-size">inherit</xsl:attribute>
7727
7776
  </xsl:if>
@@ -7883,6 +7932,13 @@
7883
7932
  </fo:block>
7884
7933
  </xsl:template>
7885
7934
 
7935
+ <!-- SOURCE: ... -->
7936
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7937
+
7938
+ <xsl:call-template name="termsource"/>
7939
+
7940
+ </xsl:template>
7941
+
7886
7942
  <xsl:template match="*[local-name() = 'image']">
7887
7943
  <xsl:variable name="isAdded" select="../@added"/>
7888
7944
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -9012,9 +9068,11 @@
9012
9068
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
9013
9069
  </xsl:if>
9014
9070
 
9015
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9071
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
9016
9072
  </fo:block>
9017
9073
 
9074
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
9075
+
9018
9076
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
9019
9077
 
9020
9078
  </fo:block-container>
@@ -9046,11 +9104,22 @@
9046
9104
  <!-- add sourcecode highlighting -->
9047
9105
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
9048
9106
  <xsl:variable name="class" select="@class"/>
9107
+
9108
+ <!-- Example: <1> -->
9109
+ <xsl:variable name="is_callout">
9110
+ <xsl:if test="parent::*[local-name() = 'dt']">
9111
+ <xsl:variable name="dt_id" select="../@id"/>
9112
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
9113
+ </xsl:if>
9114
+ </xsl:variable>
9115
+
9049
9116
  <xsl:choose>
9050
9117
  <xsl:when test="$sourcecode_css//class[@name = $class]">
9051
9118
  <fo:inline>
9052
9119
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
9120
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
9053
9121
  <xsl:apply-templates/>
9122
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
9054
9123
  </fo:inline>
9055
9124
  </xsl:when>
9056
9125
  <xsl:otherwise>
@@ -9476,6 +9545,10 @@
9476
9545
  </fo:block>
9477
9546
  </xsl:template>
9478
9547
 
9548
+ <xsl:template match="*[local-name() = 'div']">
9549
+ <fo:block><xsl:apply-templates/></fo:block>
9550
+ </xsl:template>
9551
+
9479
9552
  <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']">
9480
9553
  <fo:block xsl:use-attribute-sets="inherit-style">
9481
9554
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -9639,6 +9712,9 @@
9639
9712
  <!-- ====== -->
9640
9713
  <xsl:template match="*[local-name() = 'termexample']">
9641
9714
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
9715
+
9716
+ <xsl:call-template name="setBlockSpanAll"/>
9717
+
9642
9718
  <xsl:apply-templates select="*[local-name()='name']"/>
9643
9719
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9644
9720
  </fo:block>
@@ -9690,6 +9766,8 @@
9690
9766
 
9691
9767
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
9692
9768
 
9769
+ <xsl:call-template name="setBlockSpanAll"/>
9770
+
9693
9771
  <xsl:variable name="fo_element">
9694
9772
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
9695
9773
  inline
@@ -9717,6 +9795,35 @@
9717
9795
  </fo:block-container>
9718
9796
  </xsl:when> <!-- end block -->
9719
9797
 
9798
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
9799
+
9800
+ <xsl:variable name="provisional_distance_between_starts">
9801
+ 7
9802
+ </xsl:variable>
9803
+ <xsl:variable name="indent">
9804
+ 0
9805
+ </xsl:variable>
9806
+
9807
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
9808
+ <fo:list-item>
9809
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
9810
+ <fo:block>
9811
+ <xsl:apply-templates select="*[local-name()='name']">
9812
+ <xsl:with-param name="fo_element">block</xsl:with-param>
9813
+ </xsl:apply-templates>
9814
+ </fo:block>
9815
+ </fo:list-item-label>
9816
+ <fo:list-item-body start-indent="body-start()">
9817
+ <fo:block>
9818
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
9819
+ <xsl:with-param name="fo_element" select="$fo_element"/>
9820
+ </xsl:apply-templates>
9821
+ </fo:block>
9822
+ </fo:list-item-body>
9823
+ </fo:list-item>
9824
+ </fo:list-block>
9825
+ </xsl:when> <!-- end list -->
9826
+
9720
9827
  <xsl:otherwise> <!-- inline -->
9721
9828
 
9722
9829
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -9797,6 +9904,11 @@
9797
9904
  </fo:block>
9798
9905
  </fo:block-container>
9799
9906
  </xsl:when>
9907
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
9908
+ <fo:block xsl:use-attribute-sets="example-p-style">
9909
+ <xsl:apply-templates/>
9910
+ </fo:block>
9911
+ </xsl:when>
9800
9912
  <xsl:otherwise>
9801
9913
  <fo:inline xsl:use-attribute-sets="example-p-style">
9802
9914
  <xsl:apply-templates/>
@@ -9914,6 +10026,9 @@
9914
10026
  <!-- ====== -->
9915
10027
  <xsl:template match="*[local-name() = 'quote']">
9916
10028
  <fo:block-container margin-left="0mm">
10029
+
10030
+ <xsl:call-template name="setBlockSpanAll"/>
10031
+
9917
10032
  <xsl:if test="parent::*[local-name() = 'note']">
9918
10033
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
9919
10034
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -10135,13 +10250,8 @@
10135
10250
  </xsl:template>
10136
10251
 
10137
10252
  <xsl:template match="*[local-name() = 'deprecates']">
10138
- <xsl:variable name="title-deprecated">
10139
- <xsl:call-template name="getLocalizedString">
10140
- <xsl:with-param name="key">deprecated</xsl:with-param>
10141
- </xsl:call-template>
10142
- </xsl:variable>
10143
10253
  <fo:block xsl:use-attribute-sets="deprecates-style">
10144
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
10254
+ <xsl:apply-templates/>
10145
10255
  </fo:block>
10146
10256
  </xsl:template>
10147
10257
 
@@ -10206,6 +10316,8 @@
10206
10316
  <fo:block>
10207
10317
  <xsl:call-template name="setId"/>
10208
10318
 
10319
+ <xsl:call-template name="setBlockSpanAll"/>
10320
+
10209
10321
  <xsl:apply-templates/>
10210
10322
  </fo:block>
10211
10323
  </xsl:template>
@@ -10220,6 +10332,8 @@
10220
10332
  <fo:block break-after="page"/>
10221
10333
  <fo:block id="{@id}">
10222
10334
 
10335
+ <xsl:call-template name="setBlockSpanAll"/>
10336
+
10223
10337
  </fo:block>
10224
10338
  <xsl:apply-templates/>
10225
10339
  </xsl:template>
@@ -11173,6 +11287,8 @@
11173
11287
 
11174
11288
  <fo:block xsl:use-attribute-sets="admonition-style">
11175
11289
 
11290
+ <xsl:call-template name="setBlockSpanAll"/>
11291
+
11176
11292
  <xsl:if test="@type = 'editorial'">
11177
11293
  <xsl:attribute name="color">green</xsl:attribute>
11178
11294
  <xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -11355,6 +11471,33 @@
11355
11471
  <xsl:apply-templates mode="update_xml_step1"/>
11356
11472
  </xsl:copy>
11357
11473
  </xsl:template>
11474
+
11475
+ <!-- remove semantic xml -->
11476
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
11477
+
11478
+ <!-- remove image/emf -->
11479
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
11480
+
11481
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
11482
+ <xsl:copy-of select="."/>
11483
+ </xsl:template>
11484
+
11485
+ <!-- add @id, redundant for table auto-layout algorithm -->
11486
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11487
+ <xsl:copy>
11488
+ <xsl:copy-of select="@*"/>
11489
+ <xsl:call-template name="add_id"/>
11490
+ <xsl:apply-templates mode="update_xml_step1"/>
11491
+ </xsl:copy>
11492
+ </xsl:template>
11493
+
11494
+ <xsl:template name="add_id">
11495
+ <xsl:if test="not(@id)">
11496
+ <!-- add @id - first element with @id plus '_element_name' -->
11497
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
11498
+ </xsl:if>
11499
+ </xsl:template>
11500
+
11358
11501
  <!-- =========================================================================== -->
11359
11502
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11360
11503
  <!-- =========================================================================== -->
@@ -11455,6 +11598,10 @@
11455
11598
  </xsl:call-template>
11456
11599
  </xsl:template>
11457
11600
 
11601
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step2">
11602
+ <xsl:copy-of select="."/>
11603
+ </xsl:template>
11604
+
11458
11605
  <!-- =========================================================================== -->
11459
11606
  <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
11460
11607
  <!-- =========================================================================== -->
@@ -11476,7 +11623,7 @@
11476
11623
 
11477
11624
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
11478
11625
 
11479
- <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">
11626
+ <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">
11480
11627
 
11481
11628
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
11482
11629
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -11558,6 +11705,10 @@
11558
11705
 
11559
11706
  </xsl:template>
11560
11707
 
11708
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
11709
+ <xsl:copy-of select="."/>
11710
+ </xsl:template>
11711
+
11561
11712
  <xsl:template name="replace_text_tags">
11562
11713
  <xsl:param name="tag_open"/>
11563
11714
  <xsl:param name="tag_close"/>
@@ -11584,6 +11735,194 @@
11584
11735
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
11585
11736
  <!-- ===================================== -->
11586
11737
 
11738
+ <!-- ===================================== -->
11739
+ <!-- ===================================== -->
11740
+ <!-- Make linear XML (need for landscape orientation) -->
11741
+ <!-- ===================================== -->
11742
+ <!-- ===================================== -->
11743
+ <xsl:template match="@*|node()" mode="linear_xml">
11744
+ <xsl:copy>
11745
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
11746
+ </xsl:copy>
11747
+ </xsl:template>
11748
+
11749
+ <xsl:template match="processing-instruction()" mode="linear_xml">
11750
+ <xsl:copy-of select="."/>
11751
+ </xsl:template>
11752
+
11753
+ <!-- From:
11754
+ <clause>
11755
+ <title>...</title>
11756
+ <p>...</p>
11757
+ </clause>
11758
+ To:
11759
+ <clause/>
11760
+ <title>...</title>
11761
+ <p>...</p>
11762
+ -->
11763
+ <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">
11764
+
11765
+ <xsl:copy>
11766
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
11767
+
11768
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11769
+
11770
+ <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'">
11771
+ <xsl:attribute name="mainsection">true</xsl:attribute>
11772
+ </xsl:if>
11773
+ </xsl:copy>
11774
+
11775
+ <xsl:apply-templates mode="linear_xml"/>
11776
+ </xsl:template>
11777
+
11778
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
11779
+ <xsl:copy>
11780
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
11781
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11782
+ <xsl:variable name="level">
11783
+ <xsl:call-template name="getLevel"/>
11784
+ </xsl:variable>
11785
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
11786
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
11787
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
11788
+ </xsl:copy>
11789
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
11790
+ </xsl:template>
11791
+
11792
+ <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">
11793
+ <xsl:copy>
11794
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
11795
+
11796
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11797
+
11798
+ <xsl:variable name="level">
11799
+ <xsl:call-template name="getLevel"/>
11800
+ </xsl:variable>
11801
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
11802
+
11803
+ <xsl:if test="parent::*[local-name() = 'annex']">
11804
+ <xsl:attribute name="depth">1</xsl:attribute>
11805
+ </xsl:if>
11806
+
11807
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
11808
+ <xsl:copy-of select="../@inline-header"/>
11809
+ </xsl:if>
11810
+
11811
+ <xsl:attribute name="ancestor">
11812
+ <xsl:choose>
11813
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
11814
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
11815
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
11816
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
11817
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
11818
+ </xsl:choose>
11819
+ </xsl:attribute>
11820
+
11821
+ <xsl:apply-templates mode="linear_xml"/>
11822
+ </xsl:copy>
11823
+ </xsl:template>
11824
+
11825
+ <!-- add @to = figure, table, clause -->
11826
+ <!-- add @depth = from -->
11827
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
11828
+ <xsl:copy>
11829
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
11830
+ <xsl:variable name="target" select="@target"/>
11831
+ <xsl:attribute name="to">
11832
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
11833
+ </xsl:attribute>
11834
+ <xsl:attribute name="depth">
11835
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
11836
+ </xsl:attribute>
11837
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
11838
+ </xsl:copy>
11839
+ </xsl:template>
11840
+
11841
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
11842
+ <xsl:choose>
11843
+ <xsl:when test="contains(., $non_breaking_hyphen)">
11844
+ <xsl:call-template name="replaceChar">
11845
+ <xsl:with-param name="text" select="."/>
11846
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
11847
+ <xsl:with-param name="by" select="'-'"/>
11848
+ </xsl:call-template>
11849
+ </xsl:when>
11850
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
11851
+ </xsl:choose>
11852
+ </xsl:template>
11853
+
11854
+ <xsl:template name="replaceChar">
11855
+ <xsl:param name="text"/>
11856
+ <xsl:param name="replace"/>
11857
+ <xsl:param name="by"/>
11858
+ <xsl:choose>
11859
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
11860
+ <xsl:value-of select="$text"/>
11861
+ </xsl:when>
11862
+ <xsl:when test="contains($text, $replace)">
11863
+ <xsl:value-of select="substring-before($text,$replace)"/>
11864
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
11865
+ <xsl:call-template name="replaceChar">
11866
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
11867
+ <xsl:with-param name="replace" select="$replace"/>
11868
+ <xsl:with-param name="by" select="$by"/>
11869
+ </xsl:call-template>
11870
+ </xsl:when>
11871
+ <xsl:otherwise>
11872
+ <xsl:value-of select="$text"/>
11873
+ </xsl:otherwise>
11874
+ </xsl:choose>
11875
+ </xsl:template>
11876
+
11877
+ <xsl:template match="*[local-name() = 'inlineChar']">
11878
+ <fo:inline><xsl:value-of select="."/></fo:inline>
11879
+ </xsl:template>
11880
+
11881
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
11882
+ <!--
11883
+ <fn reference="1">
11884
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
11885
+ </fn>
11886
+ -->
11887
+ <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">
11888
+ <xsl:variable name="p_fn_">
11889
+ <xsl:call-template name="get_fn_list"/>
11890
+ </xsl:variable>
11891
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11892
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
11893
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
11894
+ <xsl:variable name="reference" select="@reference"/>
11895
+ <!-- fn sequence number in document -->
11896
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
11897
+
11898
+ <xsl:copy>
11899
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
11900
+ <!-- put actual reference number -->
11901
+ <xsl:attribute name="current_fn_number">
11902
+ <xsl:value-of select="$current_fn_number"/>
11903
+ </xsl:attribute>
11904
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
11905
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11906
+ </xsl:attribute>
11907
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
11908
+ </xsl:copy>
11909
+ </xsl:template>
11910
+
11911
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
11912
+ <xsl:copy>
11913
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
11914
+ <xsl:if test="@depth = '1'">
11915
+ <xsl:attribute name="mainsection">true</xsl:attribute>
11916
+ </xsl:if>
11917
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
11918
+ </xsl:copy>
11919
+ </xsl:template>
11920
+ <!-- ===================================== -->
11921
+ <!-- ===================================== -->
11922
+ <!-- END: Make linear XML (need for landscape orientation) -->
11923
+ <!-- ===================================== -->
11924
+ <!-- ===================================== -->
11925
+
11587
11926
  <!-- for correct rendering combining chars -->
11588
11927
  <xsl:template match="*[local-name() = 'lang_none']">
11589
11928
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>