metanorma-bipm 2.5.1 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7137,6 +7137,7 @@
7137
7137
 
7138
7138
  <fo:block role="SKIP">
7139
7139
  <xsl:apply-templates/>
7140
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
7140
7141
  </fo:block>
7141
7142
  </fo:table-cell>
7142
7143
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -7209,6 +7210,8 @@
7209
7210
 
7210
7211
  <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
7211
7212
 
7213
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
7214
+
7212
7215
  </fo:block>
7213
7216
  </fo:table-cell>
7214
7217
  </xsl:template> <!-- td -->
@@ -10037,14 +10040,16 @@
10037
10040
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name()='link']" name="link">
10038
10041
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
10039
10042
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
10043
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
10040
10044
  <xsl:variable name="target">
10041
10045
  <xsl:choose>
10042
10046
  <xsl:when test="@updatetype = 'true'">
10043
10047
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
10044
10048
  </xsl:when>
10045
10049
  <!-- link to the PDF attachment -->
10046
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
10047
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
10050
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
10051
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
10052
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
10048
10053
  </xsl:when>
10049
10054
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
10050
10055
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -10075,6 +10080,11 @@
10075
10080
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10076
10081
  </xsl:if>
10077
10082
 
10083
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10084
+ <xsl:attribute name="color">inherit</xsl:attribute>
10085
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
10086
+ </xsl:if>
10087
+
10078
10088
  <xsl:call-template name="refine_link-style"/>
10079
10089
 
10080
10090
  <xsl:choose>
@@ -10085,6 +10095,9 @@
10085
10095
  <xsl:call-template name="insert_basic_link">
10086
10096
  <xsl:with-param name="element">
10087
10097
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10098
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10099
+ <xsl:attribute name="role">Annot</xsl:attribute>
10100
+ </xsl:if>
10088
10101
  <xsl:choose>
10089
10102
  <xsl:when test="normalize-space(.) = ''">
10090
10103
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -10097,6 +10110,10 @@
10097
10110
  </xsl:otherwise>
10098
10111
  </xsl:choose>
10099
10112
  </fo:basic-link>
10113
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10114
+ <!-- reserve space at right for PaperClip icon -->
10115
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
10116
+ </xsl:if>
10100
10117
  </xsl:with-param>
10101
10118
  </xsl:call-template>
10102
10119
  </xsl:otherwise>
@@ -15534,6 +15551,39 @@
15534
15551
  </pdf:catalog>
15535
15552
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
15536
15553
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
15554
+ <rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" rdf:about="">
15555
+ <pdfaExtension:schemas>
15556
+ <rdf:Bag>
15557
+ <rdf:li rdf:parseType="Resource">
15558
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
15559
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
15560
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
15561
+ <pdfaSchema:property>
15562
+ <rdf:Seq>
15563
+ <rdf:li rdf:parseType="Resource">
15564
+ <pdfaProperty:category>internal</pdfaProperty:category>
15565
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
15566
+ <pdfaProperty:name>part</pdfaProperty:name>
15567
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
15568
+ </rdf:li>
15569
+ <rdf:li rdf:parseType="Resource">
15570
+ <pdfaProperty:category>internal</pdfaProperty:category>
15571
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
15572
+ <pdfaProperty:name>amd</pdfaProperty:name>
15573
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
15574
+ </rdf:li>
15575
+ <rdf:li rdf:parseType="Resource">
15576
+ <pdfaProperty:category>internal</pdfaProperty:category>
15577
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
15578
+ <pdfaProperty:name>corr</pdfaProperty:name>
15579
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
15580
+ </rdf:li>
15581
+ </rdf:Seq>
15582
+ </pdfaSchema:property>
15583
+ </rdf:li>
15584
+ </rdf:Bag>
15585
+ </pdfaExtension:schemas>
15586
+ </rdf:Description>
15537
15587
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
15538
15588
  <!-- Dublin Core properties go here -->
15539
15589
  <dc:title>
@@ -15544,33 +15594,57 @@
15544
15594
 
