metanorma-un 0.12.1 → 0.12.4

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: 6ca1718fe6e550e1d258909aa0fd41cd2504819961992616742a291f59b6b26f
4
- data.tar.gz: 3115ad4a86646bac1ebed1fa17dc9e52c97da57ae8da1a5b22310ca26be77580
3
+ metadata.gz: 6a6a30ba559e99be775cb5171f13cd196f8a2f3f47416c6fe5125d4a3b2ae158
4
+ data.tar.gz: 5247a58efec6e008bbbe5e30bfd6838662e0c066d1105a8765c5c18d2e71381b
5
5
  SHA512:
6
- metadata.gz: 793116ea6802000c243ebed98df18b9ba2b8fa20bdf012e76986d80fd8974974d635a42f59aa86ac6f457107c882d26b4f0746b15a40ee57b983e0cd7d5ea576
7
- data.tar.gz: 214a04cacddd622d3e636b4b1f681a120d19c2392ad44912b4753926cfed243bda2ac294d73e0d9b92d9046b00cf399f34c27f29c5151c64ee684fd12eda53f1
6
+ metadata.gz: 675bb2c90ca90d8e4c3401b5f14f0231a36370277d241bd3779499ba1d51ab6d327cbba318d3c19e9675cd9a33c911f7a87cf048d77c0540f3da9fd1c8f5762b
7
+ data.tar.gz: a5ed94230bf8b0a1bf4c2de826717cd1a07ee0ff2eb68a1e258aa57e64ed7f5db2e04e46cbfc86b7d1d99a6acb0c9a4e674e6d164cf5059a199af4ba510bd118
@@ -12,24 +12,22 @@ module IsoDoc
12
12
  end
13
13
 
14
14
  def title(isoxml, _out)
15
- main = isoxml&.at(ns("//bibdata/title"\
16
- "[@language='en' and @type='main']"))&.text
15
+ main = isoxml.at(ns("//bibdata/title[@language='en' and @type='main']"))
16
+ &.children&.to_xml
17
17
  set(:doctitle, main)
18
18
  end
19
19
 
20
20
  def subtitle(isoxml, _out)
21
- main = isoxml&.at(ns("//bibdata/title"\
22
- "[@language='en' and @type='subtitle']"))&.text
21
+ main = isoxml.at(ns("//bibdata/title[@language='en' and @type='subtitle']"))
22
+ &.children&.to_xml
23
23
  set(:docsubtitle, main)
24
24
  end
25
25
 
26
26
  def extract_languages(nodeset)
27
- lgs = []
28
- nodeset.each do |l|
29
- l && ISO_639.find(l.text)&.english_name and
30
- lgs << ISO_639.find(l.text).english_name
27
+ lgs = nodeset.each_with_object([]) do |l, m|
28
+ l and lg = ISO_639.find(l.text) and m << lg.english_name
31
29
  end
32
- lgs.map { |l| l == "Spanish; Castilian" ? "Spanish" : l }
30
+ lgs.compact.map { |l| l == "Spanish; Castilian" ? "Spanish" : l }
33
31
  end
34
32
 
35
33
  def author(isoxml, _out)
@@ -61,10 +59,7 @@ module IsoDoc
61
59
  set(:session_date, isoxml.at(ns("//bibdata/ext/session/date"))&.text)
62
60
  set(:session_collaborator,
63
61
  isoxml.at(ns("//bibdata/ext/session/collaborator"))&.text)
64
- sid = isoxml.at(ns("//bibdata/ext/session/id"))&.text
65
- set(:session_id, sid)
66
- set(:session_id_head, sid&.sub(%r{/.*$}, ""))
67
- set(:session_id_tail, sid&.sub(%r{^[^/]+}, ""))
62
+ session_id(isoxml)
68
63
  set(:item_footnote,
69
64
  isoxml.at(ns("//bibdata/ext/session/item-footnote"))&.text)
70
65
  set(:session_itemnumber,
@@ -75,6 +70,13 @@ module IsoDoc
75
70
  multival(isoxml, "//bibdata/ext/session/subitem-name"))
76
71
  end
77
72
 
73
+ def session_id(isoxml)
74
+ sid = isoxml.at(ns("//bibdata/ext/session/id"))&.text
75
+ set(:session_id, sid)
76
+ set(:session_id_head, sid&.sub(%r{/.*$}, ""))
77
+ set(:session_id_tail, sid&.sub(%r{^[^/]+}, ""))
78
+ end
79
+
78
80
  def docid(isoxml, _out)
79
81
  dn = isoxml.at(ns("//bibdata/docidentifier"))&.text
