metanorma-jis 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a682db090b197edb90ddd8f287a3e6d5c6144ec1cf547e7ba6e3917fd8c6fcd8
4
- data.tar.gz: 7c0834e3d7db92e8c970586df8d017816567dfed7de17236c8667f2daab66003
3
+ metadata.gz: 22d96124c9e4fc24d870feb8468d5a189c91db7ec2cc09defdbef1e5aea95c1a
4
+ data.tar.gz: 71e3c4e32970bdb780959c39bcb4df6f0ed1ba372e400ba112a71bdc5413ba7d
5
5
  SHA512:
6
- metadata.gz: 3c0d262d95ae7b6abb12adbaf9becbf875afdb5aad30b0c9343543c05ccd9300d5cc8d6e9be7c92f66579b4aa928bf2c3fbcd3d5db50824997026670753d7395
7
- data.tar.gz: 2955ea4c486cb425a3b40de02205151cd99d191048ba10e6eceb9b2f11c42c26864bf40c9378a7b87d2564f2c18cb4e7ca53c85ef7c84e1e80871bbc204bb5d9
6
+ metadata.gz: 545df234a6cd22ec2d9391b171813ab7fa55804f2c8ef8ca4263f445b387154efcd937a512168b61e6026b243abed2697f13b2faa58f562e6a6adbc954eeae61
7
+ data.tar.gz: d8ce7d6270574ad2f26a9db44d221f24c1d64c8cf10bbed86921b8b3c91fd256d058e44aa89c605cc1248be2a6c35bc5b402a2f9b98efaab49221c30bc352a72
@@ -4,22 +4,6 @@ require "metanorma-iso"
4
4
  module IsoDoc
5
5
  module Jis
6
6
  module BaseConvert
7
- # KILL
8
- def termnote_parsex(node, out)
9
- name = node.at(ns("./name"))&.remove
10
- out.div **note_attrs(node) do |div|
11
- div.p do |p|
12
- if name
13
- p.span class: "note_label" do |s|
14
- name.children.each { |n| parse(n, s) }
15
- end
16
- p << " "
17
- end
18
- para_then_remainder(node.first_element_child, node, p, div)
19
- end
20
- end
21
- end
22
-
23
7
  def make_tr_attr(cell, row, totalrows, header, bordered)
24
8
  cell["border"] == "0" and bordered = false
25
9
  super
@@ -11,6 +11,13 @@
11
11
  <xsl:variable name="vertical_layout" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:vertical-layout)"/>
12
12
  <xsl:variable name="vertical_layout_rotate_clause_numbers" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:vertical-layout-rotate-clause-numbers)"/>
13
13
 
14
+ <xsl:variable name="autonumbering_style" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:autonumbering-style)"/>
15
+
16
+ <xsl:variable name="numbers_japanese_">
17
+ <xsl:copy-of select="/*/jis:localized-strings/jis:localized-string[starts-with(@key,'0') or starts-with(@key,'1') or starts-with(@key,'2') or starts-with(@key,'3') or starts-with(@key,'4') or starts-with(@key,'5') or starts-with(@key,'6') or starts-with(@key,'7') or starts-with(@key,'8') or starts-with(@key,'9')]"/>
18
+ </xsl:variable>
19
+ <xsl:variable name="numbers_japanese" select="xalan:nodeset($numbers_japanese_)"/>
20
+
14
21
  <xsl:variable name="contents_">
15
22
  <xsl:variable name="bundle" select="count(//jis:jis-standard) &gt; 1"/>
16
23
 
@@ -428,9 +435,9 @@
428
435
  </xsl:if>
429
436
 
430
437
  <xsl:variable name="updated_xml_step0">
431
- <xsl:if test="$vertical_layout = 'true'">
432
- <xsl:apply-templates mode="update_xml_step0"/>
433
- </xsl:if>
438
+ <!-- <xsl:if test="$vertical_layout = 'true'"> -->
439
+ <xsl:apply-templates mode="update_xml_step0"/>
440
+ <!-- </xsl:if> -->
434
441
  </xsl:variable>
435
442
  <xsl:if test="$debug = 'true'">
436
443
  <redirect:write file="update_xml_step0.xml">
@@ -439,14 +446,15 @@
439
446
  </xsl:if>
440
447
 
441
448
  <xsl:variable name="updated_xml_step1">
442
- <xsl:choose>
449
+ <!-- <xsl:choose>
443
450
  <xsl:when test="$vertical_layout = 'true'">
444
451
  <xsl:apply-templates select="xalan:nodeset($updated_xml_step0)" mode="update_xml_step1"/>
445
452
  </xsl:when>
446
453
  <xsl:otherwise>
447
454
  <xsl:apply-templates mode="update_xml_step1"/>
448
455
  </xsl:otherwise>
449
- </xsl:choose>
456
+ </xsl:choose> -->
457
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step0)" mode="update_xml_step1"/>
450
458
  </xsl:variable>
451
459
  <!-- DEBUG: updated_xml_step1=<xsl:copy-of select="$updated_xml_step1"/> -->
452
460
  <xsl:if test="$debug = 'true'">
@@ -492,13 +500,18 @@
492
500
  <xsl:apply-templates select="xalan:nodeset($docidentifier__)/node()"/>
493
501
  </xsl:variable>
494
502
 
495
- <xsl:variable name="copyrightText">
496
- <xsl:call-template name="getLocalizedString">
497
- <xsl:with-param name="key">permission_footer</xsl:with-param>
498
- <xsl:with-param name="formatted" select="$vertical_layout"/> <!-- $vertical_layout = 'true' -->
499
- <xsl:with-param name="bibdata_updated" select="/*/jis:bibdata"/> <!-- $vertical_layout = 'true' -->
500
- </xsl:call-template>
503
+ <xsl:variable name="copyrightText_">
504
+ <xsl:variable name="backpage_boilerplate_text" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:backpage-boilerplate-text)"/>
505
+ <xsl:value-of select="$backpage_boilerplate_text"/>
506
+ <xsl:if test="$backpage_boilerplate_text = ''">
507
+ <xsl:call-template name="getLocalizedString">
508
+ <xsl:with-param name="key">permission_footer</xsl:with-param>
509
+ <xsl:with-param name="formatted" select="$vertical_layout"/> <!-- $vertical_layout = 'true' -->
510
+ <xsl:with-param name="bibdata_updated" select="/*/jis:bibdata"/> <!-- $vertical_layout = 'true' -->
511
+ </xsl:call-template>
512
+ </xsl:if>
501
513
  </xsl:variable>
514
+ <xsl:variable name="copyrightText" select="normalize-space($copyrightText_)"/>
502
515
 
503
516
  <xsl:variable name="doctype" select="/*/jis:bibdata/jis:ext/jis:doctype"/>
504
517
 
