metanorma-bipm 2.4.10 → 2.4.12

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: 46ff602c1990306490321972d10fdb1d65d39a1d6e6cbf0c8a27167dcd60eec2
4
- data.tar.gz: 5b7e17265a1a5076928dee6f8c815f414f4c5766fa34e3b29cd86cc184168312
3
+ metadata.gz: 6328cc0a118035ba72b346c223c4e7e28aacdf48c5baf5a40a6de7fdc05005aa
4
+ data.tar.gz: bb543f02c153a0f39a5f0291104281c9b423258933dc5add261c7b57eda81de5
5
5
  SHA512:
6
- metadata.gz: 0eb7c6b691b972e5224445bb68191a8f4a9d4ce5610b3bceaadfed1e85dcdfd08cd4ccbc8b9149b2f7dd76ebb0f458f66721e19d6d24f6d68733bd44aa2dae3a
7
- data.tar.gz: f09b739c90e74488348dce09295318684336684f93c9622edc1eda455ea553f35127165816e7df133303258f9912d74c6de1c87033856d17332843578589469a
6
+ metadata.gz: 8e381d7db910aff8421d57a31da740d022bc4bb235539a74439b7096f2e11760d365996a3f4cedf79925b14a1b9681feb94387271f747b1803ee7c22ba34482e
7
+ data.tar.gz: bc6cd6855b001bc0f81d46d66e82e28710fa09039c82cdab897b6e45a43e28387e5217cd6e5966772a1692c2bfc719bf4b078f9f01b0e710ddbb651e2525cef8
@@ -9999,18 +9999,33 @@
9999
9999
 
10000
10000
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='localityStack']"/>
10001
10001
 
10002
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList_">
10003
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
10004
+ <attachment filename="{@name}"/>
10005
+ </xsl:for-each>
10006
+ </xsl:variable>
10007
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
10008
+
10002
10009
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='link']" name="link">
10010
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
10011
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
10003
10012
  <xsl:variable name="target">
10004
10013
  <xsl:choose>
10005
10014
  <xsl:when test="@updatetype = 'true'">
10006
10015
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
10007
10016
  </xsl:when>
10017
+ <!-- link to the PDF attachment -->
10018
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
10019
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
10020
+ </xsl:when>
10021
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
10022
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
10023
+ </xsl:when>
10008
10024
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
10009
- <!-- link to the PDF attachment -->
10010
10025
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
10011
10026
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
10012
10027
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
10013
- </xsl:when>
10028
+ </xsl:when> -->
10014
10029
  <xsl:otherwise>
10015
10030
  <xsl:value-of select="normalize-space(@target)"/>
10016
10031
  </xsl:otherwise>
@@ -11696,8 +11711,11 @@
11696
11711
  </xsl:template>
11697
11712
 
11698
11713
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'strong']" mode="contents_item">
11714
+ <xsl:param name="element"/>
11699
11715
  <xsl:copy>
11700
- <xsl:apply-templates mode="contents_item"/>
11716
+ <xsl:apply-templates mode="contents_item">
11717
+ <xsl:with-param name="element" select="$element"/>
11718
+ </xsl:apply-templates>
11701
11719
  </xsl:copy>
11702
11720
  </xsl:template>
11703
11721
 
@@ -11764,7 +11782,10 @@
11764
11782
 
11765
11783
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
11766
11784
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'span']" mode="contents_item">
11767
- <xsl:apply-templates mode="contents_item"/>
11785
+ <xsl:param name="element"/>
11786
+ <xsl:apply-templates mode="contents_item">
11787
+ <xsl:with-param name="element" select="$element"/>
11788
+ </xsl:apply-templates>
11768
11789
  </xsl:template>
11769
11790
 
11770
11791
  <!-- =============== -->
@@ -14632,6 +14653,17 @@
14632
14653
  <xsl:copy-of select="."/>
14633
14654
  </xsl:template>
14634
14655
 