80
82
  set(:docnumber, dn)
@@ -738,6 +738,8 @@
738
738
  <xsl:param name="svg_images"/> <!-- svg images array -->
739
739
  <xsl:variable name="images" select="document($svg_images)"/>
740
740
  <xsl:param name="basepath"/> <!-- base path for images -->
741
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
742
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
741
743
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
742
744
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
743
745
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -790,6 +792,20 @@
790
792
  <xsl:call-template name="getLang"/>
791
793
  </xsl:variable>
792
794
 
795
+ <xsl:variable name="inputxml_filename_prefix">
796
+ <xsl:choose>
797
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
798
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
799
+ </xsl:when>
800
+ <xsl:when test="contains($inputxml_filename, '.xml')">
801
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
802
+ </xsl:when>
803
+ <xsl:otherwise>
804
+ <xsl:value-of select="$inputxml_filename"/>
805
+ </xsl:otherwise>
806
+ </xsl:choose>
807
+ </xsl:variable>
808
+
793
809
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
794
810
  You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
795
811
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
@@ -1240,6 +1256,10 @@
1240
1256
 
1241
1257
  </xsl:attribute-set>
1242
1258
 
1259
+ <xsl:template name="refine_termexample-style">
1260
+
1261
+ </xsl:template>
1262
+
1243
1263
  <xsl:attribute-set name="example-style">
1244
1264
 
1245
1265
  </xsl:attribute-set> <!-- example-style -->
@@ -1692,6 +1712,10 @@
1692
1712
 
1693
1713
  </xsl:attribute-set>
1694
1714
 
1715
+ <xsl:template name="refine_figure-block-style">
1716
+
1717
+ </xsl:template>
1718
+
1695
1719
  <xsl:attribute-set name="figure-style">
1696
1720
 
1697
1721
  </xsl:attribute-set>
@@ -2345,6 +2369,36 @@
2345
2369
  </xsl:for-each>
2346
2370
  </xsl:template>
2347
2371
 
2372
+ <xsl:template name="processMainSectionsDefault_flatxml">
2373
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2374
+ <xsl:sort select="@displayorder" data-type="number"/>
2375
+ <xsl:variable name="flatxml">
2376
+ <xsl:apply-templates select="." mode="flatxml"/>
2377
+ </xsl:variable>
2378
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2379
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2380
+
2381
+ </xsl:for-each>
2382
+
2383
+ <xsl:for-each select="/*/*[local-name()='annex']">
2384
+ <xsl:sort select="@displayorder" data-type="number"/>
2385
+ <xsl:variable name="flatxml">
2386
+ <xsl:apply-templates select="." mode="flatxml"/>
2387
+ </xsl:variable>
2388
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2389
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2390
+ </xsl:for-each>
2391
+
2392
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2393
+ <xsl:sort select="@displayorder" data-type="number"/>
2394
+ <xsl:variable name="flatxml">
2395
+ <xsl:apply-templates select="." mode="flatxml"/>
2396
+ </xsl:variable>
2397
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2398
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2399
+ </xsl:for-each>
2400
+ </xsl:template>
2401
+
2348
2402
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2349
2403
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2350
2404
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -2572,7 +2626,7 @@
2572
2626
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2573
2627
 
2574
2628
  <xsl:variable name="colwidths">
2575
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2629
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
2576
2630
  <xsl:call-template name="calculate-column-widths">
2577
2631
  <xsl:with-param name="cols-count" select="$cols-count"/>
2578
2632
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2690,6 +2744,11 @@
2690
2744
  <fo:table-column column-width="{@width}"/>
2691
2745
  </xsl:for-each>
2692
2746
  </xsl:when>
2747
+ <xsl:when test="@class = 'dl'">
2748
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
2749
+ <fo:table-column column-width="{@width}"/>
2750
+ </xsl:for-each>
2751
+ </xsl:when>
2693
2752
  <xsl:otherwise>
2694
2753
  <xsl:call-template name="insertTableColumnWidth">
2695
2754
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3966,6 +4025,7 @@
3966
4025
  <!-- ===================== -->
3967
4026
  <!-- Definition List -->
3968
4027
  <!-- ===================== -->
4028
+
3969
4029
  <xsl:template match="*[local-name()='dl']">
3970
4030
  <xsl:variable name="isAdded" select="@added"/>
3971
4031
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4178,10 +4238,21 @@
4178
4238
  </xsl:variable>
4179
4239
 
4180
4240
  <xsl:variable name="colwidths">
