metanorma-iec 2.5.3 → 2.5.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: 8e601a61dd0a3359b2038225f9fb50dacfb48d0a26b9f2f16337810f893d2553
4
- data.tar.gz: 718a96b97e8bf3ed54ef8d3c9b64569c77fca701d412fef1a1534629e16d4cac
3
+ metadata.gz: 0def60c7fba66d712bd162183c4085c2ecda4ef3cf89b45f0c5bf45f7c591136
4
+ data.tar.gz: 4f00862617ced725fd8a597a1defa7ef46e894b2cd451551ce61bd897efb1cba
5
5
  SHA512:
6
- metadata.gz: 41d137d1d2de28c1cbca08ee2ffc683e3e3ea87d7ff9ca81c0ab270206bf8e309b9bde6a64d40a615f3edecbd57fbd2d89fda105bd5b9d98ce9e5808da281d84
7
- data.tar.gz: dfe35f7ed429283b59142e1f19ff892d2a65908bdb85be257f33cd9c726376dd08e5444dfd66d42518949ade2b057cbd281193e53c85500a807d5aa423a61a64
6
+ metadata.gz: 430e64c30a07c13fc4d66afa564a036013568928ad7e83a29d8c60802bfc0ad665bc3a4d9345ab1481d731da89a25f7993be87da1c99cfcf6a7609cf98b9fbd7
7
+ data.tar.gz: d60935042f7e8d05196696dedea20260c3ec807994cca127a12e26c1662402aedf90b31755ee22b21624d2782ff1271450fc4397292fbb1984778a2a334322e3
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -1245,61 +1245,64 @@
1245
1245
  <xsl:attribute name="space-before">5pt</xsl:attribute>
1246
1246
  </xsl:if>
1247
1247
 
1248
- <fo:list-block>
1249
- <xsl:attribute name="margin-left">
1250
- <xsl:choose>
1251
- <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1252
- <xsl:when test="@level = 2">8mm</xsl:when>
1253
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1254
- <xsl:otherwise>0mm</xsl:otherwise>
1255
- </xsl:choose>
1256
- </xsl:attribute>
1257
- <xsl:attribute name="provisional-distance-between-starts">
1258
- <xsl:choose>
1259
- <xsl:when test="@section = ''">0mm</xsl:when>
1260
- <xsl:when test="@level = 1">8mm</xsl:when>
1261
- <xsl:when test="@level = 2">15mm</xsl:when>
1262
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1263
- <xsl:otherwise>0mm</xsl:otherwise>
1264
- </xsl:choose>
1265
- </xsl:attribute>
1266
- <fo:list-item>
1267
- <fo:list-item-label end-indent="label-end()">
1268
- <fo:block>
1269
- <xsl:value-of select="@section"/>
1270
- </fo:block>
1271
- </fo:list-item-label>
1272
- <fo:list-item-body start-indent="body-start()">
1273
- <fo:block text-align-last="justify">
1274
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1275
- <xsl:variable name="title">
1276
- <xsl:apply-templates select="title"/>
1277
- </xsl:variable>
1278
- <xsl:call-template name="addLetterSpacing">
1279
- <xsl:with-param name="text" select="$title"/>
1280
- </xsl:call-template>
1281
- <xsl:text> </xsl:text>
1282
- <fo:inline keep-together.within-line="always">
1283
- <fo:leader leader-pattern="dots"/>
1284
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1285
- </fo:inline>
1286
- </fo:basic-link>
1287
- </fo:block>
1288
- </fo:list-item-body>
1289
- </fo:list-item>
1290
- </fo:list-block>
1248
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section} {title}"> <!-- link at this level needs for PDF structure tags -->
1249
+
1250
+ <fo:list-block role="SKIP">
1251
+ <xsl:attribute name="margin-left">
1252
+ <xsl:choose>
1253
+ <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1254
+ <xsl:when test="@level = 2">8mm</xsl:when>
1255
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1256
+ <xsl:otherwise>0mm</xsl:otherwise>
1257
+ </xsl:choose>
1258
+ </xsl:attribute>
1259
+ <xsl:attribute name="provisional-distance-between-starts">
1260
+ <xsl:choose>
1261
+ <xsl:when test="@section = ''">0mm</xsl:when>
1262
+ <xsl:when test="@level = 1">8mm</xsl:when>
1263
+ <xsl:when test="@level = 2">15mm</xsl:when>
1264
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1265
+ <xsl:otherwise>0mm</xsl:otherwise>
1266
+ </xsl:choose>
1267
+ </xsl:attribute>
1268
+ <fo:list-item role="SKIP">
1269
+ <fo:list-item-label end-indent="label-end()" role="SKIP">
1270
+ <fo:block>
1271
+ <xsl:value-of select="@section"/>
1272
+ </fo:block>
1273
+ </fo:list-item-label>
1274
+ <fo:list-item-body start-indent="body-start()" role="SKIP">
1275
+ <fo:block text-align-last="justify" role="SKIP">
1276
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
1277
+ <xsl:variable name="title">
1278
+ <xsl:apply-templates select="title"/>
1279
+ </xsl:variable>
1280
+ <xsl:call-template name="addLetterSpacing">
1281
+ <xsl:with-param name="text" select="$title"/>
1282
+ </xsl:call-template>
1283
+ <xsl:text> </xsl:text>
1284
+ <fo:inline keep-together.within-line="always" role="SKIP">
1285
+ <fo:leader leader-pattern="dots"/>
1286
+ <fo:inline role="SKIP"><fo:wrapper role="artifact"><fo:page-number-citation ref-id="{@id}"/></fo:wrapper></fo:inline>
1287
+ </fo:inline>
1288
+ </fo:basic-link>
1289
+ </fo:block>
1290
+ </fo:list-item-body>
1291
+ </fo:list-item>
1292
+ </fo:list-block>
1293
+ </fo:basic-link>
1291
1294
  </fo:block>
