metanorma-ogc 2.3.6 → 2.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1351,11 +1351,17 @@
1351
1351
  <!-- ========================== -->
1352
1352
  <!-- Definition's list styles -->
1353
1353
  <!-- ========================== -->
1354
+
1355
+ <xsl:attribute-set name="dl-block-style">
1356
+
1357
+ </xsl:attribute-set>
1358
+
1354
1359
  <xsl:attribute-set name="dt-row-style">
1355
1360
 
1356
1361
  </xsl:attribute-set>
1357
1362
 
1358
1363
  <xsl:attribute-set name="dt-cell-style">
1364
+
1359
1365
  </xsl:attribute-set>
1360
1366
 
1361
1367
  <xsl:attribute-set name="dt-block-style">
@@ -1376,6 +1382,7 @@
1376
1382
 
1377
1383
  <xsl:attribute-set name="dd-cell-style">
1378
1384
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1385
+
1379
1386
  </xsl:attribute-set>
1380
1387
 
1381
1388
  <!-- ========================== -->
@@ -1501,6 +1508,7 @@
1501
1508
  <xsl:attribute-set name="term-name-style">
1502
1509
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1503
1510
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1511
+
1504
1512
  </xsl:attribute-set>
1505
1513
 
1506
1514
  <xsl:attribute-set name="figure-block-style">
@@ -1526,6 +1534,10 @@
1526
1534
 
1527
1535
  </xsl:attribute-set>
1528
1536
 
1537
+ <xsl:attribute-set name="figure-source-style">
1538
+
1539
+ </xsl:attribute-set>
1540
+
1529
1541
  <!-- Formula's styles -->
1530
1542
  <xsl:attribute-set name="formula-style">
1531
1543
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2078,7 +2090,7 @@
2078
2090
 
2079
2091
  <xsl:template name="processTables_Contents">
2080
2092
  <tables>
2081
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2093
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2082
2094
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2083
2095
  <xsl:copy-of select="*[local-name() = 'name']"/>
2084
2096
  </table>
@@ -2460,7 +2472,7 @@
2460
2472
  </xsl:attribute>
2461
2473
  </xsl:for-each>
2462
2474
 
2463
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2475
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2464
2476
  <xsl:if test="$isNoteOrFnExist = 'true'">
2465
2477
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2466
2478
  </xsl:if>
@@ -2504,7 +2516,7 @@
2504
2516
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2505
2517
  </xsl:when>
2506
2518
  <xsl:otherwise>
2507
- <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 -->
2519
+ <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 -->
2508
2520
  </xsl:otherwise>
2509
2521
  </xsl:choose>
2510
2522
 
@@ -2607,6 +2619,11 @@
2607
2619
  </xsl:if>
2608
2620
  </xsl:template> <!-- table/name -->
2609
2621
 
2622
+ <!-- SOURCE: ... -->
2623
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2624
+ <xsl:call-template name="termsource"/>
2625
+ </xsl:template>
2626
+
2610
2627
  <xsl:template name="calculate-columns-numbers">
2611
2628
  <xsl:param name="table-row"/>
2612
2629
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2963,7 +2980,7 @@
2963
2980
  </fo:table-header>
2964
2981
  </xsl:template> <!-- thead -->
2965
2982
 
2966
- <!-- template is using for iso, jcgm, bsi only -->
2983
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2967
2984
  <xsl:template name="table-header-title">
2968
2985
  <xsl:param name="cols-count"/>
2969
2986
  <!-- row for title -->
@@ -3006,7 +3023,7 @@
3006
3023
  <xsl:param name="colwidths"/>
3007
3024
  <xsl:param name="colgroup"/>
3008
3025
 
3009
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3026
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3010
3027
 
3011
3028
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3012
3029
 
@@ -3074,7 +3091,9 @@
3074
3091
 
3075
3092
  <!-- except gb and bsi -->
3076
3093
 
