metanorma-ogc 2.5.2 → 2.5.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: ed52d084ad8d9bcd783e6cc8c8e5564a1eeae09d007ab43177681331be41d366
4
- data.tar.gz: 8619fdaf6d0d8b7de450ba16383dd1ed1d2ece1fd903f80034d138873067b5a4
3
+ metadata.gz: f5b7bc9526465aeb1342c9c40c24ca19acf01c1033325648a13725cfb660ffcc
4
+ data.tar.gz: 5dda146079759e69208a3349bacc4bf8964b67eb201aa3590f2053a2fc0cd16f
5
5
  SHA512:
6
- metadata.gz: 22bc6e3c49034f83122b1407d35010fd8ba4a6aae483206c2c169568cde528d37fa8514afe387b7e1a83ae2124edd17ba18bee22fdbf390b8929fe5e881ad12f
7
- data.tar.gz: 930ee5cc2220a4c492ac73a7355b7c5684aa9be9b33ccc8a0721ddabbcfa22073dc4cfdf0131460a8998ede9749c9bde90e13ef8648f6ff9a2e6840d111ae81f
6
+ metadata.gz: cce390cedf519a9a6e0d3b2a5c214b3c6431b05aaea86b1e3f03413f3dac9681b09edd684c4773e9d6eec5f804db2999cefc04d53cd3edb0b6adb5f74c6a958c
7
+ data.tar.gz: ce4b59d8cae0ec31c4c141f1806f89a929aa4091bf7a936c6c9d2fc3239e7041b853fcc56df969397c7d7fdf0b1cc09ca2df09faf907b345f90d5003f00acb5f
@@ -35,7 +35,7 @@ submission_date: Submission Date
35
35
  approval_date: Approval Date
36
36
  publication_date: Publication Date
37
37
  author: Author
38
- editor: Editor
38
+ editor_full: Editor
39
39
  contributor: Contributor
40
40
  stage_dict:
41
41
  draft: Draft
@@ -20,6 +20,11 @@ module IsoDoc
20
20
  i18nyaml: i18nyaml || @i18nyaml)
21
21
  end
22
22
 
23
+ def bibrenderer(options = {})
24
+ ::Relaton::Render::Ogc::General.new(options.merge(language: @lang,
25
+ i18nhash: @i18n.get))
26
+ end
27
+
23
28
  def fileloc(loc)
24
29
  File.join(File.dirname(__FILE__), loc)
25
30
  end
@@ -386,7 +386,7 @@
386
386
  <fo:inline font-weight="bold">
387
387
  <!-- Editor: -->
388
388
  <xsl:call-template name="getLocalizedString">
389
- <xsl:with-param name="key">editor</xsl:with-param>
389
+ <xsl:with-param name="key">editor_full</xsl:with-param>
390
390
  </xsl:call-template><xsl:text>: </xsl:text>
391
391
  </fo:inline>
392
392
  <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename">
@@ -1577,6 +1577,8 @@
1577
1577
  <xsl:param name="svg_images"/> <!-- svg images array -->
1578
1578
  <xsl:variable name="images" select="document($svg_images)"/>
1579
1579
  <xsl:param name="basepath"/> <!-- base path for images -->
1580
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
1581
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
1580
1582
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
1581
1583
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
1582
1584
  <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 -->
@@ -1629,6 +1631,20 @@
1629
1631
  <xsl:call-template name="getLang"/>
1630
1632
  </xsl:variable>
1631
1633
 
1634
+ <xsl:variable name="inputxml_filename_prefix">
1635
+ <xsl:choose>
1636
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
1637
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
1638
+ </xsl:when>
1639
+ <xsl:when test="contains($inputxml_filename, '.xml')">
1640
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
1641
+ </xsl:when>
1642
+ <xsl:otherwise>
1643
+ <xsl:value-of select="$inputxml_filename"/>
1644
+ </xsl:otherwise>
1645
+ </xsl:choose>
1646
+ </xsl:variable>
1647
+
1632
1648
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
1633
1649
  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>,