4181
- <xsl:call-template name="calculate-column-widths">
4182
- <xsl:with-param name="cols-count" select="2"/>
4183
- <xsl:with-param name="table" select="$simple-table"/>
4184
- </xsl:call-template>
4241
+ <xsl:choose>
4242
+ <!-- dl from table[@class='dl'] -->
4243
+ <xsl:when test="*[local-name() = 'colgroup']">
4244
+ <autolayout/>
4245
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4246
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4247
+ </xsl:for-each>
4248
+ </xsl:when>
4249
+ <xsl:otherwise>
4250
+ <xsl:call-template name="calculate-column-widths">
4251
+ <xsl:with-param name="cols-count" select="2"/>
4252
+ <xsl:with-param name="table" select="$simple-table"/>
4253
+ </xsl:call-template>
4254
+ </xsl:otherwise>
4255
+ </xsl:choose>
4185
4256
  </xsl:variable>
4186
4257
 
4187
4258
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -4427,13 +4498,13 @@
4427
4498
  <tr>
4428
4499
  <td>
4429
4500
  <xsl:attribute name="id">
4430
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4501
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
4431
4502
  </xsl:attribute>
4432
4503
  <xsl:apply-templates/>
4433
4504
  </td>
4434
4505
  <td>
4435
4506
  <xsl:attribute name="id">
4436
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4507
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
4437
4508
  </xsl:attribute>
4438
4509
 
4439
4510
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -5042,6 +5113,10 @@
5042
5113
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5043
5114
  </xsl:template>
5044
5115
 
5116
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
5117
+ <xsl:value-of select="."/>
5118
+ </xsl:template>
5119
+
5045
5120
  <!-- ========================= -->
5046
5121
  <!-- END Rich text formatting -->
5047
5122
  <!-- ========================= -->
@@ -5672,7 +5747,7 @@
5672
5747
  </xsl:choose>
5673
5748
  </xsl:variable>
5674
5749
  <xsl:attribute name="id">
5675
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5750
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
5676
5751
  </xsl:attribute>
5677
5752
 
5678
5753
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5680,7 +5755,7 @@
5680
5755
  <xsl:copy-of select="@*"/>
5681
5756
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5682
5757
  <xsl:attribute name="id">
5683
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5758
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5684
5759
  </xsl:attribute>
5685
5760
 
5686
5761
  <!-- <xsl:copy-of select="node()" /> -->
@@ -5744,7 +5819,7 @@
5744
5819
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5745
5820
  <xsl:copy>
5746
5821
  <xsl:attribute name="id">
5747
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5822
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5748
5823
  </xsl:attribute>
5749
5824
  <xsl:copy-of select="node()"/>
5750
5825
  </xsl:copy>
@@ -6271,6 +6346,12 @@
6271
6346
  <xsl:when test="@updatetype = 'true'">
6272
6347
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6273
6348
  </xsl:when>
6349
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6350
+ <!-- link to the PDF attachment -->
6351
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6352
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6353
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6354
+ </xsl:when>
6274
6355
  <xsl:otherwise>
6275
6356
  <xsl:value-of select="normalize-space(@target)"/>
6276
6357
  </xsl:otherwise>
@@ -6689,6 +6770,7 @@
6689
6770
  <xsl:variable name="isAdded" select="@added"/>
6690
6771
  <xsl:variable name="isDeleted" select="@deleted"/>
6691
6772
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6773
+ <xsl:call-template name="refine_figure-block-style"/>
6692
6774
 
6693
6775
  <xsl:call-template name="setTrackChangesStyles">
6694
6776
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8557,7 +8639,7 @@
8557
8639
  <!-- ====== -->
8558
8640
  <xsl:template match="*[local-name() = 'termexample']">
8559
8641
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8560
-
8642
+ <xsl:call-template name="refine_termexample-style"/>
8561
8643
  <xsl:call-template name="setBlockSpanAll"/>
8562
8644
 
8563
8645
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -11036,10 +11118,10 @@
11036
11118
 
11037
11119
  <xsl:template name="addPDFUAmeta">
11038
11120
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
11039
- <pdf:dictionary type="normal" key="ViewerPreferences">
11040
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11041
- </pdf:dictionary>
11042
- </pdf:catalog>
11121
+ <pdf:dictionary type="normal" key="ViewerPreferences">
11122
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11123
+ </pdf:dictionary>
11124
+ </pdf:catalog>
11043
11125
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
11044
11126
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
11045
11127
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -11091,6 +11173,19 @@
11091
11173
  </rdf:Description>
11092
11174
  </rdf:RDF>
11093
11175
  </x:xmpmeta>