15545
15595
  </xsl:for-each>
15546
15596
  </xsl:variable>
15547
- <xsl:choose>
15548
- <xsl:when test="normalize-space($title) != ''">
15549
- <xsl:value-of select="$title"/>
15550
- </xsl:when>
15551
- <xsl:otherwise>
15552
- <xsl:text> </xsl:text>
15553
- </xsl:otherwise>
15554
- </xsl:choose>
15597
+ <rdf:Alt>
15598
+ <rdf:li xml:lang="x-default">
15599
+ <xsl:choose>
15600
+ <xsl:when test="normalize-space($title) != ''">
15601
+ <xsl:value-of select="$title"/>
15602
+ </xsl:when>
15603
+ <xsl:otherwise>
15604
+ <xsl:text> </xsl:text>
15605
+ </xsl:otherwise>
15606
+ </xsl:choose>
15607
+ </rdf:li>
15608
+ </rdf:Alt>
15555
15609
  </dc:title>
15556
- <dc:creator>
15610
+ <xsl:variable name="dc_creator">
15557
15611
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
15558
15612
 
15559
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
15560
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
15561
- <xsl:if test="position() != last()">; </xsl:if>
15562
- </xsl:for-each>
15613
+ <rdf:Seq>
15614
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
15615
+ <rdf:li>
15616
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
15617
+ </rdf:li>
15618
+ <!-- <xsl:if test="position() != last()">; </xsl:if> -->
15619
+ </xsl:for-each>
15620
+ </rdf:Seq>
15563
15621
 
15564
15622
  </xsl:for-each>
15565
- </dc:creator>
15566
- <dc:description>
15623
+ </xsl:variable>
15624
+ <xsl:if test="normalize-space($dc_creator) != ''">
15625
+ <dc:creator>
15626
+ <xsl:copy-of select="$dc_creator"/>
15627
+ </dc:creator>
15628
+ </xsl:if>
15629
+
15630
+ <xsl:variable name="dc_description">
15567
15631
  <xsl:variable name="abstract">
15568
15632
 
15569
15633
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
15570
15634
 
15571
15635
  </xsl:variable>
15572
- <xsl:value-of select="normalize-space($abstract)"/>
15573
- </dc:description>
15636
+ <rdf:Alt>
15637
+ <rdf:li xml:lang="x-default">
15638
+ <xsl:value-of select="normalize-space($abstract)"/>
15639
+ </rdf:li>
15640
+ </rdf:Alt>
15641
+ </xsl:variable>
15642
+ <xsl:if test="normalize-space($dc_description)">
15643
+ <dc:description>
15644
+ <xsl:copy-of select="$dc_description"/>
15645
+ </dc:description>
15646
+ </xsl:if>
15647
+
15574
15648
  <pdf:Keywords>
15575
15649
  <xsl:call-template name="insertKeywords">
15576
15650
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -15585,9 +15659,14 @@
15585
15659
  </x:xmpmeta>
15586
15660
  <!-- add attachments -->
15587
15661
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
15588
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
15589
-
15590
- <pdf:embedded-file filename="{@name}">
15662
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
15663
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
15664
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15665
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15666
+ <!-- Todo: need update -->
15667
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15668
+
15669
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15591
15670
  <xsl:attribute name="src">
15592
15671
  <xsl:choose>
15593
15672
  <xsl:when test="normalize-space() != ''">
@@ -15603,18 +15682,27 @@
15603
15682
  <xsl:if test="$description != ''">
15604
15683
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15605
15684
  </xsl:if>
15685
+ <xsl:if test="$afrelationship != ''">
15686
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15687
+ </xsl:if>
15606
15688
  </pdf:embedded-file>
15607
15689
  </xsl:for-each>
15608
15690
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
15609
15691
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
15610
15692
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
15611
15693
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
15694
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
15612
15695
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15613
15696
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15614
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
15697
+ <!-- Todo: need update -->
15698
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15699
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15615
15700
  <xsl:if test="$description != ''">
15616
15701
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15617
15702
  </xsl:if>