14656
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
14657
+ <xsl:copy>
14658
+ <xsl:copy-of select="@*"/>
14659
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
14660
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
14661
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
14662
+ <xsl:value-of select="."/>
14663
+ </xsl:if>
14664
+ </xsl:copy>
14665
+ </xsl:template>
14666
+
14635
14667
  <!-- add @id, mandatory for table auto-layout algorithm -->
14636
14668
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
14637
14669
  <xsl:copy>
@@ -15506,7 +15538,8 @@
15506
15538
  </xsl:when>
15507
15539
  <xsl:otherwise>
15508
15540
  <!-- _{filename}_attachments -->
15509
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
15541
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
15542
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
15510
15543
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
15511
15544
  </xsl:otherwise>
15512
15545
  </xsl:choose>
@@ -9999,18 +9999,33 @@
9999
9999
 
10000
10000
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='localityStack']"/>
10001
10001
 
10002
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList_">
10003
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
10004
+ <attachment filename="{@name}"/>
10005
+ </xsl:for-each>
10006
+ </xsl:variable>
10007
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
10008
+
10002
10009
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='link']" name="link">
10010
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
10011
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
10003
10012
  <xsl:variable name="target">
10004
10013
  <xsl:choose>
10005
10014
  <xsl:when test="@updatetype = 'true'">
10006
10015
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
10007
10016
  </xsl:when>
10017
+ <!-- link to the PDF attachment -->
10018
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
10019
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
10020
+ </xsl:when>
10021
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
10022
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
10023
+ </xsl:when>
10008
10024
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
10009
- <!-- link to the PDF attachment -->
10010
10025
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
10011
10026
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
10012
10027
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
10013
- </xsl:when>
10028
+ </xsl:when> -->
10014
10029
  <xsl:otherwise>
10015
10030
  <xsl:value-of select="normalize-space(@target)"/>
10016
10031
  </xsl:otherwise>
@@ -11696,8 +11711,11 @@
11696
11711
  </xsl:template>
11697
11712
 
11698
11713
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'strong']" mode="contents_item">
11714
+ <xsl:param name="element"/>
11699
11715
  <xsl:copy>
11700
- <xsl:apply-templates mode="contents_item"/>
11716
+ <xsl:apply-templates mode="contents_item">
11717
+ <xsl:with-param name="element" select="$element"/>
11718
+ </xsl:apply-templates>
11701
11719
  </xsl:copy>
11702
11720
  </xsl:template>
11703
11721
 
@@ -11764,7 +11782,10 @@
11764
11782
 
11765
11783
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
11766
11784
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'span']" mode="contents_item">
11767
- <xsl:apply-templates mode="contents_item"/>
11785
+ <xsl:param name="element"/>
11786
+ <xsl:apply-templates mode="contents_item">
11787
+ <xsl:with-param name="element" select="$element"/>
11788
+ </xsl:apply-templates>
11768
11789
  </xsl:template>
11769
11790
 
11770
11791
  <!-- =============== -->
@@ -14632,6 +14653,17 @@
14632
14653
  <xsl:copy-of select="."/>
14633
14654
  </xsl:template>
14634
14655
 
14656
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
14657
+ <xsl:copy>
14658
+ <xsl:copy-of select="@*"/>
14659
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
14660
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
14661
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
14662
+ <xsl:value-of select="."/>
14663
+ </xsl:if>
14664
+ </xsl:copy>
14665
+ </xsl:template>
14666
+
14635
14667
  <!-- add @id, mandatory for table auto-layout algorithm -->
14636
14668
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
14637
14669
  <xsl:copy>
@@ -15506,7 +15538,8 @@
15506
15538
  </xsl:when>
15507
15539
  <xsl:otherwise>
15508
15540
  <!-- _{filename}_attachments -->
15509
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
15541
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
15542
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
15510
15543
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
15511
15544
  </xsl:otherwise>
15512
15545
  </xsl:choose>
@@ -9999,18 +9999,33 @@
9999
9999
 
10000
10000
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='localityStack']"/>
10001
10001
 