@@ -530,18 +543,21 @@
530
543
  <xsl:when test="$vertical_layout = 'true'">
531
544
  <xsl:call-template name="insertCoverPage2024">
532
545
  <xsl:with-param name="num" select="$num"/>
546
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
533
547
  </xsl:call-template>
534
548
  </xsl:when>
535
549
  <xsl:when test="$doctype = 'technical-specification'">
536
550
  <xsl:call-template name="insertCoverPageJSA">
537
551
  <xsl:with-param name="num" select="$num"/>
538
552
  <xsl:with-param name="doclang" select="$doclang"/>
553
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
539
554
  </xsl:call-template>
540
555
  </xsl:when>
541
556
  <xsl:otherwise>
542
557
  <xsl:call-template name="insertCoverPage">
543
558
  <xsl:with-param name="num" select="$num"/>
544
559
  <xsl:with-param name="copyrightText" select="$copyrightText"/>
560
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
545
561
  </xsl:call-template>
546
562
  </xsl:otherwise>
547
563
  </xsl:choose>
@@ -585,6 +601,7 @@
585
601
  <xsl:with-param name="title_ja" select="$title_ja"/>
586
602
  <xsl:with-param name="i18n_JIS" select="$i18n_JIS"/>
587
603
  <xsl:with-param name="docidentifier" select="concat('JIS ', $docidentifier_JIS)"/>
604
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
588
605
  <xsl:with-param name="edition" select="$edition"/>
589
606
  <xsl:with-param name="copyrightText">
590
607
  <xsl:copy-of select="$copyrightText"/>
@@ -660,6 +677,7 @@
660
677
  <xsl:with-param name="title_ja" select="$title_ja"/>
661
678
  <xsl:with-param name="i18n_JIS" select="$i18n_JIS"/>
662
679
  <xsl:with-param name="docidentifier" select="concat('JIS ', $docidentifier_JIS)"/>
680
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
663
681
  <xsl:with-param name="edition" select="$edition"/>
664
682
  <xsl:with-param name="copyrightText">
665
683
  <xsl:copy-of select="$copyrightText"/>
@@ -855,6 +873,7 @@
855
873
  <xsl:with-param name="title_ja" select="$title_ja"/>
856
874
  <xsl:with-param name="i18n_JIS" select="$i18n_JIS"/>
857
875
  <xsl:with-param name="docidentifier" select="concat('JIS ', $docidentifier_JIS)"/>
876
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
858
877
  <xsl:with-param name="edition" select="$edition"/>
859
878
  <xsl:with-param name="copyrightText">
860
879
  <xsl:copy-of select="$copyrightText"/>
@@ -954,6 +973,7 @@
954
973
  <xsl:with-param name="num" select="$num"/>
955
974
  <xsl:with-param name="doclang" select="'en'"/>
956
975
  <xsl:with-param name="first">false</xsl:with-param>
976
+ <xsl:with-param name="docidentifier_jis" select="$docidentifier_JIS_"/>
957
977
  </xsl:call-template>
958
978
  </xsl:if>
959
979
 
@@ -1081,18 +1101,18 @@
1081
1101
  <xsl:attribute name="text-align">left</xsl:attribute>
1082
1102
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1083
1103
  <!-- <xsl:attribute name="margin-top">26mm</xsl:attribute> -->
1104
+ <!-- Contents -->
1105
+ <!-- <xsl:call-template name="getLocalizedString">
1106
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1107
+ </xsl:call-template> -->
1108
+ <fo:marker marker-class-name="section_title">
1109
+ <xsl:variable name="section_title_"><xsl:apply-templates/></xsl:variable>
1110
+ <xsl:variable name="section_title" select="translate($section_title_, ' ', '')"/>
1111
+ <xsl:call-template name="insertVerticalChar">
1112
+ <xsl:with-param name="str" select="$section_title"/>
1113
+ </xsl:call-template>
1114
+ </fo:marker>
1084
1115
  </xsl:if>
1085
- <!-- Contents -->
1086
- <!-- <xsl:call-template name="getLocalizedString">
1087
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
1088
- </xsl:call-template> -->
1089
- <fo:marker marker-class-name="section_title">
1090
- <xsl:variable name="section_title_"><xsl:apply-templates/></xsl:variable>
1091
- <xsl:variable name="section_title" select="translate($section_title_, ' ', '')"/>
1092
- <xsl:call-template name="insertVerticalChar">
1093
- <xsl:with-param name="str" select="$section_title"/>
1094
- </xsl:call-template>
1095
- </fo:marker>
1096
1116
  <xsl:apply-templates/>
1097
1117
  </fo:block>
1098
1118
  <fo:block text-align="right" margin-top="10mm">
@@ -1114,7 +1134,7 @@
1114
1134
 
1115
1135
  <xsl:template name="insertTocItem">
1116
1136
  <fo:block text-align-last="justify" role="SKIP">
1117
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1137
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{normalize-space(title)}">
1118
1138
  <fo:inline>
1119
1139
  <xsl:if test="$vertical_layout = 'true'">
1120
1140
  <xsl:attribute name="padding-right">7.5mm</xsl:attribute>
@@ -1144,13 +1164,15 @@
1144
1164
  </fo:block>
1145
1165
  </xsl:template>
1146
1166
 
1147
- <!-- docidentifier, 3 part: number, colon and year-->
1148
- <xsl:variable name="docidentifier_jis" select="/*/jis:bibdata/jis:docidentifier[@type = 'JIS']"/>
1149
- <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$1')"/>
1150
- <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$3')"/>
1151
1167
  <xsl:template name="insertCoverPage">
1152
1168
  <xsl:param name="num"/>
1153
1169
  <xsl:param name="copyrightText"/>
1170
+ <xsl:param name="docidentifier_jis"/>
1171
+
1172
+ <!-- docidentifier, 3 part: number, colon and year-->
1173
+ <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$1')"/>
1174
+ <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$3')"/>
1175
+
1154
1176
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
1155
1177
  <xsl:call-template name="insertFooter">
1156
1178
  <xsl:with-param name="copyrightText" select="$copyrightText"/>
@@ -1158,10 +1180,15 @@
1158
1180
 
1159
1181
  <fo:flow flow-name="xsl-region-body">
1160
1182
  <!-- JIS -->
1161
- <fo:block id="firstpage_id_{$num}">
1162
- <fo:instream-foreign-object content-width="81mm" fox:alt-text="JIS Logo">
1163
- <xsl:copy-of select="$JIS-Logo"/>
1164
- </fo:instream-foreign-object>
1183
+ <fo:block>
1184
+ <xsl:if test="$num = 1">
1185
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
1186
+ </xsl:if>
1187
+ <fo:block id="firstpage_id_{$num}">
1188
+ <fo:instream-foreign-object content-width="81mm" fox:alt-text="JIS Logo">
1189
+ <xsl:copy-of select="$JIS-Logo"/>
1190
+ </fo:instream-foreign-object>
1191
+ </fo:block>
1165
1192
  </fo:block>
