metanorma-itu 2.4.12 → 2.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0085bde66b00e7532a7d0f2d202aa7bbb046c7db9022e48c28ad0ae131028cd8'
4
- data.tar.gz: 3061e1edfa2da86f6deccf9b26b23665712588bfb0df907f3e77e358eed2a487
3
+ metadata.gz: b12cbd30d0aa887cb91afaa25444e3889980724d0aec818eb10f8983d4da401f
4
+ data.tar.gz: f8c8e8416f104d47dc6d05a4b687bd1da9c88c52bc353d4af2099ed920abe7c9
5
5
  SHA512:
6
- metadata.gz: 8c3cd365c082afa22ceec3f8e2a948d88f134ef8ba8ccf9378e154344e92f2f1ff93d612307fdf21c0a20143240a835c6b9b8968735c59f42fe1c8112f0e0e22
7
- data.tar.gz: 2ffac6e140e574aec7742c93725f1c26557701e60a000bf18417b16bf9369419ba3451abd63e5e2ea81de3d895850ab52702578269ac353541666f74c3c79af3
6
+ metadata.gz: 78ab925ed8e8e1ebd204724261895b8cd65b778ff46e48ed09a334966f8df160c03e0e7031006fee1a5f8a09be1aac31d2d9dcab0fa8c9ca408eb855d9e4e909
7
+ data.tar.gz: 549695931d13618909a40d38befc396cd5bfecdcb33ab2c96e090731d4e7987e22a20305e66fe12a28c431d77482cf32514c8907d6af1f00834ff45db7be363d
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -8854,18 +8854,33 @@
8854
8854
 
8855
8855
  <xsl:template match="*[local-name()='localityStack']"/>
8856
8856
 
8857
+ <xsl:variable name="pdfAttachmentsList_">
8858
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8859
+ <attachment filename="{@name}"/>
8860
+ </xsl:for-each>
8861
+ </xsl:variable>
8862
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8863
+
8857
8864
  <xsl:template match="*[local-name()='link']" name="link">
8865
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8866
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8858
8867
  <xsl:variable name="target">
8859
8868
  <xsl:choose>
8860
8869
  <xsl:when test="@updatetype = 'true'">
8861
8870
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8862
8871
  </xsl:when>
8872
+ <!-- link to the PDF attachment -->
8873
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8874
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8875
+ </xsl:when>
8876
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8877
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8878
+ </xsl:when>
8863
8879
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8864
- <!-- link to the PDF attachment -->
8865
8880
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8866
8881
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8867
8882
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8868
- </xsl:when>
8883
+ </xsl:when> -->
8869
8884
  <xsl:otherwise>
8870
8885
  <xsl:value-of select="normalize-space(@target)"/>
8871
8886
  </xsl:otherwise>
@@ -13499,6 +13514,17 @@
13499
13514
  <xsl:copy-of select="."/>
13500
13515
  </xsl:template>
13501
13516
 
13517
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13518
+ <xsl:copy>
13519
+ <xsl:copy-of select="@*"/>
13520
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13522
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13523
+ <xsl:value-of select="."/>
13524
+ </xsl:if>
13525
+ </xsl:copy>
13526
+ </xsl:template>
13527
+
13502
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13503
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13504
13530
  <xsl:copy>
@@ -14373,7 +14399,8 @@
14373
14399
  </xsl:when>
14374
14400
  <xsl:otherwise>
14375
14401
  <!-- _{filename}_attachments -->
14376
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
14402
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14403
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14377
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14378
14405
  </xsl:otherwise>
14379
14406
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.4.12".freeze
3
+ VERSION = "2.4.13".freeze
4
4
  end
5
5
  end
@@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "timecop", "~> 0.9"
43
43
  spec.add_development_dependency "vcr", "~> 6.1.0"
44
44
  spec.add_development_dependency "webmock"
45
+ spec.add_development_dependency "xml-c14n"
45
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.12
4
+ version: 2.4.13
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-07-22 00:00:00.000000000 Z
11
+ date: 2024-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: xml-c14n
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
237
251
  description: 'Metanorma for the ITU.
238
252
 
239
253
  '