10002
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList_">
10003
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
10004
+ <attachment filename="{@name}"/>
10005
+ </xsl:for-each>
10006
+ </xsl:variable>
10007
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
10008
+
10002
10009
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='link']" name="link">
10010
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
10011
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
10003
10012
  <xsl:variable name="target">
10004
10013
  <xsl:choose>
10005
10014
  <xsl:when test="@updatetype = 'true'">
10006
10015
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
10007
10016
  </xsl:when>
10017
+ <!-- link to the PDF attachment -->
10018
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
10019
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
10020
+ </xsl:when>
10021
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
10022
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
10023
+ </xsl:when>
10008
10024
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
10009
- <!-- link to the PDF attachment -->
10010
10025
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
10011
10026
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
10012
10027
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
10013
- </xsl:when>
10028
+ </xsl:when> -->
10014
10029
  <xsl:otherwise>
10015
10030
  <xsl:value-of select="normalize-space(@target)"/>
10016
10031
  </xsl:otherwise>
@@ -11696,8 +11711,11 @@
11696
11711
  </xsl:template>
11697
11712
 
11698
11713
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'strong']" mode="contents_item">
11714
+ <xsl:param name="element"/>
11699
11715
  <xsl:copy>
11700
- <xsl:apply-templates mode="contents_item"/>
11716
+ <xsl:apply-templates mode="contents_item">
11717
+ <xsl:with-param name="element" select="$element"/>
11718
+ </xsl:apply-templates>
11701
11719
  </xsl:copy>
11702
11720
  </xsl:template>
11703
11721
 
@@ -11764,7 +11782,10 @@
11764
11782
 
11765
11783
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
11766
11784
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'span']" mode="contents_item">
11767
- <xsl:apply-templates mode="contents_item"/>
11785
+ <xsl:param name="element"/>
11786
+ <xsl:apply-templates mode="contents_item">
11787
+ <xsl:with-param name="element" select="$element"/>
11788
+ </xsl:apply-templates>
11768
11789
  </xsl:template>
11769
11790
 
11770
11791
  <!-- =============== -->
@@ -14632,6 +14653,17 @@
14632
14653
  <xsl:copy-of select="."/>
14633
14654
  </xsl:template>
14634
14655
 
14656
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
14657
+ <xsl:copy>
14658
+ <xsl:copy-of select="@*"/>
14659
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
14660
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
14661
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
14662
+ <xsl:value-of select="."/>
14663
+ </xsl:if>
14664
+ </xsl:copy>
14665
+ </xsl:template>
14666
+
14635
14667
  <!-- add @id, mandatory for table auto-layout algorithm -->
14636
14668
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
14637
14669
  <xsl:copy>
@@ -15506,7 +15538,8 @@
15506
15538
  </xsl:when>
15507
15539
  <xsl:otherwise>
15508
15540
  <!-- _{filename}_attachments -->
15509
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
15541
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
15542
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
15510
15543
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
15511
15544
  </xsl:otherwise>
15512
15545
  </xsl:choose>
@@ -9999,18 +9999,33 @@
9999
9999
 
10000
10000
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='localityStack']"/>
10001
10001
 
10002
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList_">
10003
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
10004
+ <attachment filename="{@name}"/>
10005
+ </xsl:for-each>
10006
+ </xsl:variable>
10007
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
10008
+
10002
10009
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='link']" name="link">
10010
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
10011
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
10003
10012
  <xsl:variable name="target">
10004
10013
  <xsl:choose>
10005
10014
  <xsl:when test="@updatetype = 'true'">
10006
10015
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
10007
10016
  </xsl:when>
10017
+ <!-- link to the PDF attachment -->
10018
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
10019
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
10020
+ </xsl:when>
10021
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
10022
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
10023
+ </xsl:when>
10008
10024
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
10009
- <!-- link to the PDF attachment -->
10010
10025
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
10011
10026
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
10012
10027
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
10013
- </xsl:when>
10028
+ </xsl:when> -->
10014
10029
  <xsl:otherwise>
