metanorma-bipm 2.4.2 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 -->
@@ -4876,6 +4892,14 @@
4876
4892
 
4877
4893
  </xsl:attribute-set>
4878
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
+
4879
4903
  <xsl:attribute-set name="figure-style">
4880
4904
 
4881
4905
  </xsl:attribute-set>
@@ -5805,7 +5829,7 @@
5805
5829
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
5806
5830
 
5807
5831
  <xsl:variable name="colwidths">
5808
- <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')">
5809
5833
  <xsl:call-template name="calculate-column-widths">
5810
5834
  <xsl:with-param name="cols-count" select="$cols-count"/>
5811
5835
  <xsl:with-param name="table" select="$simple-table"/>
@@ -5923,6 +5947,11 @@
5923
5947
  <fo:table-column column-width="{@width}"/>
5924
5948
  </xsl:for-each>
5925
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>
5926
5955
  <xsl:otherwise>
5927
5956
  <xsl:call-template name="insertTableColumnWidth">
5928
5957
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7249,6 +7278,7 @@
7249
7278
  <!-- ===================== -->
7250
7279
  <!-- Definition List -->
7251
7280
  <!-- ===================== -->
7281
+
7252
7282
  <xsl:template match="*[local-name()='dl']">
7253
7283
  <xsl:variable name="isAdded" select="@added"/>
7254
7284
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -7462,10 +7492,21 @@
7462
7492
  </xsl:variable>
7463
7493
 
7464
7494
  <xsl:variable name="colwidths">
7465
- <xsl:call-template name="calculate-column-widths">
7466
- <xsl:with-param name="cols-count" select="2"/>
7467
- <xsl:with-param name="table" select="$simple-table"/>
7468
- </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>
7469
7510
  </xsl:variable>
7470
7511
 
7471
7512
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -8191,7 +8232,8 @@
8191
8232
  </xsl:template>
8192
8233
 
8193
8234
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8194
- <xsl:variable name="text" select="normalize-space(.)"/>
8235
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8236
+ <xsl:variable name="text" select="."/>
8195
8237
  <fo:inline font-size="75%" role="SKIP">
8196
8238
  <xsl:if test="string-length($text) &gt; 0">
8197
8239
  <xsl:variable name="smallCapsText">
@@ -9591,6 +9633,12 @@
9591
9633
  <xsl:when test="@updatetype = 'true'">
9592
9634
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
9593
9635
  </xsl:when>
9636
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
9637
+ <!-- link to the PDF attachment -->
9638
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
9639
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
9640
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
9641
+ </xsl:when>
9594
9642
  <xsl:otherwise>
9595
9643
  <xsl:value-of select="normalize-space(@target)"/>
9596
9644
  </xsl:otherwise>
@@ -10017,10 +10065,7 @@
10017
10065
  <xsl:variable name="isAdded" select="@added"/>
10018
10066
  <xsl:variable name="isDeleted" select="@deleted"/>
10019
10067
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
10020
-
10021
- <xsl:if test="*[local-name() = 'name']">
10022
- <xsl:attribute name="space-after">12pt</xsl:attribute>
10023
- </xsl:if>
10068
+ <xsl:call-template name="refine_figure-block-style"/>
10024
10069
 
10025
10070
  <xsl:call-template name="setTrackChangesStyles">
10026
10071
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -10376,16 +10421,44 @@
10376
10421
  </xsl:choose>
10377
10422
 
10378
10423
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10379
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10380
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10424
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10425
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10426
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10427
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10428
+
10429
+ <!-- Example: -->
10381
10430
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10382
10431
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10383
10432
  <!-- effective height / width = 1.48, 1.4 - with title -->