1634
1650
  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 -->
@@ -2657,6 +2673,10 @@
2657
2673
 
2658
2674
  </xsl:attribute-set>
2659
2675
 
2676
+ <xsl:template name="refine_figure-block-style">
2677
+
2678
+ </xsl:template>
2679
+
2660
2680
  <xsl:attribute-set name="figure-style">
2661
2681
 
2662
2682
  </xsl:attribute-set>
@@ -3609,7 +3629,7 @@
3609
3629
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3610
3630
 
3611
3631
  <xsl:variable name="colwidths">
3612
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3632
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
3613
3633
  <xsl:call-template name="calculate-column-widths">
3614
3634
  <xsl:with-param name="cols-count" select="$cols-count"/>
3615
3635
  <xsl:with-param name="table" select="$simple-table"/>
@@ -3727,6 +3747,11 @@
3727
3747
  <fo:table-column column-width="{@width}"/>
3728
3748
  </xsl:for-each>
3729
3749
  </xsl:when>
3750
+ <xsl:when test="@class = 'dl'">
3751
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
3752
+ <fo:table-column column-width="{@width}"/>
3753
+ </xsl:for-each>
3754
+ </xsl:when>
3730
3755
  <xsl:otherwise>
3731
3756
  <xsl:call-template name="insertTableColumnWidth">
3732
3757
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -5010,6 +5035,7 @@
5010
5035
  <!-- ===================== -->
5011
5036
  <!-- Definition List -->
5012
5037
  <!-- ===================== -->
5038
+
5013
5039
  <xsl:template match="*[local-name()='dl']">
5014
5040
  <xsl:variable name="isAdded" select="@added"/>
5015
5041
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5222,10 +5248,21 @@
5222
5248
  </xsl:variable>
5223
5249
 
5224
5250
  <xsl:variable name="colwidths">
5225
- <xsl:call-template name="calculate-column-widths">
5226
- <xsl:with-param name="cols-count" select="2"/>
5227
- <xsl:with-param name="table" select="$simple-table"/>
5228
- </xsl:call-template>
5251
+ <xsl:choose>
5252
+ <!-- dl from table[@class='dl'] -->
5253
+ <xsl:when test="*[local-name() = 'colgroup']">
5254
+ <autolayout/>
5255
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
5256
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
5257
+ </xsl:for-each>
5258
+ </xsl:when>
5259
+ <xsl:otherwise>
5260
+ <xsl:call-template name="calculate-column-widths">
5261
+ <xsl:with-param name="cols-count" select="2"/>
5262
+ <xsl:with-param name="table" select="$simple-table"/>
5263
+ </xsl:call-template>
5264
+ </xsl:otherwise>
5265
+ </xsl:choose>
5229
5266
  </xsl:variable>
5230
5267
 
5231
5268
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -5963,7 +6000,8 @@
5963
6000
  </xsl:template>
5964
6001
 
5965
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5966
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
5967
6005
  <fo:inline font-size="75%" role="SKIP">
5968
6006
  <xsl:if test="string-length($text) &gt; 0">
5969
6007
  <xsl:variable name="smallCapsText">
@@ -7331,6 +7369,12 @@
7331
7369
  <xsl:when test="@updatetype = 'true'">
7332
7370
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7333
7371
  </xsl:when>
7372
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7373
+ <!-- link to the PDF attachment -->
7374
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7375
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7376
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7377
+ </xsl:when>
7334
7378
  <xsl:otherwise>
7335
7379
  <xsl:value-of select="normalize-space(@target)"/>
7336
7380
  </xsl:otherwise>
@@ -7744,6 +7788,7 @@
7744
7788
  <xsl:variable name="isAdded" select="@added"/>
7745
7789
  <xsl:variable name="isDeleted" select="@deleted"/>