3094
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3077
3095
  <xsl:apply-templates select="../*[local-name()='note']"/>
3096
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3078
3097
 
3079
3098
  <xsl:variable name="isDisplayRowSeparator">
3080
3099
 
@@ -3199,7 +3218,7 @@
3199
3218
  <!-- ===================== -->
3200
3219
  <!-- Table's row processing -->
3201
3220
  <!-- ===================== -->
3202
- <!-- row in table header (thead) -->
3221
+ <!-- row in table header (thead) thead/tr -->
3203
3222
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3204
3223
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3205
3224
 
@@ -3233,7 +3252,7 @@
3233
3252
  </xsl:choose>
3234
3253
  </xsl:template>
3235
3254
 
3236
- <!-- row in table footer (tfoot) -->
3255
+ <!-- row in table footer (tfoot), tfoot/tr -->
3237
3256
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3238
3257
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3239
3258
 
@@ -3718,12 +3737,26 @@
3718
3737
  <xsl:variable name="isAdded" select="@added"/>
3719
3738
  <xsl:variable name="isDeleted" select="@deleted"/>
3720
3739
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3721
- <fo:block-container>
3740
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3741
+
3742
+ <xsl:call-template name="setBlockSpanAll"/>
3722
3743
 
3723
3744
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3724
3745
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3725
3746
  </xsl:if>
3726
3747
 
3748
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3749
+ <!-- set font-size as sourcecode font-size -->
3750
+ <xsl:variable name="sourcecode_attributes">
3751
+ <xsl:call-template name="get_sourcecode_attributes"/>
3752
+ </xsl:variable>
3753
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3754
+ <xsl:attribute name="{local-name()}">
3755
+ <xsl:value-of select="."/>
3756
+ </xsl:attribute>
3757
+ </xsl:for-each>
3758
+ </xsl:if>
3759
+
3727
3760
  <xsl:if test="parent::*[local-name() = 'note']">
3728
3761
  <xsl:attribute name="margin-left">
3729
3762
  <xsl:choose>
@@ -4157,6 +4190,7 @@
4157
4190
  <xsl:param name="split_keep-within-line"/>
4158
4191
 
4159
4192
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4193
+
4160
4194
  <xsl:call-template name="insert_dt_cell">
4161
4195
  <xsl:with-param name="key_iso" select="$key_iso"/>
4162
4196
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4178,6 +4212,7 @@
4178
4212
  <!-- border is mandatory, to calculate real width -->
4179
4213
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4180
4214
  <xsl:attribute name="text-align">left</xsl:attribute>
4215
+
4181
4216
  </xsl:if>
4182
4217
 
4183
4218
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4625,6 +4660,7 @@
4625
4660
  <fo:inline>
4626
4661
  <xsl:for-each select="$styles/style">
4627
4662
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4663
+
4628
4664
  </xsl:for-each>
4629
4665
  <xsl:apply-templates/>
4630
4666
  </fo:inline>
@@ -5787,13 +5823,17 @@
5787
5823
  </xsl:template>
5788
5824
 
5789
5825
  <xsl:template match="*[local-name() = 'callout']">
5790
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5826
+ <xsl:choose>
5827
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5828
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5829
+ </xsl:choose>
5791
5830
  </xsl:template>
5792
5831
 
5793
5832
  <xsl:template match="*[local-name() = 'annotation']">
5794
5833
  <xsl:variable name="annotation-id" select="@id"/>
5795
5834
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5796
5835
  <fo:block id="{$annotation-id}" white-space="nowrap">
5836
+
5797
5837
  <fo:inline>
5798
5838
  <xsl:apply-templates>
5799
5839
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -5898,6 +5938,10 @@
5898
5938
  <!-- ====== -->
5899
5939
  <!-- ====== -->
5900
5940
 
5941
+ <xsl:template name="setBlockSpanAll">
5942
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
5943
+ </xsl:template>
5944
+
5901
5945
  <!-- ====== -->
5902
5946
  <!-- note -->