11176
+ <!-- add attachments -->
11177
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11178
+ <xsl:choose>
11179
+ <xsl:when test="normalize-space() != ''">
11180
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
11181
+ </xsl:when>
11182
+ <xsl:otherwise>
11183
+ <!-- _{filename}_attachments -->
11184
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
11185
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
11186
+ </xsl:otherwise>
11187
+ </xsl:choose>
11188
+ </xsl:for-each>
11094
11189
  </xsl:template> <!-- addPDFUAmeta -->
11095
11190
 
11096
11191
  <xsl:template name="getId">
@@ -738,6 +738,8 @@
738
738
  <xsl:param name="svg_images"/> <!-- svg images array -->
739
739
  <xsl:variable name="images" select="document($svg_images)"/>
740
740
  <xsl:param name="basepath"/> <!-- base path for images -->
741
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
742
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
741
743
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
742
744
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
743
745
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -790,6 +792,20 @@
790
792
  <xsl:call-template name="getLang"/>
791
793
  </xsl:variable>
792
794
 
795
+ <xsl:variable name="inputxml_filename_prefix">
796
+ <xsl:choose>
797
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
798
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
799
+ </xsl:when>
800
+ <xsl:when test="contains($inputxml_filename, '.xml')">
801
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
802
+ </xsl:when>
803
+ <xsl:otherwise>
804
+ <xsl:value-of select="$inputxml_filename"/>
805
+ </xsl:otherwise>
806
+ </xsl:choose>
807
+ </xsl:variable>
808
+
793
809
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
794
810
  You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
795
811
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
@@ -1240,6 +1256,10 @@
1240
1256
 
1241
1257
  </xsl:attribute-set>
1242
1258
 
1259
+ <xsl:template name="refine_termexample-style">
1260
+
1261
+ </xsl:template>
1262
+
1243
1263
  <xsl:attribute-set name="example-style">
1244
1264
 
1245
1265
  </xsl:attribute-set> <!-- example-style -->
@@ -1692,6 +1712,10 @@
1692
1712
 
1693
1713
  </xsl:attribute-set>
1694
1714
 
1715
+ <xsl:template name="refine_figure-block-style">
1716
+
1717
+ </xsl:template>
1718
+
1695
1719
  <xsl:attribute-set name="figure-style">
1696
1720
 
1697
1721
  </xsl:attribute-set>
@@ -2345,6 +2369,36 @@
2345
2369
  </xsl:for-each>
2346
2370
  </xsl:template>
2347
2371
 
2372
+ <xsl:template name="processMainSectionsDefault_flatxml">
2373
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2374
+ <xsl:sort select="@displayorder" data-type="number"/>
2375
+ <xsl:variable name="flatxml">
2376
+ <xsl:apply-templates select="." mode="flatxml"/>
2377
+ </xsl:variable>
2378
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2379
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2380
+
2381
+ </xsl:for-each>
2382
+
2383
+ <xsl:for-each select="/*/*[local-name()='annex']">
2384
+ <xsl:sort select="@displayorder" data-type="number"/>
2385
+ <xsl:variable name="flatxml">
2386
+ <xsl:apply-templates select="." mode="flatxml"/>
2387
+ </xsl:variable>
2388
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2389
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2390
+ </xsl:for-each>
2391
+
2392
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2393
+ <xsl:sort select="@displayorder" data-type="number"/>
2394
+ <xsl:variable name="flatxml">
2395
+ <xsl:apply-templates select="." mode="flatxml"/>
2396
+ </xsl:variable>
2397
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2398
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2399
+ </xsl:for-each>
2400
+ </xsl:template>
2401
+
2348
2402
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2349
2403
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2350
2404
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -2572,7 +2626,7 @@
2572
2626
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2573
2627
 
2574
2628
  <xsl:variable name="colwidths">
2575
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2629
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
2576
2630
  <xsl:call-template name="calculate-column-widths">
2577
2631
  <xsl:with-param name="cols-count" select="$cols-count"/>
2578
2632
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2690,6 +2744,11 @@
2690
2744
  <fo:table-column column-width="{@width}"/>
2691
2745
  </xsl:for-each>
2692
2746
  </xsl:when>
2747
+ <xsl:when test="@class = 'dl'">
2748
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
2749
+ <fo:table-column column-width="{@width}"/>
2750
+ </xsl:for-each>
2751
+ </xsl:when>
2693
2752
  <xsl:otherwise>
2694
2753
  <xsl:call-template name="insertTableColumnWidth">
2695
2754
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3966,6 +4025,7 @@
3966
4025
  <!-- ===================== -->
3967
4026
  <!-- Definition List -->
3968
4027
  <!-- ===================== -->
