metanorma-ogc 2.5.12 → 2.5.14

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: 5ae7e749e76e9bbff3459bf8eb4377ccdf91f777f6dfe423d1699f21ca2f187a
4
- data.tar.gz: 3e68f0f3abe63766cdcaef2aebbdd4831705cee0407c776888b70960575c6a4b
3
+ metadata.gz: 20a42aacc8919672ff6672fba3620817651a5e0e7b6d13dbac7d9d51a7a34bc0
4
+ data.tar.gz: a781bdab6a4550bc6d04f0a3cde51775d6755f680f2d9a22b4dfe65d9e8e5933
5
5
  SHA512:
6
- metadata.gz: 0a573eb0d8f60f88b44efe641468bc56226d6df9d39e88d0fe35c9b02ec2f6b9dacad8504b757387ebd74c8bfe848fec9680b727b49d10a66b5e791e9454e9f7
7
- data.tar.gz: d7be74997811588005e301a60ff3d4ffee28124c86802ea687a36b2569ba3f0aa78979c00932bf42bf6ca279a0bb9b2a99799158c98f3276747f3cc9eceb9ef1
6
+ metadata.gz: e309309936b82e9e266346b7c630f845a9e77269724a31e20e1e29fc5b7ec2aa3a0d906664a67d34398ade90168276d1b66979aad8c46664b39a71a19b0bf868
7
+ data.tar.gz: 358c573ed7cd006c1fc6a25a1b94ea13b47f43a4ba78fb80f934c12c0dd45bab470e9c55d0c699e6d589a69f104b0944b04c17b85a723603d305f4c36014b814
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>