1292
1295
  </xsl:for-each>
1293
1296
 
1294
1297
  <xsl:if test="$contents//figures/figure">
1295
- <fo:block margin-bottom="5pt"> </fo:block>
1298
+ <fo:block margin-bottom="5pt" role="SKIP"><fo:wrapper role="artifact"> </fo:wrapper></fo:block>
1296
1299
  <xsl:for-each select="$contents//figures/figure">
1297
1300
  <xsl:call-template name="insertListOf_Item"/>
1298
1301
  </xsl:for-each>
1299
1302
  </xsl:if>
1300
1303
 
1301
1304
  <xsl:if test="$contents//tables/table">
1302
- <fo:block margin-bottom="5pt"> </fo:block>
1305
+ <fo:block margin-bottom="5pt" role="SKIP"><fo:wrapper role="artifact"> </fo:wrapper></fo:block>
1303
1306
  <xsl:for-each select="$contents//tables/table">
1304
1307
  <xsl:call-template name="insertListOf_Item"/>
1305
1308
  </xsl:for-each>
@@ -1311,20 +1314,25 @@
1311
1314
 
1312
1315
  <xsl:template name="insertListOf_Item">
1313
1316
  <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm" role="TOCI">
1314
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{local-name()} {@id}">
1317
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space(*[local-name() = 'name']), ' —', ' -'))"/>
1318
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{$alt_text}"> <!-- {local-name()} {@id} -->
1315
1319
  <xsl:apply-templates select="." mode="contents"/>
1316
- <fo:inline keep-together.within-line="always">
1320
+ <fo:inline keep-together.within-line="always" role="SKIP">
1317
1321
  <fo:leader leader-pattern="dots"/>
1318
- <fo:page-number-citation ref-id="{@id}"/>
1322
+ <fo:wrapper role="artifact">
1323
+ <fo:page-number-citation ref-id="{@id}"/>
1324
+ </fo:wrapper>
1319
1325
  </fo:inline>
1320
1326
  </fo:basic-link>
1321
1327
  </fo:block>
1322
1328
  </xsl:template>
1323
1329
 
1324
1330
  <xsl:template match="iec:preface//iec:clause[@type = 'toc']" priority="3">
1325
- <fo:block-container>
1331
+ <fo:block-container role="SKIP">
1332
+ <!-- render 'Contents' outside if role="TOC" -->
1333
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
1326
1334
  <fo:block role="TOC">
1327
- <xsl:apply-templates/>
1335
+ <xsl:apply-templates select="node()[not(local-name() = 'title')]"/>
1328
1336
 
1329
1337
  <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1330
1338
  <xsl:variable name="docid">
@@ -1339,7 +1347,7 @@
1339
1347
  </xsl:template>
1340
1348
 
1341
1349
  <xsl:template match="iec:preface//iec:clause[@type = 'toc']/iec:title" priority="3">