4028
+
3969
4029
  <xsl:template match="*[local-name()='dl']">
3970
4030
  <xsl:variable name="isAdded" select="@added"/>
3971
4031
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4178,10 +4238,21 @@
4178
4238
  </xsl:variable>
4179
4239
 
4180
4240
  <xsl:variable name="colwidths">
4181
- <xsl:call-template name="calculate-column-widths">
4182
- <xsl:with-param name="cols-count" select="2"/>
4183
- <xsl:with-param name="table" select="$simple-table"/>
4184
- </xsl:call-template>
4241
+ <xsl:choose>
4242
+ <!-- dl from table[@class='dl'] -->
4243
+ <xsl:when test="*[local-name() = 'colgroup']">
4244
+ <autolayout/>
4245
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4246
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4247
+ </xsl:for-each>
4248
+ </xsl:when>
4249
+ <xsl:otherwise>
4250
+ <xsl:call-template name="calculate-column-widths">
4251
+ <xsl:with-param name="cols-count" select="2"/>
4252
+ <xsl:with-param name="table" select="$simple-table"/>
4253
+ </xsl:call-template>
4254
+ </xsl:otherwise>
4255
+ </xsl:choose>
4185
4256
  </xsl:variable>
4186
4257
 
4187
4258
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -4427,13 +4498,13 @@
4427
4498
  <tr>
4428
4499
  <td>
4429
4500
  <xsl:attribute name="id">
4430
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4501
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
4431
4502
  </xsl:attribute>
4432
4503
  <xsl:apply-templates/>
4433
4504
  </td>
4434
4505
  <td>
4435
4506
  <xsl:attribute name="id">
4436
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4507
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
4437
4508
  </xsl:attribute>
4438
4509
 
4439
4510
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -5042,6 +5113,10 @@
5042
5113
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5043
5114
  </xsl:template>
5044
5115
 
5116
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
5117
+ <xsl:value-of select="."/>
5118
+ </xsl:template>
5119
+
5045
5120
  <!-- ========================= -->
5046
5121
  <!-- END Rich text formatting -->
5047
5122
  <!-- ========================= -->
@@ -5672,7 +5747,7 @@
5672
5747
  </xsl:choose>
5673
5748
  </xsl:variable>
5674
5749
  <xsl:attribute name="id">
5675
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5750
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
5676
5751
  </xsl:attribute>
5677
5752
 
5678
5753
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5680,7 +5755,7 @@
5680
5755
  <xsl:copy-of select="@*"/>
5681
5756
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5682
5757
  <xsl:attribute name="id">
5683
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5758
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5684
5759
  </xsl:attribute>
5685
5760
 
5686
5761
  <!-- <xsl:copy-of select="node()" /> -->
@@ -5744,7 +5819,7 @@
5744
5819
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5745
5820
  <xsl:copy>
5746
5821
  <xsl:attribute name="id">
5747
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5822
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5748
5823
  </xsl:attribute>
5749
5824
  <xsl:copy-of select="node()"/>
5750
5825
  </xsl:copy>
@@ -6271,6 +6346,12 @@
6271
6346
  <xsl:when test="@updatetype = 'true'">
6272
6347
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6273
6348
  </xsl:when>
6349
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6350
+ <!-- link to the PDF attachment -->
6351
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6352
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6353
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6354
+ </xsl:when>
6274
6355
  <xsl:otherwise>
6275
6356
  <xsl:value-of select="normalize-space(@target)"/>
6276
6357
  </xsl:otherwise>
@@ -6689,6 +6770,7 @@
6689
6770
  <xsl:variable name="isAdded" select="@added"/>
6690
6771
  <xsl:variable name="isDeleted" select="@deleted"/>
6691
6772
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6773
+ <xsl:call-template name="refine_figure-block-style"/>
6692
6774
 
6693
6775
  <xsl:call-template name="setTrackChangesStyles">
6694
6776
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8557,7 +8639,7 @@
8557
8639
  <!-- ====== -->
8558
8640
  <xsl:template match="*[local-name() = 'termexample']">
8559
8641
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8560
-
8642
+ <xsl:call-template name="refine_termexample-style"/>
8561
8643
  <xsl:call-template name="setBlockSpanAll"/>
8562
8644
 
8563
8645
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -11036,10 +11118,10 @@
11036
11118
 
11037
11119
  <xsl:template name="addPDFUAmeta">
