metanorma-un 0.12.16 → 0.12.17

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: a120825c98b7fc5972089995524436f6ddae471d46d1fc87437283a94623466e
4
- data.tar.gz: 28407ef4700990a45545fc019a270e27dc79e689b43c87c0828c674c6df26fa3
3
+ metadata.gz: f5f6b24d93decf498c086763d0941676076dab27298cd20aec18809c43e0280a
4
+ data.tar.gz: eccb7feb1829db83f4c029d3f019ecf38c9f23ac16e79f5f165fe4dcfbe5a2d3
5
5
  SHA512:
6
- metadata.gz: 3f20bf9892286d35c707bdc4a5db907d57bca4b2b7448fa81b0f6ca1349cee3fb5a8063f9da770d2846c1ace9ff295d6810e4030fc7e6576a84df08c9578a0ba
7
- data.tar.gz: 6e3bd86f8fee8a0a2aca2eaa9aa55432c90d8f07303edd20974c212e5ec08b55acdd6a468afa650b50bb6a2ba743ee7098130d26c2db71902a618f5182306069
6
+ metadata.gz: 66791acea79635a043524ccbaa5377efa866fb4297d8f17824a2e0471773bc46918f483bcace73d2e4b6f904d1f60c78ed23808b3735852d8b5c9db5b452f622
7
+ data.tar.gz: b371258f4f65c7c8e3aa03de22f77967c1b195c4eceba545014da418b0295f1e4ad56928c3c6c6bf77785bc9b69ae2213d94887ca641dae73e7764a754e5cc4f
@@ -6939,6 +6939,12 @@
6939
6939
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6940
6940
  <attachment filename="{@name}"/>
6941
6941
  </xsl:for-each>
6942
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
6943
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
6944
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
6945
+ <attachment filename="{$attachment_path}"/>
6946
+ </xsl:for-each>
6947
+ </xsl:if>
6942
6948
  </xsl:variable>
6943
6949
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6944
6950
 
@@ -6951,7 +6957,7 @@
6951
6957
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6952
6958
  </xsl:when>
6953
6959
  <!-- link to the PDF attachment -->
6954
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6960
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
6955
6961
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6956
6962
  </xsl:when>
6957
6963
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -7611,7 +7617,16 @@
7611
7617
  </xsl:variable>
7612
7618
  <xsl:variable name="img_src">
7613
7619
  <xsl:choose>
7614
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7620
+ <xsl:when test="not(starts-with(@src, 'data:'))">
7621
+ <xsl:choose>
7622
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7623
+ <xsl:value-of select="@src"/>
7624
+ </xsl:when>
7625
+ <xsl:otherwise>
7626
+ <xsl:value-of select="concat($basepath, @src)"/>
7627
+ </xsl:otherwise>
7628
+ </xsl:choose>
7629
+ </xsl:when>
7615
7630
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7616
7631
  </xsl:choose>
7617
7632
  </xsl:variable>
@@ -7624,7 +7639,7 @@
7624
7639
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
7625
7640
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
7626
7641
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
7627
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7642
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7628
7643
  <xsl:value-of select="$scale"/>
7629
7644
  </xsl:template>
7630
7645
 
@@ -7643,7 +7658,14 @@
7643
7658
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7644
7659
  </xsl:when>
7645
7660
  <xsl:when test="not(starts-with(@src, 'data:'))">
7646
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7661
+ <xsl:choose>
7662
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7663
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7664
+ </xsl:when>
7665
+ <xsl:otherwise>
7666
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7667
+ </xsl:otherwise>
7668
+ </xsl:choose>
7647
7669
  </xsl:when>
7648
7670
  <xsl:otherwise>
7649
7671
  <xsl:value-of select="@src"/>
@@ -7665,7 +7687,14 @@
7665
7687
  </xsl:when>
7666
7688
  <xsl:when test="not(starts-with(@src, 'data:'))">
7667
7689
  <xsl:variable name="src">
7668
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7690
+ <xsl:choose>
7691
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7692
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7693
+ </xsl:when>
7694
+ <xsl:otherwise>
7695
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7696
+ </xsl:otherwise>
7697
+ </xsl:choose>
7669
7698
  </xsl:variable>
7670
7699
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7671
7700
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -12435,26 +12464,37 @@
12435
12464
  </x:xmpmeta>
12436
12465
  <!-- add attachments -->