1342
- <fo:block font-size="12pt" text-align="center" margin-bottom="22pt" role="H1">
1350
+ <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
1343
1351
  <xsl:call-template name="addLetterSpacing">
1344
1352
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/>
1345
1353
  </xsl:call-template>
@@ -5494,6 +5502,7 @@
5494
5502
 
5495
5503
  <fo:block role="SKIP">
5496
5504
  <xsl:apply-templates/>
5505
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5497
5506
  </fo:block>
5498
5507
  </fo:table-cell>
5499
5508
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -5557,6 +5566,8 @@
5557
5566
 
5558
5567
  <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
5559
5568
 
5569
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5570
+
5560
5571
  </fo:block>
5561
5572
  </fo:table-cell>
5562
5573
  </xsl:template> <!-- td -->
@@ -5628,7 +5639,8 @@
5628
5639
  </xsl:choose>
5629
5640
  </xsl:variable>
5630
5641
  <xsl:variable name="current_fn_number_text">
5631
- <xsl:value-of select="$current_fn_number"/>
5642
+
5643
+ <xsl:value-of select="$current_fn_number"/>
5632
5644
 
5633
5645
  </xsl:variable>
5634
5646
 
@@ -5664,8 +5676,10 @@
5664
5676
 
5665
5677
  <xsl:call-template name="insert_basic_link">
5666
5678
  <xsl:with-param name="element">
5667
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
5668
- <xsl:copy-of select="$current_fn_number_text"/>
5679
+ <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 -->
5680
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5681
+ <xsl:copy-of select="$current_fn_number_text"/>
5682
+ </fo:inline>
5669
5683
  </fo:basic-link>
5670
5684
  </xsl:with-param>
5671
5685
  </xsl:call-template>
@@ -5946,7 +5960,7 @@
5946
5960
 
5947
5961
  <xsl:call-template name="refine_fn-reference-style"/>
5948
5962
 
5949
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5963
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5950
5964
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5951
5965
  <xsl:attribute name="internal-destination">
5952
5966
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -6958,9 +6972,19 @@
6958
6972
  </fo:inline>
6959
6973
  </xsl:template>
6960
6974
 
6961
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6975
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
6976
+ <xsl:param name="txt"/>
6962
6977
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6963
- <xsl:variable name="text" select="."/>
6978
+ <xsl:variable name="text">
6979
+ <xsl:choose>
6980
+ <xsl:when test="$txt != ''">
6981
+ <xsl:value-of select="$txt"/>
6982
+ </xsl:when>
6983
+ <xsl:otherwise>
6984
+ <xsl:value-of select="."/>
6985
+ </xsl:otherwise>
6986
+ </xsl:choose>
6987
+ </xsl:variable>
6964
6988
  <xsl:variable name="ratio_">
6965
6989
  0.75
6966
6990
  </xsl:variable>
@@ -8425,14 +8449,16 @@
8425
8449
  <xsl:template match="*[local-name()='link']" name="link">
8426
8450
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8427
8451
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8452
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
8428
8453
  <xsl:variable name="target">
8429
8454
  <xsl:choose>
8430
8455
  <xsl:when test="@updatetype = 'true'">
8431
8456
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8432
8457
  </xsl:when>
8433
8458
  <!-- link to the PDF attachment -->
8434
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8435
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8459
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
8460
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
8461
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
8436
8462
  </xsl:when>
8437
8463
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8438
8464
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -8463,6 +8489,11 @@
8463
8489
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8464
8490
  </xsl:if>
8465
8491
 
8492
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8493
+ <xsl:attribute name="color">inherit</xsl:attribute>
8494
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
8495
+ </xsl:if>
8496
+
8466
8497
  <xsl:call-template name="refine_link-style"/>
8467
8498
 
8468
8499
  <xsl:choose>
@@ -8470,9 +8501,15 @@
8470
8501
  <xsl:apply-templates/>
8471
8502
  </xsl:when>
8472
8503
  <xsl:otherwise>
8504
+ <xsl:variable name="alt_text">
8505
+ <xsl:call-template name="getAltText"/>
8506
+ </xsl:variable>
8473
8507
  <xsl:call-template name="insert_basic_link">
8474
8508
  <xsl:with-param name="element">
8475
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8509
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
8510
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8511
+ <xsl:attribute name="role">Annot</xsl:attribute>
8512
+ </xsl:if>
8476
8513
  <xsl:choose>
8477
8514
  <xsl:when test="normalize-space(.) = ''">
8478
8515
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -8485,6 +8522,10 @@
8485
8522
  </xsl:otherwise>
