metanorma-bipm 2.4.0 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3876,6 +3876,8 @@
3876
3876
  <xsl:param name="svg_images"/> <!-- svg images array -->
3877
3877
  <xsl:variable name="images" select="document($svg_images)"/>
3878
3878
  <xsl:param name="basepath"/> <!-- base path for images -->
3879
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
3880
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
3879
3881
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
3880
3882
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
3881
3883
  <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 -->
@@ -3928,6 +3930,20 @@
3928
3930
  <xsl:call-template name="getLang"/>
3929
3931
  </xsl:variable>
3930
3932
 
3933
+ <xsl:variable name="inputxml_filename_prefix">
3934
+ <xsl:choose>
3935
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
3936
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
3937
+ </xsl:when>
3938
+ <xsl:when test="contains($inputxml_filename, '.xml')">
3939
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
3940
+ </xsl:when>
3941
+ <xsl:otherwise>
3942
+ <xsl:value-of select="$inputxml_filename"/>
3943
+ </xsl:otherwise>
3944
+ </xsl:choose>
3945
+ </xsl:variable>
3946
+
3931
3947
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
3932
3948
  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>,
3933
3949
  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 -->
@@ -4391,6 +4407,10 @@
4391
4407
 
4392
4408
  </xsl:attribute-set>
4393
4409
 
4410
+ <xsl:template name="refine_termexample-style">
4411
+
4412
+ </xsl:template>
4413
+
4394
4414
  <xsl:attribute-set name="example-style">
4395
4415
 
4396
4416
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -4872,6 +4892,14 @@
4872
4892
 
4873
4893
  </xsl:attribute-set>
4874
4894
 
4895
+ <xsl:template name="refine_figure-block-style">
4896
+
4897
+ <xsl:if test="*[local-name() = 'name']">
4898
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
4899
+ </xsl:if>
4900
+
4901
+ </xsl:template>
4902
+
4875
4903
  <xsl:attribute-set name="figure-style">
4876
4904
 
4877
4905
  </xsl:attribute-set>
@@ -5538,6 +5566,36 @@
5538
5566
  </xsl:for-each>
5539
5567
  </xsl:template>
5540
5568
 
5569
+ <xsl:template name="processMainSectionsDefault_flatxml">
5570
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
5571
+ <xsl:sort select="@displayorder" data-type="number"/>
5572
+ <xsl:variable name="flatxml">
5573
+ <xsl:apply-templates select="." mode="flatxml"/>
5574
+ </xsl:variable>
5575
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5576
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5577
+
5578
+ </xsl:for-each>
5579
+
5580
+ <xsl:for-each select="/*/*[local-name()='annex']">
5581
+ <xsl:sort select="@displayorder" data-type="number"/>
5582
+ <xsl:variable name="flatxml">
5583
+ <xsl:apply-templates select="." mode="flatxml"/>
5584
+ </xsl:variable>
5585
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5586
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5587
+ </xsl:for-each>
5588
+
5589
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5590
+ <xsl:sort select="@displayorder" data-type="number"/>
5591
+ <xsl:variable name="flatxml">
5592
+ <xsl:apply-templates select="." mode="flatxml"/>
5593
+ </xsl:variable>
5594
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
5595
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
5596
+ </xsl:for-each>
5597
+ </xsl:template>
5598
+
5541
5599
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5542
5600
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
5543
5601
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -5670,7 +5728,9 @@
5670
5728
  </xsl:template> <!-- license-statement/p -->
5671
5729
 
5672
5730
  <xsl:template match="*[local-name()='legal-statement']">
5731
+ <xsl:param name="isLegacy">false</xsl:param>
5673
5732
  <fo:block xsl:use-attribute-sets="legal-statement-style">
5733
+
5674
5734
  <xsl:apply-templates/>
5675
5735
  </fo:block>
5676
5736
  </xsl:template> <!-- legal-statement -->
@@ -5769,7 +5829,7 @@
5769
5829
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
5770
5830
 
5771
5831
  <xsl:variable name="colwidths">
5772
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
5832
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
5773
5833
  <xsl:call-template name="calculate-column-widths">
5774
5834
  <xsl:with-param name="cols-count" select="$cols-count"/>