10384
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10433
+
10434
+ <xsl:variable name="scale_x">
10435
+ <xsl:choose>
10436
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10437
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10438
+ </xsl:when>
10439
+ <xsl:otherwise>1</xsl:otherwise>
10440
+ </xsl:choose>
10441
+ </xsl:variable>
10442
+ <xsl:variable name="scale_y">
10443
+ <xsl:choose>
10444
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10445
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10446
+ </xsl:when>
10447
+ <xsl:otherwise>1</xsl:otherwise>
10448
+ </xsl:choose>
10449
+ </xsl:variable>
10450
+
10451
+ <!-- for images with big height -->
10452
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10385
10453
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10386
10454
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10387
- </xsl:if>
10455
+ </xsl:if> -->
10388
10456
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10457
+
10458
+ <xsl:if test="$scale_y != 1">
10459
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10460
+ </xsl:if>
10461
+
10389
10462
  <xsl:copy-of select="$svg_content"/>
10390
10463
  </fo:instream-foreign-object>
10391
10464
  <!-- </fo:block> -->
@@ -10423,8 +10496,12 @@
10423
10496
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10424
10497
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10425
10498
 
10499
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10500
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10501
+
10426
10502
  <xsl:attribute name="width">
10427
10503
  <xsl:choose>
10504
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10428
10505
  <xsl:when test="$width != ''">
10429
10506
  <xsl:value-of select="round($width)"/>
10430
10507
  </xsl:when>
@@ -10433,6 +10510,7 @@
10433
10510
  </xsl:attribute>
10434
10511
  <xsl:attribute name="height">
10435
10512
  <xsl:choose>
10513
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10436
10514
  <xsl:when test="$height != ''">
10437
10515
  <xsl:value-of select="round($height)"/>
10438
10516
  </xsl:when>
@@ -10444,6 +10522,28 @@
10444
10522
  </xsl:copy>
10445
10523
  </xsl:template>
10446
10524
 
10525
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10526
+ <!-- image[@width]/svg -->
10527
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10528
+ <xsl:attribute name="width">
10529
+ <xsl:choose>
10530
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10531
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10532
+ </xsl:choose>
10533
+ </xsl:attribute>
10534
+ </xsl:template>
10535
+
10536
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10537
+ <!-- image[@height]/svg -->
10538
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10539
+ <xsl:attribute name="height">
10540
+ <xsl:choose>
10541
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10542
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10543
+ </xsl:choose>
10544
+ </xsl:attribute>
10545
+ </xsl:template>
10546
+
10447
10547
  <!-- regex for 'display: inline-block;' -->
10448
10548
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10449
10549
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12528,7 +12628,9 @@
12528
12628
  </xsl:template> <!-- sections_element_style -->
12529
12629
 
12530
12630
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12531
- <fo:block break-after="page"/>
12631
+
12632
+ <fo:block break-after="page"/>
12633
+
12532
12634
  <fo:block>
12533
12635
  <xsl:call-template name="setId"/>
12534
12636
  <xsl:apply-templates/>
@@ -12597,7 +12699,7 @@
12597
12699
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12598
12700
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12599
12701
  </xsl:when>
12600
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12702
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12601
12703
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12602
12704
  </xsl:when>
12603
12705
  </xsl:choose>
@@ -14395,10 +14497,10 @@
14395
14497
 
14396
14498
  <xsl:template name="addPDFUAmeta">
14397
14499
  <pdf:catalog>
14398
- <pdf:dictionary type="normal" key="ViewerPreferences">
14399
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14400
- </pdf:dictionary>
14401
- </pdf:catalog>
14500
+ <pdf:dictionary type="normal" key="ViewerPreferences">
14501
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14502
+ </pdf:dictionary>
14503
+ </pdf:catalog>
14402
14504
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14403
14505
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14404
14506
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
@@ -14450,6 +14552,19 @@
14450
14552
  </rdf:Description>
14451
14553
  </rdf:RDF>
14452
14554
  </x:xmpmeta>
14555
+ <!-- add attachments -->
14556
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14557
+ <xsl:choose>
14558
+ <xsl:when test="normalize-space() != ''">
14559
+ <pdf:embedded-file src="{.}" filename="{@name}"/>
14560
+ </xsl:when>
14561
+ <xsl:otherwise>
14562
+ <!-- _{filename}_attachments -->
14563
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14564
+ <pdf:embedded-file src="{$url}" filename="{@name}"/>
14565
+ </xsl:otherwise>
14566
+ </xsl:choose>
14567
+ </xsl:for-each>
14453
14568
  </xsl:template> <!-- addPDFUAmeta -->