7746
7790
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
7791
+ <xsl:call-template name="refine_figure-block-style"/>
7747
7792
 
7748
7793
  <xsl:call-template name="setTrackChangesStyles">
7749
7794
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8099,16 +8144,44 @@
8099
8144
  </xsl:choose>
8100
8145
 
8101
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8102
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8103
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8104
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8105
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8106
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8107
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8108
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8109
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8110
- </xsl:if>
8178
+ </xsl:if> -->
8111
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8112
8185
  <xsl:copy-of select="$svg_content"/>
8113
8186
  </fo:instream-foreign-object>
8114
8187
  <!-- </fo:block> -->
@@ -8146,8 +8219,12 @@
8146
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8147
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8148
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8149
8225
  <xsl:attribute name="width">
8150
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8151
8228
  <xsl:when test="$width != ''">
8152
8229
  <xsl:value-of select="round($width)"/>
8153
8230
  </xsl:when>
@@ -8156,6 +8233,7 @@
8156
8233
  </xsl:attribute>
8157
8234
  <xsl:attribute name="height">
8158
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8159
8237
  <xsl:when test="$height != ''">
8160
8238
  <xsl:value-of select="round($height)"/>
8161
8239
  </xsl:when>
@@ -8167,6 +8245,28 @@
8167
8245
  </xsl:copy>
8168
8246
  </xsl:template>
8169
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8170
8270
  <!-- regex for 'display: inline-block;' -->
8171
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8172
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10287,7 +10387,9 @@
10287
10387
  </xsl:template> <!-- sections_element_style -->
10288
10388
 
10289
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10290
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10291
10393
  <fo:block>
10292
10394
  <xsl:call-template name="setId"/>
10293
10395
  <xsl:apply-templates/>
@@ -10354,7 +10456,7 @@
10354
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10355
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10356
10458
  </xsl:when>
10357
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10358
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10359
10461
  </xsl:when>
10360
10462
  </xsl:choose>
@@ -12150,10 +12252,10 @@
12150
12252
 
12151
12253
  <xsl:template name="addPDFUAmeta">
12152
12254
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
12153
- <pdf:dictionary type="normal" key="ViewerPreferences">
12154
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
12155
- </pdf:dictionary>
12156
- </pdf:catalog>
12255
+ <pdf:dictionary type="normal" key="ViewerPreferences">
12256
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
12257
+ </pdf:dictionary>
12258
+ </pdf:catalog>
12157
12259
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
12158
12260
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
12159
12261
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -12205,6 +12307,19 @@
12205
12307
  </rdf:Description>
12206
12308
  </rdf:RDF>
12207
12309
  </x:xmpmeta>
12310
+ <!-- add attachments -->
12311
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12312
+ <xsl:choose>
12313
+ <xsl:when test="normalize-space() != ''">
12314
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
12315
+ </xsl:when>
12316
+ <xsl:otherwise>
12317
+ <!-- _{filename}_attachments -->
12318
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12319
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12320
+ </xsl:otherwise>
12321
+ </xsl:choose>
12322
+ </xsl:for-each>
12208
12323
  </xsl:template> <!-- addPDFUAmeta -->
12209
12324
 
12210
12325
  <xsl:template name="getId">
@@ -386,7 +386,7 @@
386
386
  <fo:inline font-weight="bold">
387
387
  <!-- Editor: -->
388
388
  <xsl:call-template name="getLocalizedString">
389
- <xsl:with-param name="key">editor</xsl:with-param>
389
+ <xsl:with-param name="key">editor_full</xsl:with-param>
390
390
  </xsl:call-template><xsl:text>: </xsl:text>
391
391
  </fo:inline>
392
392
  <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename">
@@ -1577,6 +1577,8 @@
1577
1577
  <xsl:param name="svg_images"/> <!-- svg images array -->
1578
1578
  <xsl:variable name="images" select="document($svg_images)"/>
1579
1579
  <xsl:param name="basepath"/> <!-- base path for images -->