1166
1193
 
1167
1194
  <fo:block-container text-align="center">
@@ -1199,6 +1226,8 @@
1199
1226
  <xsl:param name="num"/>
1200
1227
  <xsl:param name="doclang"/>
1201
1228
  <xsl:param name="first">true</xsl:param>
1229
+ <xsl:param name="docidentifier_jis"/>
1230
+
1202
1231
  <fo:page-sequence master-reference="cover-page-JSA" force-page-count="no-force">
1203
1232
  <fo:static-content flow-name="footer" font-family="IPAexGothic" font-size="10pt" line-height="1.7">
1204
1233
  <fo:block text-align="center">
@@ -1240,7 +1269,7 @@
1240
1269
 
1241
1270
  <fo:block-container text-align="center">
1242
1271
  <fo:block font-family="IPAexGothic" font-size="15pt">
1243
- <xsl:value-of select="/*/jis:bibdata/jis:docidentifier[@type = 'JIS']"/>
1272
+ <xsl:value-of select="$docidentifier_jis"/>
1244
1273
  </fo:block>
1245
1274
  <!-- title -->
1246
1275
  <fo:block role="H1" font-family="IPAexGothic" font-size="32pt" line-height="1.3">
@@ -1257,9 +1286,22 @@
1257
1286
  </fo:page-sequence>
1258
1287
  </xsl:template> <!-- insertCoverPageJSA -->
1259
1288
 
1260
- <xsl:variable name="i18n_JIS"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">JIS</xsl:with-param></xsl:call-template></xsl:variable>
1289
+ <xsl:variable name="i18n_JIS_">
1290
+ <xsl:variable name="coverpage_header" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:coverpage-header)"/>
1291
+ <xsl:value-of select="$coverpage_header"/>
1292
+ <xsl:if test="$coverpage_header = ''">
1293
+ <xsl:call-template name="getLocalizedString"><xsl:with-param name="key">JIS</xsl:with-param></xsl:call-template>
1294
+ </xsl:if>
1295
+ </xsl:variable>
1296
+ <xsl:variable name="i18n_JIS" select="normalize-space($i18n_JIS_)"/>
1297
+
1261
1298
  <xsl:template name="insertCoverPage2024">
1262
1299
  <xsl:param name="num"/>
1300
+ <xsl:param name="docidentifier_jis"/>
1301
+
1302
+ <!-- docidentifier, 3 part: number, colon and year-->
1303
+ <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$1')"/>
1304
+ <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$3')"/>
1263
1305
 
1264
1306
  <fo:page-sequence master-reference="cover-page_2024" force-page-count="no-force">
1265
1307
 
@@ -1322,23 +1364,25 @@
1322
1364
  <fo:table-column column-width="proportional-column-width(3)"/>
1323
1365
  <fo:table-column column-width="proportional-column-width(2.2)"/>
1324
1366
  <fo:table-column column-width="proportional-column-width(3)"/>
1367
+ <xsl:variable name="publisher" select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'publisher']/jis:organization/jis:name/jis:variant[@language = 'ja']"/>
1368
+ <xsl:variable name="authorizer" select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'authorizer']//jis:organization/jis:name"/>
1325
1369
  <fo:table-body>
1326
1370
  <fo:table-row height="50mm">
1327
1371
  <fo:table-cell>
1328
- <fo:block><xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'publisher']/jis:organization/jis:name/jis:variant[@language = 'ja']"/></fo:block>
1372
+ <fo:block><xsl:value-of select="$publisher"/></fo:block>
1329
1373
  </fo:table-cell>
1330
1374
  <fo:table-cell><fo:block> </fo:block></fo:table-cell>
1331
1375
  <fo:table-cell>
1332
- <fo:block><xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'authorizer']//jis:organization/jis:name"/></fo:block>
1376
+ <fo:block><xsl:value-of select="$authorizer"/></fo:block>
1333
1377
  </fo:table-cell>
1334
1378
  </fo:table-row>
1335
1379
  <fo:table-row>
1336
1380
  <fo:table-cell>
1337
- <fo:block>発行</fo:block>
1381
+ <fo:block><xsl:if test="normalize-space($publisher) != ''">発行</xsl:if></fo:block>
1338
1382
  </fo:table-cell>
1339
1383
  <fo:table-cell><fo:block> </fo:block></fo:table-cell>
1340
1384
  <fo:table-cell>
1341
- <fo:block>審議</fo:block>
1385
+ <fo:block><xsl:if test="normalize-space($authorizer) != ''">審議</xsl:if></fo:block>
1342
1386
  </fo:table-cell>
1343
1387
  </fo:table-row>
1344
1388
  </fo:table-body>
@@ -1427,7 +1471,8 @@
1427
1471
  </fo:block>
1428
1472
 
1429
1473
  <fo:block margin-top="6.5mm" font-size="8pt" font-weight="500">
1430
- <fo:inline padding-right="5mm"><xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'published']/text()"/></fo:inline>改正
1474
+ <xsl:variable name="revised_date"><xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'revised']/text()"/></xsl:variable>
1475
+ <xsl:if test="normalize-space($revised_date) != ''"><fo:inline padding-right="5mm"><xsl:copy-of select="$revised_date"/></fo:inline>改正</xsl:if>
1431
1476
  </fo:block>
1432
1477
 
1433
1478
  </fo:flow>
@@ -1456,19 +1501,31 @@
1456
1501
  <fo:flow flow-name="xsl-region-body">
1457
1502
  <!-- publication date -->
1458
1503
  <fo:block font-size="8pt" margin-left="90mm" text-align-last="justify" letter-spacing="0.5mm">
1459
- <xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'published']/text()"/>
1460
- <fo:inline keep-together.within-line="always">
1461
- <fo:leader leader-pattern="space"/>
1462
- <xsl:text>発行</xsl:text>
1463
- </fo:inline>
1504
+ <xsl:variable name="date_published"><xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'published']/text()"/></xsl:variable>
1505
+ <xsl:copy-of select="$date_published"/>
1506
+ <xsl:choose>
1507
+ <xsl:when test="normalize-space($date_published) != ''">
1508
+ <fo:inline keep-together.within-line="always">
1509
+ <fo:leader leader-pattern="space"/>
1510
+ <xsl:text>発行</xsl:text>
1511
+ </fo:inline>
1512
+ </xsl:when>
1513
+ <xsl:otherwise> </xsl:otherwise>
1514
+ </xsl:choose>
1464
1515
  </fo:block>
1465
1516
  <!-- revision date -->
1466
1517
  <fo:block font-size="8pt" margin-left="90mm" text-align-last="justify" letter-spacing="0.5mm">