5903
5947
  <!-- termnote -->
@@ -5907,6 +5951,8 @@
5907
5951
 
5908
5952
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5909
5953
 
5954
+ <xsl:call-template name="setBlockSpanAll"/>
5955
+
5910
5956
  <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol and not(ancestor::ogc:note[1]/following-sibling::*)">
5911
5957
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
5912
5958
  </xsl:if>
@@ -5961,6 +6007,8 @@
5961
6007
  <xsl:template match="*[local-name() = 'termnote']">
5962
6008
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5963
6009
 
6010
+ <xsl:call-template name="setBlockSpanAll"/>
6011
+
5964
6012
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5965
6013
 
5966
6014
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -6116,6 +6164,13 @@
6116
6164
  </fo:block>
6117
6165
  </xsl:template>
6118
6166
 
6167
+ <!-- SOURCE: ... -->
6168
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6169
+
6170
+ <xsl:call-template name="termsource"/>
6171
+
6172
+ </xsl:template>
6173
+
6119
6174
  <xsl:template match="*[local-name() = 'image']">
6120
6175
  <xsl:variable name="isAdded" select="../@added"/>
6121
6176
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7245,9 +7300,11 @@
7245
7300
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7246
7301
  </xsl:if>
7247
7302
 
7248
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7303
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7249
7304
  </fo:block>
7250
7305
 
7306
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7307
+
7251
7308
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7252
7309
 
7253
7310
  </fo:block-container>
@@ -7279,11 +7336,22 @@
7279
7336
  <!-- add sourcecode highlighting -->
7280
7337
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7281
7338
  <xsl:variable name="class" select="@class"/>
7339
+
7340
+ <!-- Example: <1> -->
7341
+ <xsl:variable name="is_callout">
7342
+ <xsl:if test="parent::*[local-name() = 'dt']">
7343
+ <xsl:variable name="dt_id" select="../@id"/>
7344
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7345
+ </xsl:if>
7346
+ </xsl:variable>
7347
+
7282
7348
  <xsl:choose>
7283
7349
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7284
7350
  <fo:inline>
7285
7351
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7352
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7286
7353
  <xsl:apply-templates/>
7354
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7287
7355
  </fo:inline>
7288
7356
  </xsl:when>
7289
7357
  <xsl:otherwise>
@@ -7715,6 +7783,10 @@
7715
7783
  </fo:block>
7716
7784
  </xsl:template>
7717
7785
 
7786
+ <xsl:template match="*[local-name() = 'div']">
7787
+ <fo:block><xsl:apply-templates/></fo:block>
7788
+ </xsl:template>
7789
+
7718
7790
  <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']">
7719
7791
  <fo:block xsl:use-attribute-sets="inherit-style">
7720
7792
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -7892,6 +7964,9 @@
7892
7964
  <!-- ====== -->
7893
7965
  <xsl:template match="*[local-name() = 'termexample']">
7894
7966
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
7967
+
7968
+ <xsl:call-template name="setBlockSpanAll"/>
7969
+
7895
7970
  <xsl:apply-templates select="*[local-name()='name']"/>
7896
7971
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7897
7972
  </fo:block>
@@ -7943,6 +8018,8 @@
7943
8018
 
7944
8019
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
7945
8020
 
8021
+ <xsl:call-template name="setBlockSpanAll"/>
8022
+
7946
8023
  <xsl:variable name="fo_element">
7947
8024
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
7948
8025
  block
@@ -7970,6 +8047,35 @@
7970
8047
  </fo:block-container>
7971
8048
  </xsl:when> <!-- end block -->
7972
8049
 