11038
11120
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
11039
- <pdf:dictionary type="normal" key="ViewerPreferences">
11040
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11041
- </pdf:dictionary>
11042
- </pdf:catalog>
11121
+ <pdf:dictionary type="normal" key="ViewerPreferences">
11122
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11123
+ </pdf:dictionary>
11124
+ </pdf:catalog>
11043
11125
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
11044
11126
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
11045
11127
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -11091,6 +11173,19 @@
11091
11173
  </rdf:Description>
11092
11174
  </rdf:RDF>
11093
11175
  </x:xmpmeta>
11176
+ <!-- add attachments -->
11177
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11178
+ <xsl:choose>
11179
+ <xsl:when test="normalize-space() != ''">
11180
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
11181
+ </xsl:when>
11182
+ <xsl:otherwise>
11183
+ <!-- _{filename}_attachments -->
11184
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
11185
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
11186
+ </xsl:otherwise>
11187
+ </xsl:choose>
11188
+ </xsl:for-each>
11094
11189
  </xsl:template> <!-- addPDFUAmeta -->
11095
11190
 
11096
11191
  <xsl:template name="getId">
@@ -844,6 +844,8 @@
844
844
  <xsl:param name="svg_images"/> <!-- svg images array -->
845
845
  <xsl:variable name="images" select="document($svg_images)"/>
846
846
  <xsl:param name="basepath"/> <!-- base path for images -->
847
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
848
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
847
849
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
848
850
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
849
851
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -896,6 +898,20 @@
896
898
  <xsl:call-template name="getLang"/>
897
899
  </xsl:variable>
898
900
 
901
+ <xsl:variable name="inputxml_filename_prefix">
902
+ <xsl:choose>
903
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
904
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
905
+ </xsl:when>
906
+ <xsl:when test="contains($inputxml_filename, '.xml')">
907
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
908
+ </xsl:when>
909
+ <xsl:otherwise>
910
+ <xsl:value-of select="$inputxml_filename"/>
911
+ </xsl:otherwise>
912
+ </xsl:choose>
913
+ </xsl:variable>
914
+
899
915
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
900
916
  You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
901
917
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
@@ -1346,6 +1362,10 @@
1346
1362
 
1347
1363
  </xsl:attribute-set>
1348
1364
 
1365
+ <xsl:template name="refine_termexample-style">
1366
+
1367
+ </xsl:template>
1368
+
1349
1369
  <xsl:attribute-set name="example-style">
1350
1370
 
1351
1371
  </xsl:attribute-set> <!-- example-style -->
@@ -1815,6 +1835,10 @@
1815
1835
 
1816
1836
  </xsl:attribute-set>
1817
1837
 
1838
+ <xsl:template name="refine_figure-block-style">
1839
+
1840
+ </xsl:template>
1841
+
1818
1842
  <xsl:attribute-set name="figure-style">
1819
1843
 
1820
1844
  </xsl:attribute-set>
@@ -2476,6 +2500,36 @@
2476
2500
  </xsl:for-each>
2477
2501
  </xsl:template>
2478
2502
 
2503
+ <xsl:template name="processMainSectionsDefault_flatxml">
2504
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2505
+ <xsl:sort select="@displayorder" data-type="number"/>
2506
+ <xsl:variable name="flatxml">
2507
+ <xsl:apply-templates select="." mode="flatxml"/>
2508
+ </xsl:variable>
2509
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2510
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2511
+
2512
+ </xsl:for-each>
2513
+
2514
+ <xsl:for-each select="/*/*[local-name()='annex']">
2515
+ <xsl:sort select="@displayorder" data-type="number"/>
2516
+ <xsl:variable name="flatxml">
2517
+ <xsl:apply-templates select="." mode="flatxml"/>
2518
+ </xsl:variable>
2519
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2520
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2521
+ </xsl:for-each>
2522
+
2523
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2524
+ <xsl:sort select="@displayorder" data-type="number"/>
2525
+ <xsl:variable name="flatxml">
2526
+ <xsl:apply-templates select="." mode="flatxml"/>
2527
+ </xsl:variable>
2528
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2529
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2530
+ </xsl:for-each>
2531
+ </xsl:template>
2532
+
2479
2533
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2480
2534
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2481
2535
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -2703,7 +2757,7 @@
2703
2757
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2704
2758
 
2705
2759
  <xsl:variable name="colwidths">
2706
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2760
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
2707
2761
  <xsl:call-template name="calculate-column-widths">
2708
2762
  <xsl:with-param name="cols-count" select="$cols-count"/>
2709
2763
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2821,6 +2875,11 @@
2821
2875
  <fo:table-column column-width="{@width}"/>
2822
2876
  </xsl:for-each>
2823
2877
  </xsl:when>