14454
14569
 
14455
14570
  <xsl:template name="getId">
@@ -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 -->
@@ -4876,6 +4892,14 @@
4876
4892
 
4877
4893
  </xsl:attribute-set>
4878
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
+
4879
4903
  <xsl:attribute-set name="figure-style">
4880
4904
 
4881
4905
  </xsl:attribute-set>
@@ -5805,7 +5829,7 @@
5805
5829
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
5806
5830
 
5807
5831
  <xsl:variable name="colwidths">
5808
- <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')">
5809
5833
  <xsl:call-template name="calculate-column-widths">
5810
5834
  <xsl:with-param name="cols-count" select="$cols-count"/>
5811
5835
  <xsl:with-param name="table" select="$simple-table"/>
@@ -5923,6 +5947,11 @@
5923
5947
  <fo:table-column column-width="{@width}"/>
5924
5948
  </xsl:for-each>
5925
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>
5926
5955
  <xsl:otherwise>
5927
5956
  <xsl:call-template name="insertTableColumnWidth">
5928
5957
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7249,6 +7278,7 @@
7249
7278
  <!-- ===================== -->
7250
7279
  <!-- Definition List -->
7251
7280
  <!-- ===================== -->
7281
+
7252
7282
  <xsl:template match="*[local-name()='dl']">
7253
7283
  <xsl:variable name="isAdded" select="@added"/>
7254
7284
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -7462,10 +7492,21 @@
7462
7492
  </xsl:variable>
7463
7493
 
7464
7494
  <xsl:variable name="colwidths">
7465
- <xsl:call-template name="calculate-column-widths">
7466
- <xsl:with-param name="cols-count" select="2"/>
7467
- <xsl:with-param name="table" select="$simple-table"/>
7468
- </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>
7469
7510
  </xsl:variable>
7470
7511
 
7471
7512
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -8191,7 +8232,8 @@
8191
8232
  </xsl:template>
8192
8233
 
8193
8234
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8194
- <xsl:variable name="text" select="normalize-space(.)"/>
8235
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8236
+ <xsl:variable name="text" select="."/>
8195
8237
  <fo:inline font-size="75%" role="SKIP">
8196
8238
  <xsl:if test="string-length($text) &gt; 0">
8197
8239
  <xsl:variable name="smallCapsText">
@@ -9591,6 +9633,12 @@
9591
9633
  <xsl:when test="@updatetype = 'true'">
9592
9634
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
9593
9635
  </xsl:when>
9636
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
9637
+ <!-- link to the PDF attachment -->
9638
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
9639
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
9640
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
9641
+ </xsl:when>
9594
9642
  <xsl:otherwise>
9595
9643
  <xsl:value-of select="normalize-space(@target)"/>
9596
9644
  </xsl:otherwise>
@@ -10017,10 +10065,7 @@
10017
10065
  <xsl:variable name="isAdded" select="@added"/>
10018
10066
  <xsl:variable name="isDeleted" select="@deleted"/>
10019
10067
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
10020
-
10021
- <xsl:if test="*[local-name() = 'name']">
10022
- <xsl:attribute name="space-after">12pt</xsl:attribute>
10023
- </xsl:if>
10068
+ <xsl:call-template name="refine_figure-block-style"/>
10024
10069
 
10025
10070
  <xsl:call-template name="setTrackChangesStyles">
10026
10071
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -10376,16 +10421,44 @@
10376
10421
  </xsl:choose>
10377
10422
 
10378
10423
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
10379
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
10380
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
10424
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
10425
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
10426
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
10427
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
10428
+
10429
+ <!-- Example: -->
10381
10430
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
10382
10431
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
10383
10432
  <!-- effective height / width = 1.48, 1.4 - with title -->