8050
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
8051
+
8052
+ <xsl:variable name="provisional_distance_between_starts">
8053
+ 7
8054
+ </xsl:variable>
8055
+ <xsl:variable name="indent">
8056
+ 0
8057
+ </xsl:variable>
8058
+
8059
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
8060
+ <fo:list-item>
8061
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
8062
+ <fo:block>
8063
+ <xsl:apply-templates select="*[local-name()='name']">
8064
+ <xsl:with-param name="fo_element">block</xsl:with-param>
8065
+ </xsl:apply-templates>
8066
+ </fo:block>
8067
+ </fo:list-item-label>
8068
+ <fo:list-item-body start-indent="body-start()">
8069
+ <fo:block>
8070
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
8071
+ <xsl:with-param name="fo_element" select="$fo_element"/>
8072
+ </xsl:apply-templates>
8073
+ </fo:block>
8074
+ </fo:list-item-body>
8075
+ </fo:list-item>
8076
+ </fo:list-block>
8077
+ </xsl:when> <!-- end list -->
8078
+
7973
8079
  <xsl:otherwise> <!-- inline -->
7974
8080
 
7975
8081
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -8045,6 +8151,11 @@
8045
8151
  </fo:block>
8046
8152
  </fo:block-container>
8047
8153
  </xsl:when>
8154
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
8155
+ <fo:block xsl:use-attribute-sets="example-p-style">
8156
+ <xsl:apply-templates/>
8157
+ </fo:block>
8158
+ </xsl:when>
8048
8159
  <xsl:otherwise>
8049
8160
  <fo:inline xsl:use-attribute-sets="example-p-style">
8050
8161
  <xsl:apply-templates/>
@@ -8162,6 +8273,9 @@
8162
8273
  <!-- ====== -->
8163
8274
  <xsl:template match="*[local-name() = 'quote']">
8164
8275
  <fo:block-container margin-left="0mm">
8276
+
8277
+ <xsl:call-template name="setBlockSpanAll"/>
8278
+
8165
8279
  <xsl:if test="parent::*[local-name() = 'note']">
8166
8280
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
8167
8281
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8391,13 +8505,8 @@
8391
8505
  </xsl:template>
8392
8506
 
8393
8507
  <xsl:template match="*[local-name() = 'deprecates']">
8394
- <xsl:variable name="title-deprecated">
8395
- <xsl:call-template name="getLocalizedString">
8396
- <xsl:with-param name="key">deprecated</xsl:with-param>
8397
- </xsl:call-template>
8398
- </xsl:variable>
8399
8508
  <fo:block xsl:use-attribute-sets="deprecates-style">
8400
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8509
+ <xsl:apply-templates/>
8401
8510
  </fo:block>
8402
8511
  </xsl:template>
8403
8512
 
@@ -8462,6 +8571,8 @@
8462
8571
  <fo:block>
8463
8572
  <xsl:call-template name="setId"/>
8464
8573
 
8574
+ <xsl:call-template name="setBlockSpanAll"/>
8575
+
8465
8576
  <xsl:apply-templates/>
8466
8577
  </fo:block>
8467
8578
  </xsl:template>
@@ -8476,6 +8587,8 @@
8476
8587
  <fo:block break-after="page"/>
8477
8588
  <fo:block id="{@id}">
8478
8589
 
8590
+ <xsl:call-template name="setBlockSpanAll"/>
8591
+
8479
8592
  </fo:block>
8480
8593
  <xsl:apply-templates/>
8481
8594
  </xsl:template>
@@ -9426,6 +9539,8 @@
9426
9539
  <!-- text in the box -->
9427
9540
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9428
9541
 
9542
+ <xsl:call-template name="setBlockSpanAll"/>
9543
+
9429
9544
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9430
9545
 
9431
9546
  <fo:block xsl:use-attribute-sets="admonition-name-style">
@@ -9604,6 +9719,33 @@
9604
9719
  <xsl:apply-templates mode="update_xml_step1"/>
9605
9720
  </xsl:copy>
9606
9721
  </xsl:template>