1580
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
1581
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
1580
1582
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
1581
1583
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
1582
1584
  <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 -->
@@ -1629,6 +1631,20 @@
1629
1631
  <xsl:call-template name="getLang"/>
1630
1632
  </xsl:variable>
1631
1633
 
1634
+ <xsl:variable name="inputxml_filename_prefix">
1635
+ <xsl:choose>
1636
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
1637
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
1638
+ </xsl:when>
1639
+ <xsl:when test="contains($inputxml_filename, '.xml')">
1640
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
1641
+ </xsl:when>
1642
+ <xsl:otherwise>
1643
+ <xsl:value-of select="$inputxml_filename"/>
1644
+ </xsl:otherwise>
1645
+ </xsl:choose>
1646
+ </xsl:variable>
1647
+
1632
1648
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
1633
1649
  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>,
1634
1650
  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 -->
@@ -2657,6 +2673,10 @@
2657
2673
 
2658
2674
  </xsl:attribute-set>
2659
2675
 
2676
+ <xsl:template name="refine_figure-block-style">
2677
+
2678
+ </xsl:template>
2679
+
2660
2680
  <xsl:attribute-set name="figure-style">
2661
2681
 
2662
2682
  </xsl:attribute-set>
@@ -3609,7 +3629,7 @@
3609
3629
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3610
3630
 
3611
3631
  <xsl:variable name="colwidths">
3612
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3632
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
3613
3633
  <xsl:call-template name="calculate-column-widths">
3614
3634
  <xsl:with-param name="cols-count" select="$cols-count"/>
3615
3635
  <xsl:with-param name="table" select="$simple-table"/>
@@ -3727,6 +3747,11 @@
3727
3747
  <fo:table-column column-width="{@width}"/>
3728
3748
  </xsl:for-each>
3729
3749
  </xsl:when>
3750
+ <xsl:when test="@class = 'dl'">
3751
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
3752
+ <fo:table-column column-width="{@width}"/>
3753
+ </xsl:for-each>
3754
+ </xsl:when>
3730
3755
  <xsl:otherwise>
3731
3756
  <xsl:call-template name="insertTableColumnWidth">
3732
3757
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -5010,6 +5035,7 @@
5010
5035
  <!-- ===================== -->
5011
5036
  <!-- Definition List -->
5012
5037
  <!-- ===================== -->
5038
+
5013
5039
  <xsl:template match="*[local-name()='dl']">
5014
5040
  <xsl:variable name="isAdded" select="@added"/>
5015
5041
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5222,10 +5248,21 @@
5222
5248
  </xsl:variable>
5223
5249
 
5224
5250
  <xsl:variable name="colwidths">
5225
- <xsl:call-template name="calculate-column-widths">
5226
- <xsl:with-param name="cols-count" select="2"/>
5227
- <xsl:with-param name="table" select="$simple-table"/>
5228
- </xsl:call-template>
5251
+ <xsl:choose>
5252
+ <!-- dl from table[@class='dl'] -->
5253
+ <xsl:when test="*[local-name() = 'colgroup']">
5254
+ <autolayout/>
5255
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
5256
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
5257
+ </xsl:for-each>
5258
+ </xsl:when>
5259
+ <xsl:otherwise>
5260
+ <xsl:call-template name="calculate-column-widths">
5261
+ <xsl:with-param name="cols-count" select="2"/>
5262
+ <xsl:with-param name="table" select="$simple-table"/>
5263
+ </xsl:call-template>
5264
+ </xsl:otherwise>
5265
+ </xsl:choose>
5229
5266
  </xsl:variable>
5230
5267
 
5231
5268
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -5963,7 +6000,8 @@
5963
6000
  </xsl:template>
5964
6001
 
5965
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5966
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
5967
6005
  <fo:inline font-size="75%" role="SKIP">
5968
6006
  <xsl:if test="string-length($text) &gt; 0">