5775
5835
  <xsl:with-param name="table" select="$simple-table"/>
@@ -5887,6 +5947,11 @@
5887
5947
  <fo:table-column column-width="{@width}"/>
5888
5948
  </xsl:for-each>
5889
5949
  </xsl:when>
5950
+ <xsl:when test="@class = 'dl'">
5951
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
5952
+ <fo:table-column column-width="{@width}"/>
5953
+ </xsl:for-each>
5954
+ </xsl:when>
5890
5955
  <xsl:otherwise>
5891
5956
  <xsl:call-template name="insertTableColumnWidth">
5892
5957
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7213,6 +7278,7 @@
7213
7278
  <!-- ===================== -->
7214
7279
  <!-- Definition List -->
7215
7280
  <!-- ===================== -->
7281
+
7216
7282
  <xsl:template match="*[local-name()='dl']">
7217
7283
  <xsl:variable name="isAdded" select="@added"/>
7218
7284
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -7426,10 +7492,21 @@
7426
7492
  </xsl:variable>
7427
7493
 
7428
7494
  <xsl:variable name="colwidths">
7429
- <xsl:call-template name="calculate-column-widths">
7430
- <xsl:with-param name="cols-count" select="2"/>
7431
- <xsl:with-param name="table" select="$simple-table"/>
7432
- </xsl:call-template>
7495
+ <xsl:choose>
7496
+ <!-- dl from table[@class='dl'] -->
7497
+ <xsl:when test="*[local-name() = 'colgroup']">
7498
+ <autolayout/>
7499
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
7500
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
7501
+ </xsl:for-each>
7502
+ </xsl:when>
7503
+ <xsl:otherwise>
7504
+ <xsl:call-template name="calculate-column-widths">
7505
+ <xsl:with-param name="cols-count" select="2"/>
7506
+ <xsl:with-param name="table" select="$simple-table"/>
7507
+ </xsl:call-template>
7508
+ </xsl:otherwise>
7509
+ </xsl:choose>
7433
7510
  </xsl:variable>
7434
7511
 
7435
7512
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -7675,13 +7752,13 @@
7675
7752
  <tr>
7676
7753
  <td>
7677
7754
  <xsl:attribute name="id">
7678
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
7755
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
7679
7756
  </xsl:attribute>
7680
7757
  <xsl:apply-templates/>
7681
7758
  </td>
7682
7759
  <td>
7683
7760
  <xsl:attribute name="id">
7684
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
7761
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
7685
7762
  </xsl:attribute>
7686
7763
 
7687
7764
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -7990,13 +8067,14 @@
7990
8067
  <!-- ================= -->
7991
8068
  <!-- Added,deleted text -->
7992
8069
  <!-- ================= -->
7993
- <xsl:template match="*[local-name()='add']" name="tag_add">
8070
+ <xsl:template match="*[local-name()='add'] | *[local-name() = 'change-open-tag'] | *[local-name() = 'change-close-tag']" name="tag_add">
7994
8071
  <xsl:param name="skip">true</xsl:param>
7995
8072
  <xsl:param name="block">false</xsl:param>
7996
8073
  <xsl:param name="type"/>
7997
8074
  <xsl:param name="text-align"/>
7998
8075
  <xsl:choose>
7999
- <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
8076
+ <xsl:when test="starts-with(., $ace_tag) or local-name() = 'change-open-tag' or local-name() = 'change-close-tag'"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start, or
8077
+ <change-open-tag>A<sub>1</sub></change-open-tag>, <change-close-tag>A<sub>1</sub></change-close-tag> -->
8000
8078
  <xsl:choose>
8001
8079
  <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
8002
8080
  <xsl:otherwise>
@@ -8004,12 +8082,32 @@
8004
8082
  <xsl:call-template name="insertTag">
8005
8083
  <xsl:with-param name="type">
8006
8084
  <xsl:choose>
8085
+ <xsl:when test="local-name() = 'change-open-tag'">start</xsl:when>
8086
+ <xsl:when test="local-name() = 'change-close-tag'">end</xsl:when>
8007
8087
  <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
8008
8088
  <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
8009
8089
  </xsl:choose>
8010
8090
  </xsl:with-param>