10384
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
10433
+
10434
+ <xsl:variable name="scale_x">
10435
+ <xsl:choose>
10436
+ <xsl:when test="$svg_width &gt; $width_effective_px">
10437
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
10438
+ </xsl:when>
10439
+ <xsl:otherwise>1</xsl:otherwise>
10440
+ </xsl:choose>
10441
+ </xsl:variable>
10442
+ <xsl:variable name="scale_y">
10443
+ <xsl:choose>
10444
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
10445
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
10446
+ </xsl:when>
10447
+ <xsl:otherwise>1</xsl:otherwise>
10448
+ </xsl:choose>
10449
+ </xsl:variable>
10450
+
10451
+ <!-- for images with big height -->
10452
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
10385
10453
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
10386
10454
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
10387
- </xsl:if>
10455
+ </xsl:if> -->
10388
10456
  <xsl:attribute name="scaling">uniform</xsl:attribute>
10457
+
10458
+ <xsl:if test="$scale_y != 1">
10459
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
10460
+ </xsl:if>
10461
+
10389
10462
  <xsl:copy-of select="$svg_content"/>
10390
10463
  </fo:instream-foreign-object>
10391
10464
  <!-- </fo:block> -->
@@ -10423,8 +10496,12 @@
10423
10496
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
10424
10497
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
10425
10498
 
10499
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
10500
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
10501
+
10426
10502
  <xsl:attribute name="width">
10427
10503
  <xsl:choose>
10504
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10428
10505
  <xsl:when test="$width != ''">
10429
10506
  <xsl:value-of select="round($width)"/>
10430
10507
  </xsl:when>
@@ -10433,6 +10510,7 @@
10433
10510
  </xsl:attribute>
10434
10511
  <xsl:attribute name="height">
10435
10512
  <xsl:choose>
10513
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10436
10514
  <xsl:when test="$height != ''">
10437
10515
  <xsl:value-of select="round($height)"/>
10438
10516
  </xsl:when>
@@ -10444,6 +10522,28 @@
10444
10522
  </xsl:copy>
10445
10523
  </xsl:template>
10446
10524
 
10525
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
10526
+ <!-- image[@width]/svg -->
10527
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10528
+ <xsl:attribute name="width">
10529
+ <xsl:choose>
10530
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10531
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10532
+ </xsl:choose>
10533
+ </xsl:attribute>
10534
+ </xsl:template>
10535
+
10536
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
10537
+ <!-- image[@height]/svg -->
10538
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10539
+ <xsl:attribute name="height">
10540
+ <xsl:choose>
10541
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10542
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10543
+ </xsl:choose>
10544
+ </xsl:attribute>
10545
+ </xsl:template>
10546
+
10447
10547
  <!-- regex for 'display: inline-block;' -->
10448
10548
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
10449
10549
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -12528,7 +12628,9 @@
12528
12628
  </xsl:template> <!-- sections_element_style -->
12529
12629
 
12530
12630
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
12531
- <fo:block break-after="page"/>
12631
+
12632
+ <fo:block break-after="page"/>
12633
+
12532
12634
  <fo:block>
12533
12635
  <xsl:call-template name="setId"/>
12534
12636
  <xsl:apply-templates/>
@@ -12597,7 +12699,7 @@
12597
12699
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12598
12700
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12599
12701
  </xsl:when>
12600
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12702
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12601
12703
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12602
12704
  </xsl:when>
12603
12705
  </xsl:choose>
@@ -14395,10 +14497,10 @@
14395
14497
 
14396
14498
  <xsl:template name="addPDFUAmeta">
14397
14499
  <pdf:catalog>
14398
- <pdf:dictionary type="normal" key="ViewerPreferences">
14399
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14400
- </pdf:dictionary>
14401
- </pdf:catalog>
14500
+ <pdf:dictionary type="normal" key="ViewerPreferences">
14501
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
14502
+ </pdf:dictionary>
14503
+ </pdf:catalog>
14402
14504
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14403
14505
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14404
14506
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
@@ -14450,6 +14552,19 @@
14450
14552
  </rdf:Description>
14451
14553
  </rdf:RDF>
14452
14554
  </x:xmpmeta>