8486
8523
  </xsl:choose>
8487
8524
  </fo:basic-link>
8525
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8526
+ <!-- reserve space at right for PaperClip icon -->
8527
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
8528
+ </xsl:if>
8488
8529
  </xsl:with-param>
8489
8530
  </xsl:call-template>
8490
8531
  </xsl:otherwise>
@@ -8492,6 +8533,14 @@
8492
8533
  </fo:inline>
8493
8534
  </xsl:template> <!-- link -->
8494
8535
 
8536
+ <xsl:template name="getAltText">
8537
+ <xsl:choose>
8538
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
8539
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
8540
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
8541
+ </xsl:choose>
8542
+ </xsl:template>
8543
+
8495
8544
  <!-- ======================== -->
8496
8545
  <!-- Appendix processing -->
8497
8546
  <!-- ======================== -->
@@ -8522,7 +8571,7 @@
8522
8571
  <xsl:template match="*[local-name() = 'callout']">
8523
8572
  <xsl:choose>
8524
8573
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
8525
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8574
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8526
8575
  </xsl:choose>
8527
8576
  </xsl:template>
8528
8577
 
@@ -8551,7 +8600,10 @@
8551
8600
  <xsl:template match="*[local-name() = 'xref']">
8552
8601
  <xsl:call-template name="insert_basic_link">
8553
8602
  <xsl:with-param name="element">
8554
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8603
+ <xsl:variable name="alt_text">
8604
+ <xsl:call-template name="getAltText"/>
8605
+ </xsl:variable>
8606
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
8555
8607
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
8556
8608
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8557
8609
  </xsl:if>
@@ -11052,12 +11104,14 @@
11052
11104
 
11053
11105
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
11054
11106
 
11055
- <xsl:variable name="provisional_distance_between_starts">
11107
+ <xsl:variable name="provisional_distance_between_starts_">
11056
11108
  7
11057
11109
  </xsl:variable>
11058
- <xsl:variable name="indent">
11110
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11111
+ <xsl:variable name="indent_">
11059
11112
  0
11060
11113
  </xsl:variable>
11114
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11061
11115
 
11062
11116
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11063
11117
  <fo:list-item>
@@ -11781,14 +11835,17 @@
11781
11835
  </xsl:when>
11782
11836
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11783
11837
 
11784
- <xsl:variable name="label">
11838
+ <xsl:variable name="type" select="../@type"/>
11785
11839
 
11786
- <xsl:variable name="type" select="../@type"/>
11840
+ <xsl:variable name="label">
11787
11841
 
11788
11842
  <xsl:variable name="style_prefix_">
11789
11843
  <xsl:if test="$type = 'roman'">
11790
11844
  <!-- Example: (i) -->
11791
11845
  </xsl:if>
11846
+ <xsl:if test="$type = 'alphabet'">
11847
+
11848
+ </xsl:if>
11792
11849
  </xsl:variable>
11793
11850
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
11794
11851
 
@@ -11814,13 +11871,15 @@
11814
11871
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
11815
11872
  <xsl:value-of select="$style_prefix"/>
11816
11873
  </xsl:if>
11874
+
11817
11875
  <xsl:value-of select="@label"/>
11876
+
11818
11877
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
11819
11878
  <xsl:value-of select="$style_suffix"/>
11820
11879
  </xsl:if>
11821
11880
  </xsl:variable>
11822
11881
 
11823
- <xsl:value-of select="normalize-space($label)"/>
11882
+ <xsl:value-of select="normalize-space($label)"/>
11824
11883
 
11825
11884
  </xsl:when>
11826
11885
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -14021,9 +14080,15 @@
14021
14080
  </x:xmpmeta>
14022
14081
  <!-- add attachments -->
14023
14082
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14024
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14025
-
14026
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14083
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
14084
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
14085
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14086
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14087
+ <!-- Todo: need update -->
14088
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
14089
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
14090
+
14091
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14027
14092
  <xsl:attribute name="src">
14028
14093
  <xsl:choose>
14029
14094
  <xsl:when test="normalize-space() != ''">
@@ -14039,18 +14104,34 @@
14039
14104
  <xsl:if test="$description != ''">
14040
14105
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14041
14106
  </xsl:if>
14107
+ <xsl:if test="$afrelationship != ''">
14108
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14109
+ </xsl:if>
14110
+ <xsl:if test="$volatile != ''">
14111
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14112
+ </xsl:if>
14042
14113
  </pdf:embedded-file>