10015
10030
  <xsl:value-of select="normalize-space(@target)"/>
10016
10031
  </xsl:otherwise>
@@ -11696,8 +11711,11 @@
11696
11711
  </xsl:template>
11697
11712
 
11698
11713
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'strong']" mode="contents_item">
11714
+ <xsl:param name="element"/>
11699
11715
  <xsl:copy>
11700
- <xsl:apply-templates mode="contents_item"/>
11716
+ <xsl:apply-templates mode="contents_item">
11717
+ <xsl:with-param name="element" select="$element"/>
11718
+ </xsl:apply-templates>
11701
11719
  </xsl:copy>
11702
11720
  </xsl:template>
11703
11721
 
@@ -11764,7 +11782,10 @@
11764
11782
 
11765
11783
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
11766
11784
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'span']" mode="contents_item">
11767
- <xsl:apply-templates mode="contents_item"/>
11785
+ <xsl:param name="element"/>
11786
+ <xsl:apply-templates mode="contents_item">
11787
+ <xsl:with-param name="element" select="$element"/>
11788
+ </xsl:apply-templates>
11768
11789
  </xsl:template>
11769
11790
 
11770
11791
  <!-- =============== -->
@@ -14632,6 +14653,17 @@
14632
14653
  <xsl:copy-of select="."/>
14633
14654
  </xsl:template>
14634
14655
 
14656
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
14657
+ <xsl:copy>
14658
+ <xsl:copy-of select="@*"/>
14659
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
14660
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
14661
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
14662
+ <xsl:value-of select="."/>
14663
+ </xsl:if>
14664
+ </xsl:copy>
14665
+ </xsl:template>
14666
+
14635
14667
  <!-- add @id, mandatory for table auto-layout algorithm -->
14636
14668
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
14637
14669
  <xsl:copy>
@@ -15506,7 +15538,8 @@
15506
15538
  </xsl:when>
15507
15539
  <xsl:otherwise>
15508
15540
  <!-- _{filename}_attachments -->
15509
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
15541
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
15542
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
15510
15543
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
15511
15544
  </xsl:otherwise>
15512
15545
  </xsl:choose>
@@ -7908,18 +7908,33 @@
7908
7908
 
7909
7909
  <xsl:template match="*[local-name()='localityStack']"/>
7910
7910
 
7911
+ <xsl:variable name="pdfAttachmentsList_">
7912
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7913
+ <attachment filename="{@name}"/>
7914
+ </xsl:for-each>
7915
+ </xsl:variable>
7916
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7917
+
7911
7918
  <xsl:template match="*[local-name()='link']" name="link">
7919
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7920
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7912
7921
  <xsl:variable name="target">
7913
7922
  <xsl:choose>
7914
7923
  <xsl:when test="@updatetype = 'true'">
7915
7924
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7916
7925
  </xsl:when>
7926
+ <!-- link to the PDF attachment -->
7927
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7928
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7929
+ </xsl:when>
7930
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7931
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
7932
+ </xsl:when>
7917
7933
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7918
- <!-- link to the PDF attachment -->
7919
7934
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7920
7935
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7921
7936
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7922
- </xsl:when>
7937
+ </xsl:when> -->
7923
7938
  <xsl:otherwise>
7924
7939
  <xsl:value-of select="normalize-space(@target)"/>
7925
7940
  </xsl:otherwise>
@@ -9572,8 +9587,11 @@
9572
9587
  </xsl:template>
9573
9588
 
9574
9589
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9590
+ <xsl:param name="element"/>
9575
9591
  <xsl:copy>
9576
- <xsl:apply-templates mode="contents_item"/>
9592
+ <xsl:apply-templates mode="contents_item">
9593
+ <xsl:with-param name="element" select="$element"/>
9594
+ </xsl:apply-templates>
9577
9595
  </xsl:copy>
9578
9596
  </xsl:template>
9579
9597
 
@@ -9640,7 +9658,10 @@
9640
9658
 
