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.
@@ -5076,6 +5076,7 @@
5076
5076
 
5077
5077
  <fo:block role="SKIP">
5078
5078
  <xsl:apply-templates/>
5079
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5079
5080
  </fo:block>
5080
5081
  </fo:table-cell>
5081
5082
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -5139,6 +5140,8 @@
5139
5140
 
5140
5141
  <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"/> -->
5141
5142
 
5143
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5144
+
5142
5145
  </fo:block>
5143
5146
  </fo:table-cell>
5144
5147
  </xsl:template> <!-- td -->
@@ -7946,14 +7949,16 @@
7946
7949
  <xsl:template match="*[local-name()='link']" name="link">
7947
7950
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7948
7951
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7952
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7949
7953
  <xsl:variable name="target">
7950
7954
  <xsl:choose>
7951
7955
  <xsl:when test="@updatetype = 'true'">
7952
7956
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7953
7957
  </xsl:when>
7954
7958
  <!-- link to the PDF attachment -->
7955
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7956
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7959
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7960
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7961
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7957
7962
  </xsl:when>
7958
7963
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7959
7964
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7984,6 +7989,11 @@
7984
7989
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7985
7990
  </xsl:if>
7986
7991
 
7992
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7993
+ <xsl:attribute name="color">inherit</xsl:attribute>
7994
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7995
+ </xsl:if>
7996
+
7987
7997
  <xsl:call-template name="refine_link-style"/>
7988
7998
 
7989
7999
  <xsl:choose>
@@ -7994,6 +8004,9 @@
7994
8004
  <xsl:call-template name="insert_basic_link">
7995
8005
  <xsl:with-param name="element">
7996
8006
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8007
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8008
+ <xsl:attribute name="role">Annot</xsl:attribute>
8009
+ </xsl:if>
7997
8010
  <xsl:choose>
7998
8011
  <xsl:when test="normalize-space(.) = ''">
7999
8012
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -8006,6 +8019,10 @@
8006
8019
  </xsl:otherwise>
8007
8020
  </xsl:choose>
8008
8021
  </fo:basic-link>
8022
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8023
+ <!-- reserve space at right for PaperClip icon -->
8024
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
8025
+ </xsl:if>
8009
8026
  </xsl:with-param>
8010
8027
  </xsl:call-template>
8011
8028
  </xsl:otherwise>
@@ -13426,6 +13443,39 @@
13426
13443
  </pdf:catalog>
13427
13444
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13428
13445
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13446
+ <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="">
13447
+ <pdfaExtension:schemas>
13448
+ <rdf:Bag>
13449
+ <rdf:li rdf:parseType="Resource">
13450
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
13451
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
13452
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
13453
+ <pdfaSchema:property>
13454
+ <rdf:Seq>
13455
+ <rdf:li rdf:parseType="Resource">
13456
+ <pdfaProperty:category>internal</pdfaProperty:category>
13457
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
13458
+ <pdfaProperty:name>part</pdfaProperty:name>
13459
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
13460
+ </rdf:li>
13461
+ <rdf:li rdf:parseType="Resource">
13462
+ <pdfaProperty:category>internal</pdfaProperty:category>
13463
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
13464
+ <pdfaProperty:name>amd</pdfaProperty:name>
13465
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
13466
+ </rdf:li>
13467
+ <rdf:li rdf:parseType="Resource">
13468
+ <pdfaProperty:category>internal</pdfaProperty:category>
13469
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
13470
+ <pdfaProperty:name>corr</pdfaProperty:name>
13471
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
13472
+ </rdf:li>
13473
+ </rdf:Seq>
13474
+ </pdfaSchema:property>
13475
+ </rdf:li>
13476
+ </rdf:Bag>
13477
+ </pdfaExtension:schemas>
13478
+ </rdf:Description>
13429
13479
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
13430
13480
  <!-- Dublin Core properties go here -->