5969
6007
  <xsl:variable name="smallCapsText">
@@ -7331,6 +7369,12 @@
7331
7369
  <xsl:when test="@updatetype = 'true'">
7332
7370
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7333
7371
  </xsl:when>
7372
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7373
+ <!-- link to the PDF attachment -->
7374
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7375
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7376
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7377
+ </xsl:when>
7334
7378
  <xsl:otherwise>
7335
7379
  <xsl:value-of select="normalize-space(@target)"/>
7336
7380
  </xsl:otherwise>
@@ -7744,6 +7788,7 @@
7744
7788
  <xsl:variable name="isAdded" select="@added"/>
7745
7789
  <xsl:variable name="isDeleted" select="@deleted"/>
7746
7790
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
7791
+ <xsl:call-template name="refine_figure-block-style"/>
7747
7792
 
7748
7793
  <xsl:call-template name="setTrackChangesStyles">
7749
7794
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8099,16 +8144,44 @@
8099
8144
  </xsl:choose>
8100
8145
 
8101
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8102
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8103
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8104
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8105
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8106
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8107
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8108
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8109
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8110
- </xsl:if>
8178
+ </xsl:if> -->
8111
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8112
8185
  <xsl:copy-of select="$svg_content"/>
8113
8186
  </fo:instream-foreign-object>
8114
8187
  <!-- </fo:block> -->
@@ -8146,8 +8219,12 @@
8146
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8147
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8148
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8149
8225
  <xsl:attribute name="width">
8150
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8151
8228
  <xsl:when test="$width != ''">
8152
8229
  <xsl:value-of select="round($width)"/>
8153
8230
  </xsl:when>
@@ -8156,6 +8233,7 @@
8156
8233
  </xsl:attribute>
8157
8234
  <xsl:attribute name="height">
8158
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8159
8237
  <xsl:when test="$height != ''">
8160
8238
  <xsl:value-of select="round($height)"/>
8161
8239
  </xsl:when>
@@ -8167,6 +8245,28 @@
8167
8245
  </xsl:copy>
8168
8246
  </xsl:template>
8169
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8170
8270
  <!-- regex for 'display: inline-block;' -->
8171
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8172
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10287,7 +10387,9 @@
10287
10387
  </xsl:template> <!-- sections_element_style -->
10288
10388
 
10289
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10290
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10291
10393
  <fo:block>
10292
10394
  <xsl:call-template name="setId"/>
10293
10395
  <xsl:apply-templates/>
@@ -10354,7 +10456,7 @@
10354
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10355
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10356
10458
  </xsl:when>
10357
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10358
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10359
10461
  </xsl:when>
10360
10462
  </xsl:choose>
@@ -12150,10 +12252,10 @@
12150
12252
 
12151
12253
  <xsl:template name="addPDFUAmeta">
12152
12254
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
12153
- <pdf:dictionary type="normal" key="ViewerPreferences">
12154
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
12155
- </pdf:dictionary>
12156
- </pdf:catalog>
12255
+ <pdf:dictionary type="normal" key="ViewerPreferences">
12256
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
12257
+ </pdf:dictionary>
12258
+ </pdf:catalog>
12157
12259
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
12158
12260
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
12159
12261
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -12205,6 +12307,19 @@
12205
12307
  </rdf:Description>
12206
12308
  </rdf:RDF>
12207
12309
  </x:xmpmeta>
12310
+ <!-- add attachments -->
12311
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12312
+ <xsl:choose>
12313
+ <xsl:when test="normalize-space() != ''">
12314
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
12315
+ </xsl:when>
12316
+ <xsl:otherwise>
12317
+ <!-- _{filename}_attachments -->
12318
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12319
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12320
+ </xsl:otherwise>
12321
+ </xsl:choose>
12322
+ </xsl:for-each>
12208
12323
  </xsl:template> <!-- addPDFUAmeta -->
12209
12324
 
12210
12325
  <xsl:template name="getId">