2878
+ <xsl:when test="@class = 'dl'">
2879
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
2880
+ <fo:table-column column-width="{@width}"/>
2881
+ </xsl:for-each>
2882
+ </xsl:when>
2824
2883
  <xsl:otherwise>
2825
2884
  <xsl:call-template name="insertTableColumnWidth">
2826
2885
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -4093,6 +4152,7 @@
4093
4152
  <!-- ===================== -->
4094
4153
  <!-- Definition List -->
4095
4154
  <!-- ===================== -->
4155
+
4096
4156
  <xsl:template match="*[local-name()='dl']">
4097
4157
  <xsl:variable name="isAdded" select="@added"/>
4098
4158
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4305,10 +4365,21 @@
4305
4365
  </xsl:variable>
4306
4366
 
4307
4367
  <xsl:variable name="colwidths">
4308
- <xsl:call-template name="calculate-column-widths">
4309
- <xsl:with-param name="cols-count" select="2"/>
4310
- <xsl:with-param name="table" select="$simple-table"/>
4311
- </xsl:call-template>
4368
+ <xsl:choose>
4369
+ <!-- dl from table[@class='dl'] -->
4370
+ <xsl:when test="*[local-name() = 'colgroup']">
4371
+ <autolayout/>
4372
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4373
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4374
+ </xsl:for-each>
4375
+ </xsl:when>
4376
+ <xsl:otherwise>
4377
+ <xsl:call-template name="calculate-column-widths">
4378
+ <xsl:with-param name="cols-count" select="2"/>
4379
+ <xsl:with-param name="table" select="$simple-table"/>
4380
+ </xsl:call-template>
4381
+ </xsl:otherwise>
4382
+ </xsl:choose>
4312
4383
  </xsl:variable>
4313
4384
 
4314
4385
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -4554,13 +4625,13 @@
4554
4625
  <tr>
4555
4626
  <td>
4556
4627
  <xsl:attribute name="id">
4557
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4628
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
4558
4629
  </xsl:attribute>
4559
4630
  <xsl:apply-templates/>
4560
4631
  </td>
4561
4632
  <td>
4562
4633
  <xsl:attribute name="id">
4563
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4634
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
4564
4635
  </xsl:attribute>
4565
4636
 
4566
4637
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -5169,6 +5240,10 @@
5169
5240
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5170
5241
  </xsl:template>
5171
5242
 
5243
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
5244
+ <xsl:value-of select="."/>
5245
+ </xsl:template>
5246
+
5172
5247
  <!-- ========================= -->
5173
5248
  <!-- END Rich text formatting -->
5174
5249
  <!-- ========================= -->
@@ -5799,7 +5874,7 @@
5799
5874
  </xsl:choose>
5800
5875
  </xsl:variable>
5801
5876
  <xsl:attribute name="id">
5802
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5877
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
5803
5878
  </xsl:attribute>
5804
5879
 
5805
5880
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5807,7 +5882,7 @@
5807
5882
  <xsl:copy-of select="@*"/>
5808
5883
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5809
5884
  <xsl:attribute name="id">
5810
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5885
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5811
5886
  </xsl:attribute>
5812
5887
 
5813
5888
  <!-- <xsl:copy-of select="node()" /> -->
@@ -5871,7 +5946,7 @@
5871
5946
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5872
5947
  <xsl:copy>
5873
5948
  <xsl:attribute name="id">
5874
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5949
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5875
5950
  </xsl:attribute>
5876
5951
  <xsl:copy-of select="node()"/>
5877
5952
  </xsl:copy>
@@ -6398,6 +6473,12 @@
6398
6473
  <xsl:when test="@updatetype = 'true'">
6399
6474
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6400
6475
  </xsl:when>
6476
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6477
+ <!-- link to the PDF attachment -->
6478
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6479
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6480
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6481
+ </xsl:when>
6401
6482
  <xsl:otherwise>
6402
6483
  <xsl:value-of select="normalize-space(@target)"/>
6403
6484
  </xsl:otherwise>
@@ -6816,6 +6897,7 @@
6816
6897
  <xsl:variable name="isAdded" select="@added"/>
6817
6898
  <xsl:variable name="isDeleted" select="@deleted"/>
6818
6899
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6900
+ <xsl:call-template name="refine_figure-block-style"/>
6819
6901
 
6820
6902
  <xsl:call-template name="setTrackChangesStyles">
6821
6903
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8684,7 +8766,7 @@
8684
8766
  <!-- ====== -->
8685
8767
  <xsl:template match="*[local-name() = 'termexample']">
8686
8768
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8687
-
8769
+ <xsl:call-template name="refine_termexample-style"/>
8688
8770
  <xsl:call-template name="setBlockSpanAll"/>