1467
- <xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'revised']/text()"/>
1468
- <fo:inline keep-together.within-line="always">
1469
- <fo:leader leader-pattern="space"/>
1470
- <xsl:text>改正</xsl:text>
1471
- </fo:inline>
1518
+ <xsl:variable name="date_revised"><xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'revised']/text()"/></xsl:variable>
1519
+ <xsl:copy-of select="$date_revised"/>
1520
+ <xsl:choose>
1521
+ <xsl:when test="normalize-space($date_revised) != ''">
1522
+ <fo:inline keep-together.within-line="always">
1523
+ <fo:leader leader-pattern="space"/>
1524
+ <xsl:text>改正</xsl:text>
1525
+ </fo:inline>
1526
+ </xsl:when>
1527
+ <xsl:otherwise> </xsl:otherwise>
1528
+ </xsl:choose>
1472
1529
  </fo:block>
1473
1530
  <fo:block font-size="12pt" margin-top="7mm" text-align="right">
1474
1531
  <!-- <xsl:value-of select="$copyrightText"/> -->
@@ -1941,7 +1998,7 @@
1941
1998
  <xsl:call-template name="extractSection"/>
1942
1999
  </xsl:variable>
1943
2000
 
1944
- <xsl:if test="$level = 1">
2001
+ <xsl:if test="$level = 1 and $vertical_layout = 'true'">
1945
2002
  <fo:marker marker-class-name="section_title">
1946
2003
  <xsl:choose>
1947
2004
  <xsl:when test="@ancestor = 'annex' and *[local-name() = 'br']">
@@ -2420,58 +2477,78 @@
2420
2477
  <xsl:value-of select="$text10"/>
2421
2478
  </xsl:template>
2422
2479
 
2480
+ <!-- enclose surrogate pair characters into the tag 'spair' -->
2481
+ <xsl:variable name="element_name_spair">spair</xsl:variable>
2482
+ <xsl:variable name="tag_spair_open">###<xsl:value-of select="$element_name_spair"/>###</xsl:variable>
2483
+ <xsl:variable name="tag_spair_close">###/<xsl:value-of select="$element_name_spair"/>###</xsl:variable>
2484
+
2423
2485
  <!-- replace horizontal to vertical oriented character -->
2424
2486
  <xsl:template match="text()" mode="update_xml_step0" name="replace_horizontal_to_vertical_form">
2425
2487
  <xsl:param name="text" select="."/>
2426
- <xsl:choose>
2427
- <xsl:when test="$isGenerateTableIF = 'false'">
2428
- <!-- from https://github.com/metanorma/docs/blob/main/109.adoc -->
2429
- <!--
2430
- U+3001 IDEOGRAPHIC COMMA (、)
2431
- to
2432
- U+FE11 PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (︑)
2433
-
2434
- U+FE50 SMALL COMMA (﹐)
2435
- to
2436
- U+FE10 PRESENTATION FORM FOR VERTICAL COMMA (︐)
2437
-
2438
- U+FE51 SMALL IDEOGRAPHIC COMMA (﹑)
2439
- to
2440
- U+FE11 PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (︑)
2441
-
2442
- U+FF0C FULLWIDTH COMMA (,)
2443
- to
2444
- U+FE10 PRESENTATION FORM FOR VERTICAL COMMA (︐)
2445
- -->
2446
- <xsl:variable name="text1" select="translate($text,'、﹐﹑,','︑︐︑︐')"/>
2488
+ <xsl:variable name="text_replaced">
2489
+ <xsl:choose>
2490
+ <xsl:when test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
2491
+ <!-- from https://github.com/metanorma/docs/blob/main/109.adoc -->
2492
+ <!--
2493
+ U+3001 IDEOGRAPHIC COMMA (、)
2494
+ to
2495
+ U+FE11 PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (︑)
2496
+
2497
+ U+FE50 SMALL COMMA (﹐)
2498
+ to
2499
+ U+FE10 PRESENTATION FORM FOR VERTICAL COMMA (︐)
2500
+
2501
+ U+FE51 SMALL IDEOGRAPHIC COMMA (﹑)
2502
+ to
2503
+ U+FE11 PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (︑)
2504
+
2505
+ U+FF0C FULLWIDTH COMMA (,)
2506
+ to
2507
+ U+FE10 PRESENTATION FORM FOR VERTICAL COMMA (︐)
2508
+ -->
2509
+ <xsl:variable name="text1" select="translate($text,'、﹐﹑,','︑︐︑︐')"/>
2447
2510
 
2448
- <!--
2449
- U+FF1A FULLWIDTH COLON (:)
2450
- to
2451
- U+FE13 PRESENTATION FORM FOR VERTICAL COLON (︓)
2452
-
2453
- U+FF1B FULLWIDTH SEMICOLON (;)
2454
- to
2455
- U+FE14 PRESENTATION FORM FOR VERTICAL SEMICOLON (︔)
2456
- -->
2457
- <xsl:variable name="text2" select="translate($text1,':;','︓︔')"/>
2511
+ <!--
2512
+ U+FF1A FULLWIDTH COLON (:)
2513
+ to
2514
+ U+FE13 PRESENTATION FORM FOR VERTICAL COLON (︓)
2515
+
2516
+ U+FF1B FULLWIDTH SEMICOLON (;)
2517
+ to
2518
+ U+FE14 PRESENTATION FORM FOR VERTICAL SEMICOLON (︔)
2519
+ -->
2520
+ <xsl:variable name="text2" select="translate($text1,':;','︓︔')"/>
2521
+
2522
+ <!--
2523
+ U+FF01 FULLWIDTH EXCLAMATION MARK (!)
2524
+ to
2525
+ U+FE15 PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK (︕)
2526
+
2527
+ U+FF1F FULLWIDTH QUESTION MARK (?)
2528
+ to
2529
+ U+FE16 PRESENTATION FORM FOR VERTICAL QUESTION MARK (︖)
2530
+ -->
2531
+ <xsl:variable name="text3" select="translate($text2,'!?','︕︖')"/>
2532
+ <xsl:value-of select="$text3"/>
2533
+ </xsl:when>
2534
+ <xsl:otherwise>
2535
+ <xsl:value-of select="$text"/>
2536
+ </xsl:otherwise>
2537
+ </xsl:choose>
2538
+ </xsl:variable>
2539
+
2540
+ <xsl:variable name="text_spair_" select="java:replaceAll(java:java.lang.String.new($text_replaced), $regex_surrogate_pairs, concat($tag_spair_open,'$1',$tag_spair_close))"/>
2541
+ <xsl:variable name="text_spair">
2542
+ <xsl:element name="text" namespace="{$namespace_full}">
2543
+ <xsl:call-template name="replace_text_tags">
2544
+ <xsl:with-param name="tag_open" select="$tag_spair_open"/>
2545
+ <xsl:with-param name="tag_close" select="$tag_spair_close"/>
2546
+ <xsl:with-param name="text" select="$text_spair_"/>
2547
+ </xsl:call-template>
2548
+ </xsl:element>
2549
+ </xsl:variable>
2550
+ <xsl:copy-of select="xalan:nodeset($text_spair)/*[local-name() = 'text']/node()"/>
2458
2551
 