12437
12466
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12438
- <xsl:choose>
12439
- <xsl:when test="normalize-space() != ''">
12440
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12441
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/>
12442
- </xsl:when>
12443
- <xsl:otherwise>
12444
- <!-- _{filename}_attachments -->
12445
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12446
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12447
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12448
- </xsl:otherwise>
12449
- </xsl:choose>
12467
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12468
+
12469
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12470
+ <xsl:attribute name="src">
12471
+ <xsl:choose>
12472
+ <xsl:when test="normalize-space() != ''">
12473
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12474
+ <xsl:value-of select="$src_attachment"/>
12475
+ </xsl:when>
12476
+ <xsl:otherwise>
12477
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12478
+ <xsl:value-of select="$url"/>
12479
+ </xsl:otherwise>
12480
+ </xsl:choose>
12481
+ </xsl:attribute>
12482
+ <xsl:if test="$description != ''">
12483
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12484
+ </xsl:if>
12485
+ </pdf:embedded-file>
12450
12486
  </xsl:for-each>
12451
12487
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12452
12488
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12453
12489
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12454
12490
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12455
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
12456
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12457
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
12491
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12492
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12493
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12494
+ <xsl:if test="$description != ''">
12495
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12496
+ </xsl:if>
12497
+ </pdf:embedded-file>
12458
12498
  </xsl:for-each>
12459
12499
  </xsl:if>
12460
12500
  </xsl:template> <!-- addPDFUAmeta -->
@@ -12832,7 +12872,14 @@
12832
12872
  <xsl:value-of select="$src"/>
12833
12873
  </xsl:when>
12834
12874
  <xsl:otherwise>
12835
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12875
+ <xsl:choose>
12876
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
12877
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
12878
+ </xsl:when>
12879
+ <xsl:otherwise>
12880
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12881
+ </xsl:otherwise>
12882
+ </xsl:choose>
12836
12883
  </xsl:otherwise>
12837
12884
  </xsl:choose>
12838
12885
  </xsl:template>
@@ -6939,6 +6939,12 @@
6939
6939
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6940
6940
  <attachment filename="{@name}"/>
6941
6941
  </xsl:for-each>
6942
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
6943
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
6944
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
6945
+ <attachment filename="{$attachment_path}"/>
6946
+ </xsl:for-each>
6947
+ </xsl:if>
6942
6948
  </xsl:variable>
6943
6949
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6944
6950
 
@@ -6951,7 +6957,7 @@
6951
6957
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6952
6958
  </xsl:when>
6953
6959
  <!-- link to the PDF attachment -->
6954
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6960
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
6955
6961
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6956
6962
  </xsl:when>
6957
6963
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -7611,7 +7617,16 @@
7611
7617
  </xsl:variable>
7612
7618
  <xsl:variable name="img_src">
7613
7619
  <xsl:choose>
7614
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7620
+ <xsl:when test="not(starts-with(@src, 'data:'))">
7621
+ <xsl:choose>
7622
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7623
+ <xsl:value-of select="@src"/>
7624
+ </xsl:when>
7625
+ <xsl:otherwise>
7626
+ <xsl:value-of select="concat($basepath, @src)"/>
7627
+ </xsl:otherwise>
7628
+ </xsl:choose>
7629
+ </xsl:when>
7615
7630
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7616
7631
  </xsl:choose>
7617
7632
  </xsl:variable>
@@ -7624,7 +7639,7 @@
7624
7639
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
7625
7640
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
7626
7641
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
7627
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7642
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7628
7643
  <xsl:value-of select="$scale"/>
7629
7644
  </xsl:template>
7630
7645
 
@@ -7643,7 +7658,14 @@
7643
7658
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7644
7659
  </xsl:when>
7645
7660
  <xsl:when test="not(starts-with(@src, 'data:'))">
7646
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7661
+ <xsl:choose>
7662
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7663
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7664
+ </xsl:when>
7665
+ <xsl:otherwise>
7666
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7667
+ </xsl:otherwise>
7668
+ </xsl:choose>
7647
7669
  </xsl:when>
7648
7670
  <xsl:otherwise>
7649
7671
  <xsl:value-of select="@src"/>
@@ -7665,7 +7687,14 @@
7665
7687
  </xsl:when>
7666
7688
  <xsl:when test="not(starts-with(@src, 'data:'))">
7667
7689
  <xsl:variable name="src">