8689
8771
 
8690
8772
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -11164,10 +11246,10 @@
11164
11246
 
11165
11247
  <xsl:template name="addPDFUAmeta">
11166
11248
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
11167
- <pdf:dictionary type="normal" key="ViewerPreferences">
11168
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11169
- </pdf:dictionary>
11170
- </pdf:catalog>
11249
+ <pdf:dictionary type="normal" key="ViewerPreferences">
11250
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11251
+ </pdf:dictionary>
11252
+ </pdf:catalog>
11171
11253
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
11172
11254
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
11173
11255
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -11219,6 +11301,19 @@
11219
11301
  </rdf:Description>
11220
11302
  </rdf:RDF>
11221
11303
  </x:xmpmeta>
11304
+ <!-- add attachments -->
11305
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11306
+ <xsl:choose>
11307
+ <xsl:when test="normalize-space() != ''">
11308
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
11309
+ </xsl:when>
11310
+ <xsl:otherwise>
11311
+ <!-- _{filename}_attachments -->
11312
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
11313
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
11314
+ </xsl:otherwise>
11315
+ </xsl:choose>
11316
+ </xsl:for-each>
11222
11317
  </xsl:template> <!-- addPDFUAmeta -->
11223
11318
 
11224
11319
  <xsl:template name="getId">
@@ -338,29 +338,32 @@
338
338
  </define>
339
339
  <define name="organization">
340
340
  <element name="organization">
341
- <oneOrMore>
342
- <ref name="orgname"/>
343
- </oneOrMore>
344
- <zeroOrMore>
345
- <ref name="subdivision"/>
346
- </zeroOrMore>
347
- <optional>
348
- <ref name="abbreviation"/>
349
- </optional>
350
- <zeroOrMore>
351
- <ref name="uri"/>
352
- </zeroOrMore>
353
- <zeroOrMore>
354
- <ref name="org-identifier"/>
355
- </zeroOrMore>
356
- <zeroOrMore>
357
- <ref name="contact"/>
358
- </zeroOrMore>
359
- <optional>
360
- <ref name="logo"/>
361
- </optional>
341
+ <ref name="OrganizationType"/>
362
342
  </element>
363
343
  </define>
344
+ <define name="OrganizationType">
345
+ <oneOrMore>
346
+ <ref name="orgname"/>
347
+ </oneOrMore>
348
+ <zeroOrMore>
349
+ <ref name="subdivision"/>
350
+ </zeroOrMore>
351
+ <optional>
352
+ <ref name="abbreviation"/>
353
+ </optional>
354
+ <zeroOrMore>
355
+ <ref name="uri"/>
356
+ </zeroOrMore>
357
+ <zeroOrMore>
358
+ <ref name="org-identifier"/>
359
+ </zeroOrMore>
360
+ <zeroOrMore>
361
+ <ref name="contact"/>
362
+ </zeroOrMore>
363
+ <optional>
364
+ <ref name="logo"/>
365
+ </optional>
366
+ </define>
364
367
  <define name="orgname">
365
368
  <element name="name">
366
369
  <choice>
@@ -371,10 +374,10 @@
371
374
  </define>
372
375
  <define name="subdivision">
373
376
  <element name="subdivision">
374
- <choice>
375
- <ref name="LocalizedString"/>
376
- <ref name="NameWithVariants"/>
377
- </choice>
377
+ <optional>
378
+ <attribute name="type"/>
379
+ </optional>
380
+ <ref name="OrganizationType"/>
378
381
  </element>
379
382
  </define>
380
383
  <define name="logo">
@@ -60,7 +60,6 @@ module Metanorma
60
60
  end
61
61
  id = node.attr("docidentifier") and dn = id
62
62
  xml.docidentifier { |i| i << dn }
63
- xml.docnumber { |i| i << node.attr("docnumber") }
64
63
  end
65
64
 
66
65
  def metadata_distribution(node, xml)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.1".freeze
3
+ VERSION = "0.12.4".freeze
4
4
  end
5
5
  end
data/metanorma-un.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "roman-numerals"
32
32
  spec.add_dependency "twitter_cldr"
33
33
 
34
- spec.add_dependency "metanorma-standoc", "~> 2.8.0"
34
+ spec.add_dependency "metanorma-standoc", "~> 2.8.4"
35
35
 
36
36
  spec.add_development_dependency "debug"
37
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.8.0
61
+ version: 2.8.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.8.0
68
+ version: 2.8.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: debug
71
71
  requirement: !ruby/object:Gem::Requirement