9722
+
9723
+ <!-- remove semantic xml -->
9724
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9725
+
9726
+ <!-- remove image/emf -->
9727
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9728
+
9729
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9730
+ <xsl:copy-of select="."/>
9731
+ </xsl:template>
9732
+
9733
+ <!-- add @id, redundant for table auto-layout algorithm -->
9734
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9735
+ <xsl:copy>
9736
+ <xsl:copy-of select="@*"/>
9737
+ <xsl:call-template name="add_id"/>
9738
+ <xsl:apply-templates mode="update_xml_step1"/>
9739
+ </xsl:copy>
9740
+ </xsl:template>
9741
+
9742
+ <xsl:template name="add_id">
9743
+ <xsl:if test="not(@id)">
9744
+ <!-- add @id - first element with @id plus '_element_name' -->
9745
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9746
+ </xsl:if>
9747
+ </xsl:template>
9748
+
9607
9749
  <!-- =========================================================================== -->
9608
9750
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9609
9751
  <!-- =========================================================================== -->
@@ -9625,7 +9767,7 @@
9625
9767
 
9626
9768
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9627
9769
 
9628
- <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">
9770
+ <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">
9629
9771
 
9630
9772
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9631
9773
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9699,6 +9841,10 @@
9699
9841
 
9700
9842
  </xsl:template>
9701
9843
 
9844
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9845
+ <xsl:copy-of select="."/>
9846
+ </xsl:template>
9847
+
9702
9848
  <xsl:template name="replace_text_tags">
9703
9849
  <xsl:param name="tag_open"/>
9704
9850
  <xsl:param name="tag_close"/>
@@ -9725,6 +9871,194 @@
9725
9871
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9726
9872
  <!-- ===================================== -->
9727
9873
 