14555
+ <!-- add attachments -->
14556
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14557
+ <xsl:choose>
14558
+ <xsl:when test="normalize-space() != ''">
14559
+ <pdf:embedded-file src="{.}" filename="{@name}"/>
14560
+ </xsl:when>
14561
+ <xsl:otherwise>
14562
+ <!-- _{filename}_attachments -->
14563
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14564
+ <pdf:embedded-file src="{$url}" filename="{@name}"/>
14565
+ </xsl:otherwise>
14566
+ </xsl:choose>
14567
+ </xsl:for-each>
14453
14568
  </xsl:template> <!-- addPDFUAmeta -->
14454
14569
 
14455
14570
  <xsl:template name="getId">
@@ -21,6 +21,12 @@
21
21
  <span class="docnumber">{{ docnumber }}</span>
22
22
  <span class="docnumber-separator">:</span>
23
23
  <span class="docyear">{{ docyear }} {{ draftinfo }}</span>
24
+ {% if version %}
25
+ <br/>{{ labels["version"] }}: {{ version }}
26
+ {% endif %}
27
+ {% if revdate %}
28
+ <br/>{{ labels["date"] }}: {{ revdate }}
29
+ {% endif %}
24
30
  </div>
25
31
 
26
32
  <div class="coverpage-logo">
@@ -73,10 +79,18 @@
73
79
  {% if authors %}
74
80
  <div class="coverpage-tc-name">
75
81
  {% for item in authors %}
76
- <span>{{item}} {% if authors_affiliations[forloop.index0] %}({{ authors_affiliations[forloop.index0] }}){% endif %}{% if forloop.last == false %}, {% endif %}{% endfor %}.
82
+ <span>{{item}}{% if authors_affiliations[forloop.index0] != "" %} ({{ authors_affiliations[forloop.index0] }}){% endif %}{% if forloop.last == false %}, {% endif %}</span>{% endfor %}.
77
83
  </div>
78
84
  {% endif %}
79
85
 
86
+ {% if authorizer %}
87
+ <div class="coverpage-tc-name">
88
+ {{ labels["authorized"] }}:
89
+ {% for item in authorizer %}
90
+ <span>{{item}}{% if forloop.last == false %}, {% endif %}</span>{% endfor %}
91
+ </div>
92
+ {% endif %}
93
+
80
94
  <div class="coverpage-warning" id="coverpage-note-destination"/>
81
95
 
82
96
  </div>
@@ -231,6 +231,12 @@ table.rouge-line-table pre {
231
231
  #strategy {
232
232
  border-bottom: solid 3px #BD9391; }
233
233
 
234
+ #policy-band {
235
+ background-color: #BD9391; }
236
+
237
+ #policy {
238
+ border-bottom: solid 3px #BD9391; }
239
+
234
240
  #cipm-mra-band {
235
241
  background-color: #004E64; }
236
242
 
@@ -17,6 +17,7 @@ $doctype-colors-list: (
17
17
  technical-report: #C84630,
18
18
  working-part-note: #BFAE48,
19
19
  strategy: #BD9391,
20
+ policy: #BD9391,
20
21
  cipm-mra: #004E64,
21
22
  resolution: #53C170
22
23
  );
@@ -25,3 +25,5 @@ note: "Note:"
25
25
  prefacenote: "NOTE:"
26
26
  listnote: "Note:"
27
27
  termnote: "Note % to entry:"
28
+ date: Date
29
+ authorized: Authorized
@@ -48,3 +48,5 @@ note: "Note:"
48
48
  prefacenote: "NOTE:"
49
49
  listnote: "Remarque:"
50
50
  termnote: "Note % à l’article:"
51
+ date: Date
52
+ authorized: Autorisé
@@ -20,6 +20,11 @@ module IsoDoc
20
20
  i18nyaml: i18nyaml || @i18nyaml)
21
21
  end
22
22
 
23
+ def bibrenderer(options = {})
24
+ ::Relaton::Render::BIPM::General.new(options.merge(language: @lang,
25
+ i18nhash: @i18n.get))
26
+ end
27
+
23
28
  def omit_docid_prefix(prefix)
24
29
  %w(BIPM BIPM-long).include? prefix and return true
25
30
  super