7668
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7690
+ <xsl:choose>
7691
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7692
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7693
+ </xsl:when>
7694
+ <xsl:otherwise>
7695
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7696
+ </xsl:otherwise>
7697
+ </xsl:choose>
7669
7698
  </xsl:variable>
7670
7699
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7671
7700
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -12435,26 +12464,37 @@
12435
12464
  </x:xmpmeta>
12436
12465
  <!-- add attachments -->
12437
12466
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12438
- <xsl:choose>
12439
- <xsl:when test="normalize-space() != ''">
12440
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12441
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/>
12442
- </xsl:when>
12443
- <xsl:otherwise>
12444
- <!-- _{filename}_attachments -->
12445
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12446
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12447
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12448
- </xsl:otherwise>
12449
- </xsl:choose>
12467
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12468
+
12469
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12470
+ <xsl:attribute name="src">
12471
+ <xsl:choose>
12472
+ <xsl:when test="normalize-space() != ''">
12473
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12474
+ <xsl:value-of select="$src_attachment"/>
12475
+ </xsl:when>
12476
+ <xsl:otherwise>
12477
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12478
+ <xsl:value-of select="$url"/>
12479
+ </xsl:otherwise>
12480
+ </xsl:choose>
12481
+ </xsl:attribute>
12482
+ <xsl:if test="$description != ''">
12483
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12484
+ </xsl:if>
12485
+ </pdf:embedded-file>
12450
12486
  </xsl:for-each>
12451
12487
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12452
12488
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12453
12489
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12454
12490
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12455
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
12456
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12457
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
12491
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12492
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12493
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12494
+ <xsl:if test="$description != ''">
12495
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12496
+ </xsl:if>
12497
+ </pdf:embedded-file>
12458
12498
  </xsl:for-each>
12459
12499
  </xsl:if>
12460
12500
  </xsl:template> <!-- addPDFUAmeta -->
@@ -12832,7 +12872,14 @@
12832
12872
  <xsl:value-of select="$src"/>
12833
12873
  </xsl:when>
12834
12874
  <xsl:otherwise>
12835
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12875
+ <xsl:choose>
12876
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
12877
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
12878
+ </xsl:when>
12879
+ <xsl:otherwise>
12880
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12881
+ </xsl:otherwise>
12882
+ </xsl:choose>
12836
12883
  </xsl:otherwise>
12837
12884
  </xsl:choose>
12838
12885
  </xsl:template>
@@ -7038,6 +7038,12 @@
7038
7038
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7039
7039
  <attachment filename="{@name}"/>
7040
7040
  </xsl:for-each>
7041
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
7042
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
7043
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
7044
+ <attachment filename="{$attachment_path}"/>
7045
+ </xsl:for-each>
7046
+ </xsl:if>
7041
7047
  </xsl:variable>
7042
7048
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7043
7049
 
@@ -7050,7 +7056,7 @@
7050
7056
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7051
7057
  </xsl:when>
7052
7058
  <!-- link to the PDF attachment -->
7053
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7059
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7054
7060
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7055
7061
  </xsl:when>
7056
7062
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -7710,7 +7716,16 @@
7710
7716
  </xsl:variable>
7711
7717
  <xsl:variable name="img_src">
7712
7718
  <xsl:choose>
7713
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7719
+ <xsl:when test="not(starts-with(@src, 'data:'))">
7720
+ <xsl:choose>
7721
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7722
+ <xsl:value-of select="@src"/>
7723
+ </xsl:when>
7724
+ <xsl:otherwise>
7725
+ <xsl:value-of select="concat($basepath, @src)"/>
7726
+ </xsl:otherwise>
7727
+ </xsl:choose>
7728
+ </xsl:when>
7714
7729
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7715
7730
  </xsl:choose>
7716
7731
  </xsl:variable>
@@ -7723,7 +7738,7 @@
7723
7738
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
7724
7739
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
7725
7740
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
7726
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7741
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7727
7742
  <xsl:value-of select="$scale"/>
7728
7743
  </xsl:template>
7729
7744
 
@@ -7742,7 +7757,14 @@
7742
7757
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7743
7758
  </xsl:when>
7744
7759
  <xsl:when test="not(starts-with(@src, 'data:'))">
7745
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7760
+ <xsl:choose>
7761
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7762
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7763
+ </xsl:when>
7764
+ <xsl:otherwise>
7765
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7766
+ </xsl:otherwise>
7767
+ </xsl:choose>
7746
7768
  </xsl:when>