13431
13481
  <dc:title>
@@ -13436,30 +13486,54 @@
13436
13486
 
13437
13487
  </xsl:for-each>
13438
13488
  </xsl:variable>
13439
- <xsl:choose>
13440
- <xsl:when test="normalize-space($title) != ''">
13441
- <xsl:value-of select="$title"/>
13442
- </xsl:when>
13443
- <xsl:otherwise>
13444
- <xsl:text> </xsl:text>
13445
- </xsl:otherwise>
13446
- </xsl:choose>
13489
+ <rdf:Alt>
13490
+ <rdf:li xml:lang="x-default">
13491
+ <xsl:choose>
13492
+ <xsl:when test="normalize-space($title) != ''">
13493
+ <xsl:value-of select="$title"/>
13494
+ </xsl:when>
13495
+ <xsl:otherwise>
13496
+ <xsl:text> </xsl:text>
13497
+ </xsl:otherwise>
13498
+ </xsl:choose>
13499
+ </rdf:li>
13500
+ </rdf:Alt>
13447
13501
  </dc:title>
13448
- <dc:creator>
13502
+ <xsl:variable name="dc_creator">
13449
13503
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
13450
13504
 
13451
- <xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
13505
+ <rdf:Seq>
13506
+ <rdf:li>
13507
+ <xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
13508
+ </rdf:li>
13509
+ </rdf:Seq>
13452
13510
 
13453
13511
  </xsl:for-each>
13454
- </dc:creator>
13455
- <dc:description>
13512
+ </xsl:variable>
13513
+ <xsl:if test="normalize-space($dc_creator) != ''">
13514
+ <dc:creator>
13515
+ <xsl:copy-of select="$dc_creator"/>
13516
+ </dc:creator>
13517
+ </xsl:if>
13518
+
13519
+ <xsl:variable name="dc_description">
13456
13520
  <xsl:variable name="abstract">
13457
13521
 
13458
13522
  <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'title-main']"/>
13459
13523
 
13460
13524
  </xsl:variable>
13461
- <xsl:value-of select="normalize-space($abstract)"/>
13462
- </dc:description>
13525
+ <rdf:Alt>
13526
+ <rdf:li xml:lang="x-default">
13527
+ <xsl:value-of select="normalize-space($abstract)"/>
13528
+ </rdf:li>
13529
+ </rdf:Alt>
13530
+ </xsl:variable>
13531
+ <xsl:if test="normalize-space($dc_description)">
13532
+ <dc:description>
13533
+ <xsl:copy-of select="$dc_description"/>
13534
+ </dc:description>
13535
+ </xsl:if>
13536
+
13463
13537
  <pdf:Keywords>
13464
13538
  <xsl:call-template name="insertKeywords">
13465
13539
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -13474,9 +13548,14 @@
13474
13548
  </x:xmpmeta>
13475
13549
  <!-- add attachments -->
13476
13550
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13477
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13478
-
13479
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
13551
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
13552
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
13553
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13554
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13555
+ <!-- Todo: need update -->
13556
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13557
+
13558
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
13480
13559
  <xsl:attribute name="src">
13481
13560
  <xsl:choose>
13482
13561
  <xsl:when test="normalize-space() != ''">
@@ -13492,18 +13571,27 @@
13492
13571
  <xsl:if test="$description != ''">
13493
13572
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13494
13573
  </xsl:if>
13574
+ <xsl:if test="$afrelationship != ''">
13575
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13576
+ </xsl:if>
13495
13577
  </pdf:embedded-file>
13496
13578
  </xsl:for-each>
13497
13579
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13498
13580
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13499
13581
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13500
13582
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13583
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
13501
13584
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13502
13585
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13503
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
13586
+ <!-- Todo: need update -->
13587
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13588
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13504
13589
  <xsl:if test="$description != ''">
13505
13590
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13506
13591
  </xsl:if>