2459
- <!--
2460
- U+FF01 FULLWIDTH EXCLAMATION MARK (!)
2461
- to
2462
- U+FE15 PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK (︕)
2463
-
2464
- U+FF1F FULLWIDTH QUESTION MARK (?)
2465
- to
2466
- U+FE16 PRESENTATION FORM FOR VERTICAL QUESTION MARK (︖)
2467
- -->
2468
- <xsl:variable name="text3" select="translate($text2,'!?','︕︖')"/>
2469
- <xsl:value-of select="$text3"/>
2470
- </xsl:when>
2471
- <xsl:otherwise>
2472
- <xsl:value-of select="$text"/>
2473
- </xsl:otherwise>
2474
- </xsl:choose>
2475
2552
  </xsl:template>
2476
2553
 
2477
2554
  <!-- =========================================================================== -->
@@ -2589,8 +2666,12 @@
2589
2666
  <xsl:copy-of select="."/>
2590
2667
  </xsl:template>
2591
2668
 
2669
+ <!-- https://github.com/metanorma/laozi/issues/8 -->
2670
+ <xsl:variable name="surrogate_pairs">\ud800\udc00-\udbff\udfff\ud800-\udfff</xsl:variable>
2671
+ <xsl:variable name="regex_surrogate_pairs">([<xsl:value-of select="$surrogate_pairs"/>])</xsl:variable>
2672
+
2592
2673
  <!-- if vertical_layout = 'true', then font_en and font_en_bold are using for text rotation -->
2593
- <xsl:variable name="regex_en_base">\u00A0\u2002-\u200B\u3000-\u9FFF\uF900-\uFFFF</xsl:variable>
2674
+ <xsl:variable name="regex_en_base">\u00A0\u2002-\u200B\u3000-\u9FFF\uF900-\uFFFF<xsl:value-of select="$surrogate_pairs"/></xsl:variable>
2594
2675
  <xsl:variable name="regex_en_">
2595
2676
  <xsl:choose>
2596
2677
  <!-- ( ) [ ] _ { } U+FF08 FULLWIDTH LEFT PARENTHESIS U+FF09 FULLWIDTH RIGHT PARENTHESIS-->
@@ -3030,6 +3111,10 @@
3030
3111
  <!-- END: Allocate non-Japanese text -->
3031
3112
  <!-- ========================= -->
3032
3113
 
3114
+ <xsl:template match="*[local-name() = 'spair'][normalize-space() != '']">
3115
+ <fo:inline><xsl:apply-templates/></fo:inline>
3116
+ </xsl:template>
3117
+
3033
3118
  <!-- patch for correct list-item-label rendering: enclose each char in inline-container -->
3034
3119
  <xsl:template match="*[local-name() = 'note' or local-name() = 'example']/*[local-name() = 'name']/text()" priority="3">
3035
3120
  <xsl:choose>
@@ -3201,12 +3286,17 @@
3201
3286
  <xsl:param name="cover_header_footer_background"/>
3202
3287
  <xsl:param name="i18n_JIS"/>
3203
3288
  <xsl:param name="docidentifier"/>
3289
+ <xsl:param name="docidentifier_jis"/>
3204
3290
  <xsl:param name="title_ja"/>
3205
3291
  <xsl:param name="edition"/>
3206
3292
  <xsl:param name="copyrightText"/>
3207
3293
  <xsl:param name="insertLast"/>
3208
3294
  <xsl:param name="bibdata"/>
3209
3295
 
3296
+ <!-- docidentifier, 3 part: number, colon and year-->
3297
+ <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$1')"/>
3298
+ <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier_jis), '^(.*)(:)(.*)$', '$3')"/>
3299
+
3210
3300
  <!-- header -->
3211
3301
  <fo:static-content flow-name="right-region" role="artifact">
3212
3302
  <fo:block-container font-size="9pt" height="{$pageHeightA5}mm" width="6mm" color="white" background-color="{$cover_header_footer_background}" text-align="center" margin-left="11mm">
@@ -5424,8 +5514,21 @@
5424
5514
 
5425
5515
  <!-- <xsl:strip-space elements="jis:xref"/> -->
5426
5516
 
5427
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
5428
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
5517
+ <xsl:variable name="namespace_full_">
5518
+ <xsl:choose>
5519
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
5520
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
5521
+ </xsl:choose>
5522
+ </xsl:variable>
5523
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
5524
+
5525
+ <xsl:variable name="root_element_">
5526
+ <xsl:choose>
5527
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
5528
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
5529
+ </xsl:choose>
5530
+ </xsl:variable>
5531
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
5429
5532
 
5430
5533
  <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
5431
5534
 
@@ -6696,6 +6799,9 @@
6696
6799
 
6697
6800
  </xsl:attribute-set>
6698
6801
 
6802
+ <xsl:attribute-set name="related-block-style" use-attribute-sets="preferred-block-style">
6803
+ </xsl:attribute-set>
6804
+
6699
6805
  <xsl:attribute-set name="definition-style">
6700
6806
 
6701
6807
  <xsl:attribute name="space-before">2pt</xsl:attribute>
@@ -6853,6 +6959,10 @@
6853
6959
  <xsl:if test="not($vertical_layout = 'true')">
6854
6960
  <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
6855
6961
  </xsl:if>
6962
+ <xsl:if test="$vertical_layout = 'true'">
6963
+ <xsl:attribute name="vertical-align">baseline</xsl:attribute>
6964
+ <xsl:attribute name="font-size">100%</xsl:attribute>
6965
+ </xsl:if>
6856
6966
 
6857
6967
  </xsl:template> <!-- refine_fn-body-num-style -->
6858
6968
 
@@ -8886,9 +8996,14 @@
8886
8996
  </xsl:variable>
8887
8997
  <xsl:variable name="current_fn_number_text">
8888
8998
 
8889
- <xsl:value-of select="$current_fn_number"/>
8890
-
8891
- <fo:inline font-weight="normal">)</fo:inline>
8999
+ <xsl:choose>
9000
+ <xsl:when test="$autonumbering_style = 'japanese'">
9001
+ <xsl:text></xsl:text>
9002
+ <xsl:value-of select="$numbers_japanese//jis:localized-string[@key = $current_fn_number]"/>
9003
+ <xsl:text> </xsl:text>
9004
+ </xsl:when>
9005
+ <xsl:otherwise><xsl:value-of select="$current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></xsl:otherwise>
9006
+ </xsl:choose>
8892
9007
 
