metanorma-itu 2.4.12 → 2.5.0

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: '0085bde66b00e7532a7d0f2d202aa7bbb046c7db9022e48c28ad0ae131028cd8'
4
- data.tar.gz: 3061e1edfa2da86f6deccf9b26b23665712588bfb0df907f3e77e358eed2a487
3
+ metadata.gz: 6118028edabf79b61becf238e0517a8d47887600c3edc771b27150e59def1971
4
+ data.tar.gz: 1dbcdcb12bb1a85026667dbd0fa85fa7beb218165ac2b9b5123db9fa0d62db08
5
5
  SHA512:
6
- metadata.gz: 8c3cd365c082afa22ceec3f8e2a948d88f134ef8ba8ccf9378e154344e92f2f1ff93d612307fdf21c0a20143240a835c6b9b8968735c59f42fe1c8112f0e0e22
7
- data.tar.gz: 2ffac6e140e574aec7742c93725f1c26557701e60a000bf18417b16bf9369419ba3451abd63e5e2ea81de3d895850ab52702578269ac353541666f74c3c79af3
6
+ metadata.gz: 0ef409f6253fe230b38b6913edd3e1b2dc5010cfd775782774af835e742340510da782fa9ba57b38149e433705a3662d7ed62334fdff9d722a43864be8a58328
7
+ data.tar.gz: fdfe298cb20e6a4d8f8d7cd92baa4499481e7fe8eb02700a4f8da17ce37650f1089104daf95ad4b5c9b55e8190e1c72f167780477b3c95a1814bec5233e6ab14
@@ -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>
@@ -47,7 +47,7 @@ module Metanorma
47
47
  list_caption(node, xml_ol)
48
48
  node.items.each { |item| li(xml_ol, item) }
49
49
  end
50
- end.join("")
50
+ end
51
51
  end
52
52
 
53
53
  def outputs(node, ret)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.4.12".freeze
3
+ VERSION = "2.5.0".freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
27
27
 
28
- spec.add_dependency "metanorma-standoc", "~> 2.9.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 2.9.3"
29
29
  spec.add_dependency "pubid"
30
30
  spec.add_dependency "twitter_cldr", ">= 3.0.0"
31
31
  spec.add_dependency "tzinfo-data" # we need this for windows only
@@ -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.5.0
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-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.9.0
19
+ version: 2.9.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.9.0
26
+ version: 2.9.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pubid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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
  '