8011
- <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
8012
- <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
8091
+ <xsl:with-param name="kind">
8092
+ <xsl:choose>
8093
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
8094
+ <xsl:value-of select="text()"/>
8095
+ </xsl:when>
8096
+ <xsl:otherwise>
8097
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
8098
+ </xsl:otherwise>
8099
+ </xsl:choose>
8100
+ </xsl:with-param>
8101
+ <xsl:with-param name="value">
8102
+ <xsl:choose>
8103
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
8104
+ <xsl:value-of select="*[local-name() = 'sub']"/>
8105
+ </xsl:when>
8106
+ <xsl:otherwise>
8107
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
8108
+ </xsl:otherwise>
8109
+ </xsl:choose>
8110
+ </xsl:with-param>
8013
8111
  </xsl:call-template>
8014
8112
  </xsl:variable>
8015
8113
  <xsl:choose>
@@ -8269,6 +8367,10 @@
8269
8367
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
8270
8368
  </xsl:template>
8271
8369
 
8370
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
8371
+ <xsl:value-of select="."/>
8372
+ </xsl:template>
8373
+
8272
8374
  <!-- ========================= -->
8273
8375
  <!-- END Rich text formatting -->
8274
8376
  <!-- ========================= -->
@@ -8899,7 +9001,7 @@
8899
9001
  </xsl:choose>
8900
9002
  </xsl:variable>
8901
9003
  <xsl:attribute name="id">
8902
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
9004
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
8903
9005
  </xsl:attribute>
8904
9006
 
8905
9007
  <xsl:for-each select="*[local-name() = 'p']">
@@ -8907,7 +9009,7 @@
8907
9009
  <xsl:copy-of select="@*"/>
8908
9010
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
8909
9011
  <xsl:attribute name="id">
8910
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
9012
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
8911
9013
  </xsl:attribute>
8912
9014
 
8913
9015
  <!-- <xsl:copy-of select="node()" /> -->
@@ -8971,7 +9073,7 @@
8971
9073
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
8972
9074
  <xsl:copy>
8973
9075
  <xsl:attribute name="id">
8974
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
9076
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
8975
9077
  </xsl:attribute>
8976
9078
  <xsl:copy-of select="node()"/>
8977
9079
  </xsl:copy>
@@ -9530,6 +9632,12 @@
9530
9632
  <xsl:when test="@updatetype = 'true'">
9531
9633
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
9532
9634
  </xsl:when>
9635
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
9636
+ <!-- link to the PDF attachment -->
9637
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
9638
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
9639
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
9640
+ </xsl:when>
9533
9641
  <xsl:otherwise>
9534
9642
  <xsl:value-of select="normalize-space(@target)"/>
9535
9643
  </xsl:otherwise>
@@ -9956,10 +10064,7 @@
9956
10064
  <xsl:variable name="isAdded" select="@added"/>
9957
10065
  <xsl:variable name="isDeleted" select="@deleted"/>
9958
10066
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
9959
-
9960
- <xsl:if test="*[local-name() = 'name']">
9961
- <xsl:attribute name="space-after">12pt</xsl:attribute>
9962
- </xsl:if>
10067
+ <xsl:call-template name="refine_figure-block-style"/>
9963
10068
 
9964
10069
  <xsl:call-template name="setTrackChangesStyles">
9965
10070
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -10270,11 +10375,17 @@
10270
10375
  </xsl:when>
10271
10376
  <xsl:otherwise>
10272
10377
 
10378
+ <xsl:variable name="image_class" select="ancestor::*[local-name() = 'image']/@class"/>
10379
+ <xsl:variable name="ancestor_table_cell" select="normalize-space(ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"/>
10380
+
10273
10381
  <xsl:variable name="element">
10274
10382
  <xsl:choose>
10275
10383
  <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
10276
10384
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
10277
10385
  </xsl:when>
10386
+ <xsl:when test="not(ancestor::*[local-name() = 'figure'])">
10387
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
10388
+ </xsl:when>
10278
10389
  <xsl:otherwise>
10279
10390
  <fo:block xsl:use-attribute-sets="image-style">
10280
10391
  <xsl:if test="ancestor::*[local-name() = 'dt']">
@@ -10290,10 +10401,24 @@
10290
10401
  <xsl:copy-of select="@*"/>