8893
9008
  </xsl:variable>
8894
9009
 
@@ -8920,6 +9035,11 @@
8920
9035
  <xsl:if test="not($vertical_layout = 'true')">
8921
9036
  <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
8922
9037
  </xsl:if>
9038
+ <xsl:if test="$vertical_layout = 'true'">
9039
+ <xsl:attribute name="vertical-align">baseline</xsl:attribute>
9040
+ <xsl:attribute name="font-size">80%</xsl:attribute>
9041
+ <xsl:attribute name="baseline-shift">20%</xsl:attribute>
9042
+ </xsl:if>
8923
9043
 
8924
9044
  </fn_styles>
8925
9045
  </xsl:otherwise>
@@ -8938,7 +9058,18 @@
8938
9058
  <xsl:with-param name="element">
8939
9059
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
8940
9060
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
9061
+
9062
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9063
+ <xsl:call-template name="insertVerticalChar">
9064
+ <xsl:with-param name="str" select="'〔'"/>
9065
+ </xsl:call-template>
9066
+
8941
9067
  <xsl:copy-of select="$current_fn_number_text"/>
9068
+
9069
+ <xsl:call-template name="insertVerticalChar">
9070
+ <xsl:with-param name="str" select="'〕'"/>
9071
+ </xsl:call-template>
9072
+
8942
9073
  </fo:inline>
8943
9074
  </fo:basic-link>
8944
9075
  </xsl:with-param>
@@ -8957,8 +9088,7 @@
8957
9088
 
8958
9089
  <fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">
8959
9090
 
8960
- <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
8961
-
9091
+ <xsl:variable name="fn_block">
8962
9092
  <xsl:call-template name="refine_fn-body-style"/>
8963
9093
 
8964
9094
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">
@@ -8966,9 +9096,51 @@
8966
9096
  <xsl:call-template name="refine_fn-body-num-style"/>
8967
9097
 
8968
9098
  <xsl:value-of select="$current_fn_number_text"/>
9099
+
8969
9100
  </fo:inline>
8970
9101
  <xsl:apply-templates/>
8971
- </fo:block>
9102
+ </xsl:variable>
9103
+
9104
+ <xsl:choose>
9105
+ <xsl:when test="$vertical_layout = 'true'">
9106
+ <fo:list-block xsl:use-attribute-sets="fn-body-style" role="SKIP" provisional-distance-between-starts="25mm">
9107
+ <xsl:call-template name="refine_fn-body-style"/>
9108
+ <fo:list-item role="SKIP">
9109
+ <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()" role="SKIP">
9110
+ <fo:block role="SKIP">
9111
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">
9112
+
9113
+ <xsl:call-template name="refine_fn-body-num-style"/>
9114
+
9115
+ <xsl:call-template name="insertVerticalChar">
9116
+ <xsl:with-param name="str" select="'〔'"/>
9117
+ </xsl:call-template>
9118
+
9119
+ <xsl:value-of select="$current_fn_number_text"/>
9120
+
9121
+ <xsl:call-template name="insertVerticalChar">
9122
+ <xsl:with-param name="str" select="'〕'"/>
9123
+ </xsl:call-template>
9124
+
9125
+ </fo:inline>
9126
+ </fo:block>
9127
+ </fo:list-item-label>
9128
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style" role="SKIP">
9129
+ <fo:block role="SKIP">
9130
+ <xsl:apply-templates/>
9131
+ </fo:block>
9132
+ </fo:list-item-body>
9133
+ </fo:list-item>
9134
+ </fo:list-block>
9135
+ </xsl:when>
9136
+ <xsl:otherwise>
9137
+ <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
9138
+ <xsl:copy-of select="$fn_block"/>
9139
+ </fo:block>
9140
+ </xsl:otherwise>
9141
+ </xsl:choose>
9142
+ <!-- jis -->
9143
+
8972
9144
  </fo:block-container>
8973
9145
  </fo:footnote-body>
8974
9146
  </fo:footnote>
@@ -10383,6 +10555,12 @@
10383
10555
  </xsl:if>
10384
10556
  </xsl:template>
10385
10557
 
10558
+ <xsl:template match="*[local-name()='strike']">
10559
+ <fo:inline text-decoration="line-through">
10560
+ <xsl:apply-templates/>
10561
+ </fo:inline>
10562
+ </xsl:template>
10563
+
10386
10564
  <xsl:template match="*[local-name() = 'pagebreak']">
10387
10565
  <fo:block break-after="page"/>
10388
10566
  <fo:block> </fo:block>
@@ -15016,14 +15194,17 @@
15016
15194
  </fo:block>
15017
15195
  </xsl:template>
15018
15196
 
15019
- <xsl:template match="*[local-name() = 'domain']">
15197
+ <!-- <xsl:template match="*[local-name() = 'domain']"> -->
15020
15198
  <!-- https://github.com/metanorma/isodoc/issues/607
15021
15199
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
15022
15200
  <xsl:text> </xsl:text> -->
15023
- <xsl:if test="not(@hidden = 'true')">
15201
+ <!-- <xsl:if test="not(@hidden = 'true')">
15024
15202
  <xsl:apply-templates/>
15025
15203
  </xsl:if>
15026
- </xsl:template>
15204
+ </xsl:template> -->
15205
+
15206
+ <!-- https://github.com/metanorma/isodoc/issues/632#issuecomment-2567163931 -->
15207
+ <xsl:template match="*[local-name() = 'domain']"/>
15027
15208
 
15028
15209
  <xsl:template match="*[local-name() = 'admitted']">
15029
15210
  <fo:block xsl:use-attribute-sets="admitted-style">
@@ -15038,9 +15219,11 @@
15038
15219
  </xsl:template>
15039
15220
 
15040
15221
  <xsl:template name="setStyle_preferred">
15041
- <xsl:if test="*[local-name() = 'strong']">
15042
- <xsl:attribute name="font-weight">normal</xsl:attribute>
15043
- </xsl:if>
15222
+
15223
+ <xsl:if test="*[local-name() = 'strong']">
15224
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
15225
+ </xsl:if>
15226
+
15044
15227
  </xsl:template>
15045
15228
 
15046
15229
  <!-- regarding ISO 10241-1:2011, If there is more than one preferred term, each preferred term follows the previous one on a new line. -->
@@ -15050,6 +15233,17 @@
15050
15233
  </xsl:template>
15051
15234
  <!-- End Preferred, admitted, deprecated -->
15052
15235
 
15236
+ <xsl:template match="*[local-name() = 'fmt-related']">
15237
+ <fo:block role="SKIP" xsl:use-attribute-sets="related-block-style">
15238
+ <xsl:apply-templates/>
15239
+ </fo:block>
15240
+ </xsl:template>
15241
+ <xsl:template match="*[local-name() = 'fmt-related']/*[local-name() = 'p']" priority="4">
15242
+ <fo:block>
15243
+ <xsl:apply-templates/>
15244
+ </fo:block>
15245
+ </xsl:template>
15246
+
15053
15247
  <!-- ========== -->