7747
7769
  <xsl:otherwise>
7748
7770
  <xsl:value-of select="@src"/>
@@ -7764,7 +7786,14 @@
7764
7786
  </xsl:when>
7765
7787
  <xsl:when test="not(starts-with(@src, 'data:'))">
7766
7788
  <xsl:variable name="src">
7767
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7789
+ <xsl:choose>
7790
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7791
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7792
+ </xsl:when>
7793
+ <xsl:otherwise>
7794
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7795
+ </xsl:otherwise>
7796
+ </xsl:choose>
7768
7797
  </xsl:variable>
7769
7798
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7770
7799
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -12535,26 +12564,37 @@
12535
12564
  </x:xmpmeta>
12536
12565
  <!-- add attachments -->
12537
12566
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12538
- <xsl:choose>
12539
- <xsl:when test="normalize-space() != ''">
12540
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12541
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/>
12542
- </xsl:when>
12543
- <xsl:otherwise>
12544
- <!-- _{filename}_attachments -->
12545
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12546
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12547
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12548
- </xsl:otherwise>
12549
- </xsl:choose>
12567
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12568
+
12569
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12570
+ <xsl:attribute name="src">
12571
+ <xsl:choose>
12572
+ <xsl:when test="normalize-space() != ''">
12573
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
12574
+ <xsl:value-of select="$src_attachment"/>
12575
+ </xsl:when>
12576
+ <xsl:otherwise>
12577
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12578
+ <xsl:value-of select="$url"/>
12579
+ </xsl:otherwise>
12580
+ </xsl:choose>
12581
+ </xsl:attribute>
12582
+ <xsl:if test="$description != ''">
12583
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12584
+ </xsl:if>
12585
+ </pdf:embedded-file>
12550
12586
  </xsl:for-each>
12551
12587
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12552
12588
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12553
12589
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12554
12590
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12555
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
12556
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12557
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
12591
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12592
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12593
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12594
+ <xsl:if test="$description != ''">
12595
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12596
+ </xsl:if>
12597
+ </pdf:embedded-file>
12558
12598
  </xsl:for-each>
12559
12599
  </xsl:if>
12560
12600
  </xsl:template> <!-- addPDFUAmeta -->
@@ -12932,7 +12972,14 @@
12932
12972
  <xsl:value-of select="$src"/>
12933
12973
  </xsl:when>
12934
12974
  <xsl:otherwise>
12935
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12975
+ <xsl:choose>
12976
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
12977
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
12978
+ </xsl:when>
12979
+ <xsl:otherwise>
12980
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
12981
+ </xsl:otherwise>
12982
+ </xsl:choose>
12936
12983
  </xsl:otherwise>
12937
12984
  </xsl:choose>
12938
12985
  </xsl:template>
@@ -1000,14 +1000,14 @@
1000
1000
  <define name="PureTextElement">
1001
1001
  <choice>
1002
1002
  <text/>
1003
- <ref name="em"/>
1004
- <ref name="strong"/>
1003
+ <ref name="pure_em"/>
1004
+ <ref name="pure_strong"/>
1005
1005
  <ref name="sub"/>
1006
1006
  <ref name="sup"/>
1007
- <ref name="tt"/>
1008
- <ref name="underline"/>
1009
- <ref name="strike"/>
1010
- <ref name="smallcap"/>
1007
+ <ref name="pure_tt"/>
1008
+ <ref name="pure_underline"/>
1009
+ <ref name="pure_strike"/>
1010
+ <ref name="pure_smallcap"/>
1011
1011
  <ref name="br"/>
1012
1012
  </choice>
1013
1013
  </define>
@@ -1031,6 +1031,13 @@
1031
1031
  </zeroOrMore>
1032
1032
  </element>
1033
1033
  </define>
1034
+ <define name="pure_em">
1035
+ <element name="em">
1036
+ <zeroOrMore>
1037
+ <ref name="PureTextElement"/>
1038
+ </zeroOrMore>
1039
+ </element>
1040
+ </define>
1034
1041
  <define name="strong">
1035
1042
  <element name="strong">
1036
1043
  <zeroOrMore>
@@ -1046,6 +1053,13 @@
1046
1053
  </zeroOrMore>
1047
1054
  </element>
1048
1055
  </define>
1056
+ <define name="pure_strong">
1057
+ <element name="strong">
1058
+ <zeroOrMore>
1059
+ <ref name="PureTextElement"/>
1060
+ </zeroOrMore>
1061
+ </element>
1062
+ </define>
1049
1063
  <define name="tt">