13592
+ <xsl:if test="$afrelationship != ''">
13593
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13594
+ </xsl:if>
13507
13595
  </pdf:embedded-file>
13508
13596
  </xsl:for-each>
13509
13597
  </xsl:if>
@@ -13523,6 +13611,12 @@
13523
13611
  <!-- Get or calculate depth of the element -->
13524
13612
  <xsl:template name="getLevel">
13525
13613
  <xsl:param name="depth"/>
13614
+ <!-- <xsl:message>
13615
+ <xsl:choose>
13616
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
13617
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
13618
+ </xsl:choose>
13619
+ </xsl:message> -->
13526
13620
  <xsl:choose>
13527
13621
  <xsl:when test="normalize-space(@depth) != ''">
13528
13622
  <xsl:value-of select="@depth"/>
@@ -13543,8 +13637,27 @@
13543
13637
  <xsl:when test="ancestor::*[local-name() = 'preface']">
13544
13638
  <xsl:value-of select="$level_total - 2"/>
13545
13639
  </xsl:when>
13640
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13641
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13642
+ <xsl:choose>
13643
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13644
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13645
+ </xsl:when>
13646
+ <xsl:otherwise>
13647
+ <xsl:value-of select="$level_total - 2"/>
13648
+ </xsl:otherwise>
13649
+ </xsl:choose>
13650
+ </xsl:when>
13546
13651
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13547
- <xsl:value-of select="$level_total - 1"/>
13652
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13653
+ <xsl:choose>
13654
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13655
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13656
+ </xsl:when>
13657
+ <xsl:otherwise>
13658
+ <xsl:value-of select="$level_total - 1"/>
13659
+ </xsl:otherwise>
13660
+ </xsl:choose>
13548
13661
  </xsl:when>
13549
13662
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13550
13663
  <xsl:value-of select="$level_total - 1"/>
@@ -13552,6 +13665,17 @@
13552
13665
  <xsl:when test="parent::*[local-name() = 'annex']">
13553
13666
  <xsl:value-of select="$level_total - 1"/>
13554
13667
  </xsl:when>
13668
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
13669
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13670
+ <xsl:choose>
13671
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13672
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13673
+ </xsl:when>
13674
+ <xsl:otherwise>
13675
+ <xsl:value-of select="$level_total - 1"/>
13676
+ </xsl:otherwise>
13677
+ </xsl:choose>
13678
+ </xsl:when>
13555
13679
  <xsl:when test="ancestor::*[local-name() = 'annex']">
13556
13680
  <xsl:value-of select="$level_total"/>
13557
13681
  </xsl:when>
@@ -13910,6 +14034,20 @@
13910
14034
 
13911
14035
  <!-- END: insert cover page image -->
13912
14036
 
14037
+ <xsl:template name="insertVerticalChar">
14038
+ <xsl:param name="str"/>
14039
+ <xsl:if test="string-length($str) &gt; 0">
14040
+ <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">
14041
+ <fo:block-container width="1em">
14042
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14043
+ </fo:block-container>
14044
+ </fo:inline-container>
14045
+ <xsl:call-template name="insertVerticalChar">
14046
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14047
+ </xsl:call-template>
14048
+ </xsl:if>
14049
+ </xsl:template>
14050
+
13913
14051
  <xsl:template name="number-to-words">
13914
14052
  <xsl:param name="number"/>
13915
14053
  <xsl:param name="first"/>
@@ -14197,4 +14335,18 @@
14197
14335
  </xsl:if>
14198
14336
  </xsl:template>
14199
14337
 
14338
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14339
+ <xsl:copy>
14340
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14341
+ </xsl:copy>
14342
+ </xsl:template>
14343
+
14344
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14345
+ <xsl:copy>
14346
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14347
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14348
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14349
+ </xsl:copy>
14350
+ </xsl:template>
14351
+
14200
14352
  </xsl:stylesheet>