metanorma-itu 2.4.11 → 2.4.13

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: 47d97ad196f0b19a167b8a895b19ff28264df80eb9c0448bae79785832f230e3
4
- data.tar.gz: b6b47045f23c2534e0e75c138e04b9d74fe7c9b547dbcf28c07c7624562545a1
3
+ metadata.gz: b12cbd30d0aa887cb91afaa25444e3889980724d0aec818eb10f8983d4da401f
4
+ data.tar.gz: f8c8e8416f104d47dc6d05a4b687bd1da9c88c52bc353d4af2099ed920abe7c9
5
5
  SHA512:
6
- metadata.gz: '0192b7305fe2e97e93725741116bb5b56b6d55ab662d725470a4bad5f75d1f734c5339b798d986d095333540a5a84304217b7be2db60ad7b09837eb8210d2155'
7
- data.tar.gz: b4830ae51c97645a10e6b5068111dd198310b56d6309f125608f12c50df7f23a195ced59701ea3bd364d1bb6dd7ff3e52c3aaa684c1a52baf7c36a0d5c68cbfd
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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>
@@ -10524,8 +10539,11 @@
10524
10539
  </xsl:template>
10525
10540
 
10526
10541
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10542
+ <xsl:param name="element"/>
10527
10543
  <xsl:copy>
10528
- <xsl:apply-templates mode="contents_item"/>
10544
+ <xsl:apply-templates mode="contents_item">
10545
+ <xsl:with-param name="element" select="$element"/>
10546
+ </xsl:apply-templates>
10529
10547
  </xsl:copy>
10530
10548
  </xsl:template>
10531
10549
 
@@ -10592,7 +10610,10 @@
10592
10610
 
10593
10611
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10594
10612
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10595
- <xsl:apply-templates mode="contents_item"/>
10613
+ <xsl:param name="element"/>
10614
+ <xsl:apply-templates mode="contents_item">
10615
+ <xsl:with-param name="element" select="$element"/>
10616
+ </xsl:apply-templates>
10596
10617
  </xsl:template>
10597
10618
 
10598
10619
  <!-- =============== -->
@@ -13493,6 +13514,17 @@
13493
13514
  <xsl:copy-of select="."/>
13494
13515
  </xsl:template>
13495
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
+
13496
13528
  <!-- add @id, mandatory for table auto-layout algorithm -->
13497
13529
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13498
13530
  <xsl:copy>
@@ -14367,7 +14399,8 @@
14367
14399
  </xsl:when>
14368
14400
  <xsl:otherwise>
14369
14401
  <!-- _{filename}_attachments -->
14370
- <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, ')')"/>
14371
14404
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14372
14405
  </xsl:otherwise>
14373
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("\n")
50
+ end.join("")
51
51
  end
52
52
 
53
53
  def outputs(node, ret)
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.3.2 -->
20
+ <!-- VERSION v1.3.3 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -331,9 +331,9 @@
331
331
  <zeroOrMore>
332
332
  <ref name="table-note"/>
333
333
  </zeroOrMore>
334
- <optional>
334
+ <zeroOrMore>
335
335
  <ref name="source"/>
336
- </optional>
336
+ </zeroOrMore>
337
337
  </define>
338
338
  <define name="FigureAttr">
339
339
  <optional>
@@ -380,9 +380,9 @@
380
380
  <zeroOrMore>
381
381
  <ref name="note"/>
382
382
  </zeroOrMore>
383
- <optional>
383
+ <zeroOrMore>
384
384
  <ref name="source"/>
385
- </optional>
385
+ </zeroOrMore>
386
386
  </define>
387
387
  <define name="source">
388
388
  <element name="source">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.4.11".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.11
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-08 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
  '