10291
10402
  <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
10292
10403
  <fo:instream-foreign-object fox:alt-text="{$alt-text}">
10293
- <xsl:if test="$isGenerateTableIF = 'false'">
10294
- <xsl:attribute name="width">100%</xsl:attribute>
10295
- </xsl:if>
10296
- <xsl:attribute name="content-height">100%</xsl:attribute>
10404
+
10405
+ <xsl:choose>
10406
+ <xsl:when test="$image_class = 'corrigenda-tag'">
10407
+ <xsl:attribute name="fox:alt-text">CorrigendaTag</xsl:attribute>
10408
+ <xsl:attribute name="baseline-shift">-10%</xsl:attribute>
10409
+ <xsl:if test="$ancestor_table_cell = 'true'">
10410
+ <xsl:attribute name="baseline-shift">-25%</xsl:attribute>
10411
+ </xsl:if>
10412
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
10413
+ </xsl:when>
10414
+ <xsl:otherwise>
10415
+ <xsl:if test="$isGenerateTableIF = 'false'">
10416
+ <xsl:attribute name="width">100%</xsl:attribute>
10417
+ </xsl:if>
10418
+ <xsl:attribute name="content-height">100%</xsl:attribute>
10419
+ </xsl:otherwise>
10420
+ </xsl:choose>
10421
+
10297
10422
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10298
10423
  <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10299
10424
  <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
@@ -11821,7 +11946,7 @@
11821
11946
  <!-- ====== -->
11822
11947
  <xsl:template match="*[local-name() = 'termexample']">
11823
11948
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
11824
-
11949
+ <xsl:call-template name="refine_termexample-style"/>
11825
11950
  <xsl:call-template name="setBlockSpanAll"/>
11826
11951
 
11827
11952
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -12513,13 +12638,19 @@
12513
12638
  <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12514
12639
  </xsl:when>
12515
12640
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12516
- <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12641
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12642
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12643
+ </xsl:when>
12644
+ <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12517
12645
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12518
12646
  </xsl:when>
12519
12647
  </xsl:choose>
12520
12648
 
12521
12649
  </xsl:template>
12522
12650
 
12651
+ <!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
12652
+ <xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
12653
+
12523
12654
  <xsl:template match="*[local-name() = 'name']/text()">
12524
12655
  <!-- 0xA0 to space replacement -->
12525
12656
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -14124,7 +14255,7 @@
14124
14255
 
14125
14256
  <xsl:template name="printEdition">
14126
14257
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
14127
- <xsl:text> </xsl:text>
14258
+
14128
14259
  <xsl:choose>
14129
14260
  <xsl:when test="$edition_i18n != ''">
14130
14261
  <!-- Example: <edition language="fr">deuxième édition</edition> -->
@@ -14308,10 +14439,10 @@
14308
14439
 
14309
14440
  <xsl:template name="addPDFUAmeta">
14310
14441
  <pdf:catalog>
14311
- <pdf:dictionary type="normal" key="ViewerPreferences">
14312
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14313
- </pdf:dictionary>
14314
- </pdf:catalog>
14442
+ <pdf:dictionary type="normal" key="ViewerPreferences">
14443
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14444
+ </pdf:dictionary>
14445
+ </pdf:catalog>
14315
14446
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14316
14447
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14317
14448
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
@@ -14363,6 +14494,19 @@
14363
14494
  </rdf:Description>
14364
14495
  </rdf:RDF>
14365
14496
  </x:xmpmeta>
14497
+ <!-- add attachments -->
14498
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14499
+ <xsl:choose>
14500
+ <xsl:when test="normalize-space() != ''">
14501
+ <pdf:embedded-file src="{.}" filename="{@name}"/>
14502
+ </xsl:when>
14503
+ <xsl:otherwise>
14504
+ <!-- _{filename}_attachments -->
14505
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14506
+ <pdf:embedded-file src="{$url}" filename="{@name}"/>
14507
+ </xsl:otherwise>
14508
+ </xsl:choose>
14509
+ </xsl:for-each>
14366
14510
  </xsl:template> <!-- addPDFUAmeta -->
14367
14511
 
14368
14512
  <xsl:template name="getId">