14043
14114
  </xsl:for-each>
14044
14115
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14045
14116
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14046
14117
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14047
14118
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14119
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
14048
14120
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14049
14121
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14050
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14122
+ <!-- Todo: need update -->
14123
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
14124
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
14125
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14051
14126
  <xsl:if test="$description != ''">
14052
14127
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14053
14128
  </xsl:if>
14129
+ <xsl:if test="$afrelationship != ''">
14130
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14131
+ </xsl:if>
14132
+ <xsl:if test="$volatile != ''">
14133
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
14134
+ </xsl:if>
14054
14135
  </pdf:embedded-file>
14055
14136
  </xsl:for-each>
14056
14137
  </xsl:if>
@@ -14070,6 +14151,12 @@
14070
14151
  <!-- Get or calculate depth of the element -->
14071
14152
  <xsl:template name="getLevel">
14072
14153
  <xsl:param name="depth"/>
14154
+ <!-- <xsl:message>
14155
+ <xsl:choose>
14156
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
14157
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
14158
+ </xsl:choose>
14159
+ </xsl:message> -->
14073
14160
  <xsl:choose>
14074
14161
  <xsl:when test="normalize-space(@depth) != ''">
14075
14162
  <xsl:value-of select="@depth"/>
@@ -14090,8 +14177,48 @@
14090
14177
  <xsl:when test="ancestor::*[local-name() = 'preface']">
14091
14178
  <xsl:value-of select="$level_total - 2"/>
14092
14179
  </xsl:when>
14180
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14181
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
14182
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
14183
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
14184
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
14185
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
14186
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
14187
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
14188
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
14189
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
14190
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
14191
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
14192
+ <xsl:choose>
14193
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
14194
+ <xsl:value-of select="number($curr_clause_depth)"/>
14195
+ </xsl:when>
14196
+ <xsl:otherwise>
14197
+ <xsl:value-of select="$level_total - 2"/>
14198
+ </xsl:otherwise>
14199
+ </xsl:choose>
14200
+ </xsl:when>
14201
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
14202
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14203
+ <xsl:choose>
14204
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
14205
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
14206
+ </xsl:when>
14207
+ <xsl:otherwise>
14208
+ <xsl:value-of select="$level_total - 2"/>
14209
+ </xsl:otherwise>
14210
+ </xsl:choose>
14211
+ </xsl:when>
14093
14212
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14094
- <xsl:value-of select="$level_total - 1"/>
14213
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
14214
+ <xsl:choose>
14215
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14216
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14217
+ </xsl:when>
14218
+ <xsl:otherwise>
14219
+ <xsl:value-of select="$level_total - 1"/>
14220
+ </xsl:otherwise>
14221
+ </xsl:choose>
14095
14222
  </xsl:when>
14096
14223
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
14097
14224
  <xsl:value-of select="$level_total - 1"/>
@@ -14099,6 +14226,17 @@
14099
14226
  <xsl:when test="parent::*[local-name() = 'annex']">
14100
14227
  <xsl:value-of select="$level_total - 1"/>
14101
14228
  </xsl:when>
14229
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
14230
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14231
+ <xsl:choose>
14232
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14233
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14234
+ </xsl:when>
14235
+ <xsl:otherwise>
14236
+ <xsl:value-of select="$level_total - 1"/>
14237
+ </xsl:otherwise>
14238
+ </xsl:choose>
14239
+ </xsl:when>
14102
14240
  <xsl:when test="ancestor::*[local-name() = 'annex']">
14103
14241
  <xsl:value-of select="$level_total"/>
14104
14242
  </xsl:when>
@@ -14457,6 +14595,20 @@
14457
14595
 
14458
14596
  <!-- END: insert cover page image -->
14459
14597
 
14598
+ <xsl:template name="insertVerticalChar">
14599
+ <xsl:param name="str"/>
14600
+ <xsl:if test="string-length($str) &gt; 0">
14601
+ <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
14602
+ <fo:block-container width="1em">
14603
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14604
+ </fo:block-container>
14605
+ </fo:inline-container>
14606
+ <xsl:call-template name="insertVerticalChar">
14607
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14608
+ </xsl:call-template>
14609
+ </xsl:if>
14610
+ </xsl:template>
14611
+
14460
14612
  <xsl:template name="number-to-words">
14461
14613
  <xsl:param name="number"/>
14462
14614
  <xsl:param name="first"/>