9641
9659
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9642
9660
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9643
- <xsl:apply-templates mode="contents_item"/>
9661
+ <xsl:param name="element"/>
9662
+ <xsl:apply-templates mode="contents_item">
9663
+ <xsl:with-param name="element" select="$element"/>
9664
+ </xsl:apply-templates>
9644
9665
  </xsl:template>
9645
9666
 
9646
9667
  <!-- =============== -->
@@ -12523,6 +12544,17 @@
12523
12544
  <xsl:copy-of select="."/>
12524
12545
  </xsl:template>
12525
12546
 
12547
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12548
+ <xsl:copy>
12549
+ <xsl:copy-of select="@*"/>
12550
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12551
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12552
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12553
+ <xsl:value-of select="."/>
12554
+ </xsl:if>
12555
+ </xsl:copy>
12556
+ </xsl:template>
12557
+
12526
12558
  <!-- add @id, mandatory for table auto-layout algorithm -->
12527
12559
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12528
12560
  <xsl:copy>
@@ -13395,7 +13427,8 @@
13395
13427
  </xsl:when>
13396
13428
  <xsl:otherwise>
13397
13429
  <!-- _{filename}_attachments -->
13398
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13430
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13431
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13399
13432
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
13400
13433
  </xsl:otherwise>
13401
13434
  </xsl:choose>
@@ -83,7 +83,9 @@ module IsoDoc
83
83
  ret = xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = " \
84
84
  "'authorizer']/organization"))
85
85
  .each_with_object([]) do |org, m|
86
- m << extract_variant(org.at(ns("./name")))
86
+ name = org.at(ns("./name[@language = '#{@lang}']")) ||
87
+ org.at(ns("./name"))
88
+ m << name.text
87
89
  end
88
90
  ret.empty? or set(:authorizer, ret)
89
91
  end
@@ -85,7 +85,7 @@ module Metanorma
85
85
  def committee_validate(xml)
86
86
  committees = Array(configuration&.committees) || return
87
87
  committees.empty? and return
88
- xml.xpath("//bibdata/ext/editorialgroup/committee/variant").each do |c|
88
+ xml.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
89
89
  committees.include? c.text or
90
90
  @log.add("Document Attributes", nil,
91
91
  "#{c.text} is not a recognised committee")
@@ -16,22 +16,18 @@ module Metanorma
16
16
  end
17
17
 
18
18
  def metadata_committee1(node, xml)
19
- xml.committee **attr_code(acronym:
20
- node.attr("committee-acronym")) do |c|
21
- e = node.attr("committee-en") and
22
- c.variant e, language: "en", script: "Latn"
23
- e = node.attr("committee-fr") and
24
- c.variant e, language: "fr", script: "Latn"
19
+ %w(en fr).each do |lg|
20
+ e = node.attr("committee-#{lg}") or next
21
+ xml.committee e, **attr_code(acronym: node.attr("committee-acronym"),
22
+ language: lg, script: "Latn")
25
23
  end
26
24
  end
27
25
 
28
26
  def metadata_committee2(node, xml, num)
29
- xml.committee **attr_code(acronym:
30
- node.attr("committee-acronym_#{num}")) do |c|
31
- %w(en fr).each do |lg|
32
- e = node.attr("committee-#{lg}_#{num}") and
33
- c.variant e, language: lg, script: "Latn"
34
- end
27
+ %w(en fr).each do |lg|
28
+ e = node.attr("committee-#{lg}_#{num}") or next
29
+ xml.committee e, **attr_code(acronym: node.attr("committee-acronym"),
30
+ language: lg, script: "Latn")
35
31
  end
36
32
  end
37
33
 
@@ -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 BIPM
3
- VERSION = "2.4.10".freeze
3
+ VERSION = "2.4.12".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-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.10
4
+ version: 2.4.12
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-generic
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: xml-c14n
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
209
223
  description: |
210
224
  metanorma-vg lets you write Bureau International de Poids et Mesures (BIPM) standards in Metanorma syntax.
211
225