1050
1064
  <element name="tt">
1051
1065
  <zeroOrMore>
@@ -1060,6 +1074,13 @@
1060
1074
  </zeroOrMore>
1061
1075
  </element>
1062
1076
  </define>
1077
+ <define name="pure_tt">
1078
+ <element name="tt">
1079
+ <zeroOrMore>
1080
+ <ref name="PureTextElement"/>
1081
+ </zeroOrMore>
1082
+ </element>
1083
+ </define>
1063
1084
  <define name="keyword">
1064
1085
  <element name="keyword">
1065
1086
  <zeroOrMore>
@@ -1090,13 +1111,42 @@
1090
1111
  <zeroOrMore>
1091
1112
  <choice>
1092
1113
  <ref name="PureTextElement"/>
1114
+ <ref name="stem"/>
1115
+ <ref name="eref"/>
1116
+ <ref name="xref"/>
1117
+ <ref name="hyperlink"/>
1093
1118
  <ref name="index"/>
1094
1119
  <ref name="index-xref"/>
1095
1120
  </choice>
1096
1121
  </zeroOrMore>
1097
1122
  </element>
1098
1123
  </define>
1124
+ <define name="pure_strike">
1125
+ <element name="strike">
1126
+ <zeroOrMore>
1127
+ <ref name="PureTextElement"/>
1128
+ </zeroOrMore>
1129
+ </element>
1130
+ </define>
1099
1131
  <define name="underline">
1132
+ <element name="underline">
1133
+ <optional>
1134
+ <attribute name="style"/>
1135
+ </optional>
1136
+ <zeroOrMore>
1137
+ <choice>
1138
+ <ref name="PureTextElement"/>
1139
+ <ref name="stem"/>
1140
+ <ref name="eref"/>
1141
+ <ref name="xref"/>
1142
+ <ref name="hyperlink"/>
1143
+ <ref name="index"/>
1144
+ <ref name="index-xref"/>
1145
+ </choice>
1146
+ </zeroOrMore>
1147
+ </element>
1148
+ </define>
1149
+ <define name="pure_underline">
1100
1150
  <element name="underline">
1101
1151
  <optional>
1102
1152
  <attribute name="style"/>
@@ -1107,6 +1157,21 @@
1107
1157
  </element>
1108
1158
  </define>
1109
1159
  <define name="smallcap">
1160
+ <element name="smallcap">
1161
+ <zeroOrMore>
1162
+ <choice>
1163
+ <ref name="PureTextElement"/>
1164
+ <ref name="stem"/>
1165
+ <ref name="eref"/>
1166
+ <ref name="xref"/>
1167
+ <ref name="hyperlink"/>
1168
+ <ref name="index"/>
1169
+ <ref name="index-xref"/>
1170
+ </choice>
1171
+ </zeroOrMore>
1172
+ </element>
1173
+ </define>
1174
+ <define name="pure_smallcap">
1110
1175
  <element name="smallcap">
1111
1176
  <zeroOrMore>
1112
1177
  <ref name="PureTextElement"/>
@@ -1204,7 +1204,9 @@
1204
1204
  <optional>
1205
1205
  <ref name="formattedref"/>
1206
1206
  </optional>
1207
- <ref name="btitle"/>
1207
+ <oneOrMore>
1208
+ <ref name="btitle"/>
1209
+ </oneOrMore>
1208
1210
  <optional>
1209
1211
  <ref name="bplace"/>
1210
1212
  </optional>
@@ -662,6 +662,9 @@
662
662
  <value>LatexMath</value>
663
663
  </choice>
664
664
  </attribute>
665
+ <optional>
666
+ <attribute name="number-format"/>
667
+ </optional>
665
668
  <attribute name="block">
666
669
  <data type="boolean"/>
667
670
  </attribute>
@@ -66,6 +66,9 @@
66
66
  <ref name="MultilingualRenderingType"/>
67
67
  </attribute>
68
68
  </optional>
69
+ <optional>
70
+ <attribute name="class"/>
71
+ </optional>
69
72
  <optional>
70
73
  <ref name="reqtitle"/>
71
74
  </optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.16".freeze
3
+ VERSION = "0.12.17".freeze
4
4
  end
5
5
  end
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.16
4
+ version: 0.12.17
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-08-19 00:00:00.000000000 Z
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639