15054
15248
  <!-- definition -->
15055
15249
  <!-- ========== -->
@@ -15990,6 +16184,7 @@
15990
16184
 
15991
16185
  <!-- Normative references -->
15992
16186
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
16187
+ <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
15993
16188
 
15994
16189
  <fo:block-container margin-left="6mm" role="SKIP">
15995
16190
  <fo:block-container margin-left="0mm" role="SKIP">
@@ -16711,7 +16906,8 @@
16711
16906
  <!-- add @id - first element with @id plus '_element_name' -->
16712
16907
  <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
16713
16908
  <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
16714
- <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
16909
+ <xsl:variable name="document_suffix" select="ancestor::*[contains(local-name(), '-standard')]/@document_suffix"/>
16910
+ <xsl:attribute name="id"><xsl:value-of select="concat($prefix_id, '_', local-name(), '_', $document_suffix)"/></xsl:attribute>
16715
16911
  </xsl:if>
16716
16912
  </xsl:template>
16717
16913
 
@@ -16768,6 +16964,31 @@
16768
16964
  <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
16769
16965
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
16770
16966
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
16967
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_step1"/> -->
16968
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_step1"/>
16969
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_pres"/> -->
16970
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_pres"/>
16971
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_step1"/> -->
16972
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_step1"/>
16973
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_pres"/> -->
16974
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_pres"/>
16975
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_step1"/> -->
16976
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_step1"/>
16977
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_step1"/>
16978
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_pres"/> -->
16979
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_pres"/>
16980
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_pres"/>
16981
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_step1"/> -->
16982
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_step1"/>
16983
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_pres"/> -->
16984
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_pres"/>
16985
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_step1"/> -->
16986
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_step1"/>
16987
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_pres"/> -->
16988
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_pres"/>
16989
+
16990
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_step1"/>
16991
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_pres"/>
16771
16992
 
16772
16993
  <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
16773
16994
  <xsl:copy>
@@ -16812,6 +17033,94 @@
16812
17033
  </xsl:element>
16813
17034
  </xsl:template>
16814
17035
 
17036
+ <xsl:template match="*[local-name() = 'fmt-preferred']"/>
17037
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
17038
+ <xsl:apply-templates mode="update_xml_step1"/>
17039
+ </xsl:template>
17040
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_step1">
17041
+ <xsl:element name="preferred" namespace="{$namespace_full}">
17042
+ <xsl:copy-of select="@*"/>
17043
+ <xsl:apply-templates mode="update_xml_step1"/>
17044
+ </xsl:element>
17045
+ </xsl:template>
17046
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_pres">
17047
+ <xsl:apply-templates mode="update_xml_pres"/>
17048
+ </xsl:template>
17049
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_pres">
17050
+ <xsl:element name="preferred" namespace="{$namespace_full}">
17051
+ <xsl:copy-of select="@*"/>
17052
+ <xsl:apply-templates mode="update_xml_pres"/>
17053
+ </xsl:element>
17054
+ </xsl:template>
17055
+
17056
+ <xsl:template match="*[local-name() = 'fmt-admitted']"/>
17057
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_step1">
17058
+ <xsl:apply-templates mode="update_xml_step1"/>
17059
+ </xsl:template>
17060
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_step1">
17061
+ <xsl:element name="admitted" namespace="{$namespace_full}">
17062
+ <xsl:copy-of select="@*"/>
17063
+ <xsl:apply-templates mode="update_xml_step1"/>
17064
+ </xsl:element>
17065
+ </xsl:template>
17066
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_pres">
17067
+ <xsl:apply-templates mode="update_xml_pres"/>
17068
+ </xsl:template>
17069
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_pres">
17070
+ <xsl:element name="admitted" namespace="{$namespace_full}">
17071
+ <xsl:copy-of select="@*"/>
17072
+ <xsl:apply-templates mode="update_xml_pres"/>
17073
+ </xsl:element>
17074
+ </xsl:template>
17075
+
17076
+ <xsl:template match="*[local-name() = 'fmt-deprecates']"/>
17077
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_step1">
17078
+ <xsl:apply-templates mode="update_xml_step1"/>
17079
+ </xsl:template>
17080
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_step1">
17081
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
17082
+ <xsl:copy-of select="@*"/>
17083
+ <xsl:apply-templates mode="update_xml_step1"/>
17084
+ </xsl:element>
17085
+ </xsl:template>
17086
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_pres">
17087
+ <xsl:apply-templates mode="update_xml_pres"/>
17088
+ </xsl:template>
17089
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_pres">
17090
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
17091
+ <xsl:copy-of select="@*"/>
17092
+ <xsl:apply-templates mode="update_xml_pres"/>
17093
+ </xsl:element>
17094
+ </xsl:template>
17095
+
17096
+ <xsl:template match="*[local-name() = 'fmt-definition']"/>
17097
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_step1">
17098
+ <xsl:element name="definition" namespace="{$namespace_full}">
17099
+ <xsl:copy-of select="@*"/>
17100
+ <xsl:apply-templates mode="update_xml_step1"/>
17101
+ </xsl:element>
17102
+ </xsl:template>
17103
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_pres">
17104
+ <xsl:element name="definition" namespace="{$namespace_full}">
17105
+ <xsl:copy-of select="@*"/>
17106
+ <xsl:apply-templates mode="update_xml_pres"/>
17107
+ </xsl:element>
17108
+ </xsl:template>
17109
+
17110
+ <xsl:template match="*[local-name() = 'fmt-termsource']"/>
17111
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_step1">
17112
+ <xsl:element name="termsource" namespace="{$namespace_full}">
17113
+ <xsl:copy-of select="@*"/>
17114
+ <xsl:apply-templates mode="update_xml_step1"/>
17115
+ </xsl:element>
17116
+ </xsl:template>
17117
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_pres">
17118
+ <xsl:element name="termsource" namespace="{$namespace_full}">
17119
+ <xsl:copy-of select="@*"/>
17120
+ <xsl:apply-templates mode="update_xml_pres"/>
17121
+ </xsl:element>
17122
+ </xsl:template>
17123
+
16815
17124
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
16816
17125
  <xsl:apply-templates mode="update_xml_step1"/>
16817
17126
  </xsl:template>
@@ -18057,7 +18366,7 @@
18057
18366
  </xsl:template>
18058
18367
 
18059
18368
  <xsl:template name="namespaceCheck">