9874
+ <!-- ===================================== -->
9875
+ <!-- ===================================== -->
9876
+ <!-- Make linear XML (need for landscape orientation) -->
9877
+ <!-- ===================================== -->
9878
+ <!-- ===================================== -->
9879
+ <xsl:template match="@*|node()" mode="linear_xml">
9880
+ <xsl:copy>
9881
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
9882
+ </xsl:copy>
9883
+ </xsl:template>
9884
+
9885
+ <xsl:template match="processing-instruction()" mode="linear_xml">
9886
+ <xsl:copy-of select="."/>
9887
+ </xsl:template>
9888
+
9889
+ <!-- From:
9890
+ <clause>
9891
+ <title>...</title>
9892
+ <p>...</p>
9893
+ </clause>
9894
+ To:
9895
+ <clause/>
9896
+ <title>...</title>
9897
+ <p>...</p>
9898
+ -->
9899
+ <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">
9900
+
9901
+ <xsl:copy>
9902
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9903
+
9904
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9905
+
9906
+ <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'">
9907
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9908
+ </xsl:if>
9909
+ </xsl:copy>
9910
+
9911
+ <xsl:apply-templates mode="linear_xml"/>
9912
+ </xsl:template>
9913
+
9914
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
9915
+ <xsl:copy>
9916
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9917
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9918
+ <xsl:variable name="level">
9919
+ <xsl:call-template name="getLevel"/>
9920
+ </xsl:variable>
9921
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9922
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
9923
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
9924
+ </xsl:copy>
9925
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
9926
+ </xsl:template>
9927
+
9928
+ <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">
9929
+ <xsl:copy>
9930
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9931
+
9932
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9933
+
9934
+ <xsl:variable name="level">
9935
+ <xsl:call-template name="getLevel"/>
9936
+ </xsl:variable>
9937
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9938
+
9939
+ <xsl:if test="parent::*[local-name() = 'annex']">
9940
+ <xsl:attribute name="depth">1</xsl:attribute>
9941
+ </xsl:if>
9942
+
9943
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
9944
+ <xsl:copy-of select="../@inline-header"/>
9945
+ </xsl:if>
9946
+
9947
+ <xsl:attribute name="ancestor">
9948
+ <xsl:choose>
9949
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
9950
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
9951
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
9952
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
9953
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
9954
+ </xsl:choose>
9955
+ </xsl:attribute>
9956
+
9957
+ <xsl:apply-templates mode="linear_xml"/>
9958
+ </xsl:copy>
9959
+ </xsl:template>
9960
+
9961
+ <!-- add @to = figure, table, clause -->
9962
+ <!-- add @depth = from -->
9963
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
9964
+ <xsl:copy>
9965
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9966
+ <xsl:variable name="target" select="@target"/>
9967
+ <xsl:attribute name="to">
9968
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
9969
+ </xsl:attribute>
9970
+ <xsl:attribute name="depth">
9971
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
9972
+ </xsl:attribute>
9973
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9974
+ </xsl:copy>
9975
+ </xsl:template>
9976
+
9977
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
9978
+ <xsl:choose>
9979
+ <xsl:when test="contains(., $non_breaking_hyphen)">
9980
+ <xsl:call-template name="replaceChar">
9981
+ <xsl:with-param name="text" select="."/>
9982
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
9983
+ <xsl:with-param name="by" select="'-'"/>
9984
+ </xsl:call-template>
9985
+ </xsl:when>
9986
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
9987
+ </xsl:choose>
9988
+ </xsl:template>
9989
+
9990
+ <xsl:template name="replaceChar">
9991
+ <xsl:param name="text"/>
9992
+ <xsl:param name="replace"/>
9993
+ <xsl:param name="by"/>
9994
+ <xsl:choose>
9995
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
9996
+ <xsl:value-of select="$text"/>
9997
+ </xsl:when>
9998
+ <xsl:when test="contains($text, $replace)">
9999
+ <xsl:value-of select="substring-before($text,$replace)"/>
10000
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
10001
+ <xsl:call-template name="replaceChar">
10002
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
10003
+ <xsl:with-param name="replace" select="$replace"/>
10004
+ <xsl:with-param name="by" select="$by"/>
10005
+ </xsl:call-template>
10006
+ </xsl:when>
10007
+ <xsl:otherwise>
10008
+ <xsl:value-of select="$text"/>
10009
+ </xsl:otherwise>
10010
+ </xsl:choose>
10011
+ </xsl:template>
10012
+
10013
+ <xsl:template match="*[local-name() = 'inlineChar']">
10014
+ <fo:inline><xsl:value-of select="."/></fo:inline>
10015
+ </xsl:template>
10016
+
10017
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
10018
+ <!--
10019
+ <fn reference="1">
10020
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
10021
+ </fn>
10022
+ -->
10023
+ <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">
10024
+ <xsl:variable name="p_fn_">
10025
+ <xsl:call-template name="get_fn_list"/>
10026
+ </xsl:variable>
10027
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10028
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
10029
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10030
+ <xsl:variable name="reference" select="@reference"/>
10031
+ <!-- fn sequence number in document -->
10032
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
10033
+
10034
+ <xsl:copy>
10035
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10036
+ <!-- put actual reference number -->
10037
+ <xsl:attribute name="current_fn_number">
10038
+ <xsl:value-of select="$current_fn_number"/>
10039
+ </xsl:attribute>
10040
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10041
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10042
+ </xsl:attribute>
10043
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10044
+ </xsl:copy>
10045
+ </xsl:template>
10046
+
10047
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
10048
+ <xsl:copy>
10049
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
10050
+ <xsl:if test="@depth = '1'">
10051
+ <xsl:attribute name="mainsection">true</xsl:attribute>
10052
+ </xsl:if>
10053
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
10054
+ </xsl:copy>
10055
+ </xsl:template>
10056
+ <!-- ===================================== -->
10057
+ <!-- ===================================== -->
10058
+ <!-- END: Make linear XML (need for landscape orientation) -->
10059
+ <!-- ===================================== -->
10060
+ <!-- ===================================== -->
10061
+
9728
10062
  <!-- for correct rendering combining chars -->
9729
10063
  <xsl:template match="*[local-name() = 'lang_none']">
9730
10064
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>