15703
+ <xsl:if test="$afrelationship != ''">
15704
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15705
+ </xsl:if>
15618
15706
  </pdf:embedded-file>
15619
15707
  </xsl:for-each>
15620
15708
  </xsl:if>
@@ -15634,6 +15722,12 @@
15634
15722
  <!-- Get or calculate depth of the element -->
15635
15723
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getLevel">
15636
15724
  <xsl:param name="depth"/>
15725
+ <!-- <xsl:message>
15726
+ <xsl:choose>
15727
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
15728
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
15729
+ </xsl:choose>
15730
+ </xsl:message> -->
15637
15731
  <xsl:choose>
15638
15732
  <xsl:when test="normalize-space(@depth) != ''">
15639
15733
  <xsl:value-of select="@depth"/>
@@ -15654,8 +15748,27 @@
15654
15748
  <xsl:when test="ancestor::*[local-name() = 'preface']">
15655
15749
  <xsl:value-of select="$level_total - 2"/>
15656
15750
  </xsl:when>
15751
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15752
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
15753
+ <xsl:choose>
15754
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15755
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
15756
+ </xsl:when>
15757
+ <xsl:otherwise>
15758
+ <xsl:value-of select="$level_total - 2"/>
15759
+ </xsl:otherwise>
15760
+ </xsl:choose>
15761
+ </xsl:when>
15657
15762
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15658
- <xsl:value-of select="$level_total - 1"/>
15763
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
15764
+ <xsl:choose>
15765
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15766
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
15767
+ </xsl:when>
15768
+ <xsl:otherwise>
15769
+ <xsl:value-of select="$level_total - 1"/>
15770
+ </xsl:otherwise>
15771
+ </xsl:choose>
15659
15772
  </xsl:when>
15660
15773
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
15661
15774
  <xsl:value-of select="$level_total - 1"/>
@@ -15663,6 +15776,17 @@
15663
15776
  <xsl:when test="parent::*[local-name() = 'annex']">
15664
15777
  <xsl:value-of select="$level_total - 1"/>
15665
15778
  </xsl:when>
15779
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
15780
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
15781
+ <xsl:choose>
15782
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15783
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
15784
+ </xsl:when>
15785
+ <xsl:otherwise>
15786
+ <xsl:value-of select="$level_total - 1"/>
15787
+ </xsl:otherwise>
15788
+ </xsl:choose>
15789
+ </xsl:when>
15666
15790
  <xsl:when test="ancestor::*[local-name() = 'annex']">
15667
15791
  <xsl:value-of select="$level_total"/>
15668
15792
  </xsl:when>
@@ -16021,6 +16145,20 @@
16021
16145
 
16022
16146
  <!-- END: insert cover page image -->
16023
16147
 
16148
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertVerticalChar">
16149
+ <xsl:param name="str"/>
16150
+ <xsl:if test="string-length($str) &gt; 0">
16151
+ <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
16152
+ <fo:block-container width="1em">
16153
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
16154
+ </fo:block-container>
16155
+ </fo:inline-container>
16156
+ <xsl:call-template name="insertVerticalChar">
16157
+ <xsl:with-param name="str" select="substring($str, 2)"/>
16158
+ </xsl:call-template>
16159
+ </xsl:if>
16160
+ </xsl:template>
16161
+
16024
16162
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="number-to-words">
16025
16163
  <xsl:param name="number"/>
16026
16164
  <xsl:param name="first"/>
@@ -16308,4 +16446,18 @@
16308
16446
  </xsl:if>
16309
16447
  </xsl:template>
16310
16448
 
16449
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="@*|node()" mode="set_table_role_skip">
16450
+ <xsl:copy>
16451
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
16452
+ </xsl:copy>
16453
+ </xsl:template>
16454
+
16455
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
16456
+ <xsl:copy>
16457
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
16458
+ <xsl:attribute name="role">SKIP</xsl:attribute>
16459
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
16460
+ </xsl:copy>
16461
+ </xsl:template>
16462
+
16311
16463
  </xsl:stylesheet>