18060
- <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
18369
+ <xsl:variable name="documentNS" select="$namespace_full"/> <!-- namespace-uri(/*) -->
18061
18370
  <xsl:variable name="XSLNS">
18062
18371
 
18063
18372
  </xsl:variable>
@@ -18145,6 +18454,9 @@
18145
18454
  <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
18146
18455
  <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
18147
18456
  </xsl:when>
18457
+ <xsl:when test="string-length($bibdata_updated) != ''">
18458
+ <xsl:value-of select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
18459
+ </xsl:when>
18148
18460
  <xsl:when test="$formatted = 'true'">
18149
18461
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
18150
18462
  </xsl:when>
@@ -70,19 +70,19 @@ module IsoDoc
70
70
  end
71
71
 
72
72
  def move_participants(doc)
73
- p = doc.at(ns("//clause[@type = 'participants']")) or return
74
- t = participant_table(p) or return
75
- p.remove
76
- ins = make_preface(doc) or return nil
77
- ins.add_first_child t
73
+ doc.xpath(ns("//clause[@type = 'participants']")).reverse_each do |p|
74
+ t = participant_table(p) or next
75
+ p.remove
76
+ ins = make_preface(doc) or next
77
+ ins.add_first_child t
78
+ end
78
79
  end
79
80
 
80
81
  def participant_table(clause)
81
- s = clause.at(ns("./sourcecode")) or return nil
82
- y = YAML.safe_load(s.children.to_xml(encoding: "UTF-8")) or return nil
83
- y.is_a?(Array) or return nil
82
+ s, t, y, d = participant_table_prep(clause)
83
+ s or return nil
84
84
  out1 = <<~OUTPUT
85
- <clause id='_#{UUIDTools::UUID.random_create}'><title>#{@meta.get[:"investigative-committee"]} #{@i18n.membership_table}</title>
85
+ <clause id='_#{UUIDTools::UUID.random_create}' type="participants"><title>#{t}</title>
86
86
  <table unnumbered='true'>
87
87
  <thead>
88
88
  <tr><th/><th>#{@i18n.full_name}</th><th>#{@i18n.affiliation}</th></tr>
@@ -90,11 +90,21 @@ module IsoDoc
90
90
  <tbody>
91
91
  OUTPUT
92
92
  out2 = <<~OUTPUT
93
- </tbody></table></clause>
93
+ </tbody>#{d&.to_xml}</table></clause>
94
94
  OUTPUT
95
95
  "#{out1}#{participant_rows(y)}#{out2}"
96
96
  end
97
97
 
98
+ def participant_table_prep(clause)
99
+ s = clause.at(ns("./sourcecode"))
100
+ t = clause.at(ns("./title"))&.children&.to_xml ||
101
+ %(#{@meta.get[:"investigative-committee"]} #{@i18n.membership_table})
102
+ y = YAML.safe_load(s.children.to_xml(encoding: "UTF-8"))
103
+ d = clause.at(ns("./dl[@key = 'true']"))
104
+ s && y.is_a?(Array) or return [nil, nil, nil, nil]
105
+ [s, t, y, d]
106
+ end
107
+
98
108
  def participant_rows(yaml)
99
109
  yaml.map do |y|
100
110
  r = y["role"] ? @i18n.l10n("(#{y['role']})") : ""
@@ -42,7 +42,10 @@ module IsoDoc
42
42
  end
43
43
 
44
44
  def admits(elem)
45
- elem.children.first.previous = @i18n.l10n("#{@i18n.admitted}: ")
45
+ #elem.children.first.previous = @i18n.l10n("#{@i18n.admitted}: ")
46
+ elem.xpath(ns(".//semx[@element = 'admitted']")).each do |t|
47
+ t.previous = @i18n.l10n("#{@i18n.admitted}: ")
48
+ end
46
49
  end
47
50
 
48
51
  def dl(docxml)
@@ -76,6 +79,7 @@ module IsoDoc
76
79
 
77
80
  def dl_to_para_name(node)
78
81
  e = node.at(ns("./fmt-name")) or return ""
82
+ node.parent.parent["type"] == "participants" and return ""
79
83
  "<p class='ListTitle'>#{e.children.to_xml}</p>"
80
84
  end
81
85
 
@@ -126,6 +130,7 @@ module IsoDoc
126
130
  "<tr><td border='0' colspan='#{cols}'>#{elem}</td></tr>"
127
131
  end
128
132
 
133
+ # KILL
129
134
  def tablesource(elem)
130
135
  while elem&.next_element&.name == "source"
131
136
  elem << "; #{to_xml(elem.next_element.remove.children)}"
@@ -133,6 +138,20 @@ module IsoDoc
133
138
  elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
134
139
  end
135
140
 
141
+ # TODO preserve original Semantic XML source
142
+ def tablesource(elem)
143
+ ret = [semx_fmt_dup(elem)]
144
+ while elem&.next_element&.name == "source"
145
+ ret << semx_fmt_dup(elem.next_element.remove)
146
+ end
147
+ s = ret.map { |x| to_xml(x) }.map(&:strip).join("; ")
148
+ tablesource_label(elem, s)
149
+ end
150
+
151
+ def tablesource_label(elem, sources)
152
+ elem.children = l10n("#{@i18n.source}: #{sources}")
153
+ end
154
+
136
155
  def table_fn1(_table, fnote, _idx)
137
156
  fnote["reference"] += ")"
138
157
  end
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -1271,17 +1277,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1271
1277
  </define>
1272
1278
  <define name="validityBegins">
1273
1279
  <element name="validityBegins">
1274
- <ref name="ISO8601DateTime"/>
1280
+ <ref name="ISO8601Date"/>
1275
1281
  </element>
1276
1282
  </define>
1277
1283
  <define name="validityEnds">
1278
1284
  <element name="validityEnds">
1279
- <ref name="ISO8601DateTime"/>
1285
+ <ref name="ISO8601Date"/>
1280
1286
  </element>
1281
1287
  </define>
1282
1288
  <define name="validityRevision">
1283
1289
  <element name="revision">
1284
- <ref name="ISO8601DateTime"/>
1290
+ <ref name="ISO8601Date"/>
1285
1291
  </element>
1286
1292
  </define>
1287
1293
  <define name="TypedTitleString">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Jis
3
- VERSION = "0.4.3".freeze
3
+ VERSION = "0.4.5".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-23 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar
@@ -322,7 +322,7 @@ homepage: https://github.com/metanorma/metanorma-jis
322
322
  licenses:
323
323
  - BSD-2-Clause
324
324
  metadata: {}
325
- post_install_message:
325
+ post_install_message:
326
326
  rdoc_options: []
327
327
  require_paths:
328
328
  - lib
@@ -338,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  version: '0'
339
339
  requirements: []
340
340
  rubygems_version: 3.3.27
341
- signing_key:
341
+ signing_key:
342
342
  specification_version: 4
343
343
  summary: metanorma-jis lets you write JIS standards in AsciiDoc.
344
344
  test_files: []