@@ -14744,4 +14896,18 @@
14744
14896
  </xsl:if>
14745
14897
  </xsl:template>
14746
14898
 
14899
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14900
+ <xsl:copy>
14901
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14902
+ </xsl:copy>
14903
+ </xsl:template>
14904
+
14905
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14906
+ <xsl:copy>
14907
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14908
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14909
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14910
+ </xsl:copy>
14911
+ </xsl:template>
14912
+
14747
14913
  </xsl:stylesheet>
@@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
72
72
  from other documents in the same doctype</a:documentation>
73
73
  </ref>
74
74
  </optional>
75
+ <ref name="flavor">
76
+ <a:documentation>Flavour of Metanorma used to process this document</a:documentation>
77
+ </ref>
75
78
  <optional>
76
79
  <ref name="editorialgroup">
77
80
  <a:documentation>Groups associated with the production of the standards document, typically within
@@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
113
116
  <define name="DocumentSubtype">
114
117
  <text/>
115
118
  </define>
119
+ <define name="flavor">
120
+ <element name="flavor">
121
+ <ref name="MetanormaFlavor"/>
122
+ </element>
123
+ </define>
124
+ <define name="MetanormaFlavor">
125
+ <a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
126
+ However we prefer not to hardcode it, given ongoing extension.</a:documentation>
127
+ <text/>
128
+ </define>
116
129
  <define name="editorialgroup">
117
130
  <a:documentation>A group associated with the production of the standards document, typically within
118
131
  a standards definition organization</a:documentation>
@@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is
1382
1382
  <define name="bdate">
1383
1383
  <a:documentation>Significant date in the lifecycle of the bibliographic item, including its production and its access</a:documentation>
1384
1384
  <element name="date">
1385
- <attribute name="type">
1386
- <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1387
- <choice>
1388
- <ref name="BibliographicDateType"/>
1389
- <text/>
1390
- </choice>
1391
- </attribute>
1392
- <optional>
1393
- <attribute name="text">
1394
- <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1395
- </attribute>
1396
- </optional>
1385
+ <ref name="bDateAttributes"/>
1397
1386
  <optional>
1398
1387
  <choice>
1399
1388
  <group>
@@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is
1416
1405
  </optional>
1417
1406
  </element>
1418
1407
  </define>
1408
+ <define name="bDateAttributes">
1409
+ <attribute name="type">
1410
+ <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1411
+ <choice>
1412
+ <ref name="BibliographicDateType"/>
1413
+ <text/>
1414
+ </choice>
1415
+ </attribute>
1416
+ <optional>
1417
+ <attribute name="text">
1418
+ <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1419
+ </attribute>
1420
+ </optional>
1421
+ </define>
1419
1422
  <define name="docidentifier">
1420
1423
  <a:documentation>An identifier of a bibliographic item in an international standard scheme</a:documentation>
1421
1424
  <element name="docidentifier">
@@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1884
1887
  <value>hasAnnotation</value>
1885
1888
  <value>draftOf</value>
1886
1889
  <value>hasDraft</value>
1890
+ <value>preliminaryDraftOf</value>
1891
+ <value>hasPreliminaryDraft</value>
1892
+ <value>revisionDraftOf</value>
1893
+ <value>hasRevisionDraft</value>
1887
1894
  <value>editionOf</value>
1888
1895
  <value>hasEdition</value>
1889
1896
  <value>updates</value>
@@ -5,7 +5,7 @@ require_relative "front"
5
5
 
6
6
  module Metanorma
7
7
  module Iec
8
- class Converter < ISO::Converter
8
+ class Converter < Iso::Converter
9
9
  XML_ROOT_TAG = "iec-standard".freeze
10
10
  XML_NAMESPACE = "https://www.metanorma.org/ns/iec".freeze
11
11
 
@@ -2,7 +2,7 @@ require "pubid-iec"
2
2
 
3
3
  module Metanorma
4
4
  module Iec
5
- class Converter < ISO::Converter
5
+ class Converter < Iso::Converter
6
6
  def default_publisher
7
7
  "IEC"
8
8
  end
@@ -9,6 +9,7 @@
9
9
  <optional>
10
10
  <ref name="docsubtype"/>
11
11
  </optional>
12
+ <ref name="flavor"/>
12
13
  <optional>
13
14
  <ref name="horizontal"/>
14
15
  </optional>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.5.3".freeze
3
+ VERSION = "2.5.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-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso