metanorma-itu 2.5.2 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5994,6 +5994,7 @@
5994
5994
 
5995
5995
  <fo:block role="SKIP">
5996
5996
  <xsl:apply-templates/>
5997
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5997
5998
  </fo:block>
5998
5999
  </fo:table-cell>
5999
6000
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -6057,6 +6058,8 @@
6057
6058
 
6058
6059
  <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"/> -->
6059
6060
 
6061
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
6062
+
6060
6063
  </fo:block>
6061
6064
  </fo:table-cell>
6062
6065
  </xsl:template> <!-- td -->
@@ -8892,14 +8895,16 @@
8892
8895
  <xsl:template match="*[local-name()='link']" name="link">
8893
8896
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8894
8897
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8898
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
8895
8899
  <xsl:variable name="target">
8896
8900
  <xsl:choose>
8897
8901
  <xsl:when test="@updatetype = 'true'">
8898
8902
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8899
8903
  </xsl:when>
8900
8904
  <!-- link to the PDF attachment -->
8901
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8902
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8905
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
8906
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
8907
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
8903
8908
  </xsl:when>
8904
8909
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8905
8910
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -8930,6 +8935,11 @@
8930
8935
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8931
8936
  </xsl:if>
8932
8937
 
8938
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8939
+ <xsl:attribute name="color">inherit</xsl:attribute>
8940
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
8941
+ </xsl:if>
8942
+
8933
8943
  <xsl:call-template name="refine_link-style"/>
8934
8944
 
8935
8945
  <xsl:choose>
@@ -8940,6 +8950,9 @@
8940
8950
  <xsl:call-template name="insert_basic_link">
8941
8951
  <xsl:with-param name="element">
8942
8952
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8953
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8954
+ <xsl:attribute name="role">Annot</xsl:attribute>
8955
+ </xsl:if>
8943
8956
  <xsl:choose>
8944
8957
  <xsl:when test="normalize-space(.) = ''">
8945
8958
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -8952,6 +8965,10 @@
8952
8965
  </xsl:otherwise>
8953
8966
  </xsl:choose>
8954
8967
  </fo:basic-link>
8968
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8969
+ <!-- reserve space at right for PaperClip icon -->
8970
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
8971
+ </xsl:if>
8955
8972
  </xsl:with-param>
8956
8973
  </xsl:call-template>
8957
8974
  </xsl:otherwise>
@@ -14395,6 +14412,39 @@
14395
14412
  </pdf:catalog>
14396
14413
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14397
14414
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14415
+ <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="">
14416
+ <pdfaExtension:schemas>
14417
+ <rdf:Bag>
14418
+ <rdf:li rdf:parseType="Resource">
14419
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
14420
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
14421
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
14422
+ <pdfaSchema:property>
14423
+ <rdf:Seq>
14424
+ <rdf:li rdf:parseType="Resource">
14425
+ <pdfaProperty:category>internal</pdfaProperty:category>
14426
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
14427
+ <pdfaProperty:name>part</pdfaProperty:name>
14428
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
14429
+ </rdf:li>
14430
+ <rdf:li rdf:parseType="Resource">
14431
+ <pdfaProperty:category>internal</pdfaProperty:category>
14432
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
14433
+ <pdfaProperty:name>amd</pdfaProperty:name>
14434
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
14435
+ </rdf:li>
14436
+ <rdf:li rdf:parseType="Resource">
14437
+ <pdfaProperty:category>internal</pdfaProperty:category>
14438
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
14439
+ <pdfaProperty:name>corr</pdfaProperty:name>
14440
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
14441
+ </rdf:li>
14442
+ </rdf:Seq>
14443
+ </pdfaSchema:property>
14444
+ </rdf:li>
14445
+ </rdf:Bag>
14446
+ </pdfaExtension:schemas>
14447
+ </rdf:Description>
14398
14448
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
14399
14449
  <!-- Dublin Core properties go here -->
14400
14450
  <dc:title>
@@ -14405,33 +14455,57 @@
14405
14455
 
14406
14456
  </xsl:for-each>
14407
14457
  </xsl:variable>
14408
- <xsl:choose>
14409
- <xsl:when test="normalize-space($title) != ''">
14410
- <xsl:value-of select="$title"/>
14411
- </xsl:when>
14412
- <xsl:otherwise>
14413
- <xsl:text> </xsl:text>
14414
- </xsl:otherwise>
14415
- </xsl:choose>
14458
+ <rdf:Alt>
14459
+ <rdf:li xml:lang="x-default">
14460
+ <xsl:choose>
14461
+ <xsl:when test="normalize-space($title) != ''">
14462
+ <xsl:value-of select="$title"/>
14463
+ </xsl:when>
14464
+ <xsl:otherwise>
14465
+ <xsl:text> </xsl:text>
14466
+ </xsl:otherwise>
14467
+ </xsl:choose>
14468
+ </rdf:li>
14469
+ </rdf:Alt>
14416
14470
  </dc:title>
14417
- <dc:creator>
14471
+ <xsl:variable name="dc_creator">
14418
14472
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
14419
14473
 
14420
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
14421
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
14422
- <xsl:if test="position() != last()">; </xsl:if>
14423
- </xsl:for-each>
14474
+ <rdf:Seq>
14475
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
14476
+ <rdf:li>
14477
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
14478
+ </rdf:li>
14479
+ <!-- <xsl:if test="position() != last()">; </xsl:if> -->
14480
+ </xsl:for-each>
14481
+ </rdf:Seq>
14424
14482
 
14425
14483
  </xsl:for-each>
14426
- </dc:creator>
14427
- <dc:description>
14484
+ </xsl:variable>
14485
+ <xsl:if test="normalize-space($dc_creator) != ''">
14486
+ <dc:creator>
14487
+ <xsl:copy-of select="$dc_creator"/>
14488
+ </dc:creator>
14489
+ </xsl:if>
14490
+
14491
+ <xsl:variable name="dc_description">
14428
14492
  <xsl:variable name="abstract">
14429
14493
 
14430
14494
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14431
14495
 
14432
14496
  </xsl:variable>
14433
- <xsl:value-of select="normalize-space($abstract)"/>
14434
- </dc:description>
14497
+ <rdf:Alt>
14498
+ <rdf:li xml:lang="x-default">
14499
+ <xsl:value-of select="normalize-space($abstract)"/>
14500
+ </rdf:li>
14501
+ </rdf:Alt>
14502
+ </xsl:variable>
14503
+ <xsl:if test="normalize-space($dc_description)">
14504
+ <dc:description>
14505
+ <xsl:copy-of select="$dc_description"/>
14506
+ </dc:description>
14507
+ </xsl:if>
14508
+
14435
14509
  <pdf:Keywords>
14436
14510
  <xsl:call-template name="insertKeywords">
14437
14511
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -14446,9 +14520,14 @@
14446
14520
  </x:xmpmeta>
14447
14521
  <!-- add attachments -->
14448
14522
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14449
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14450
-
14451
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14523
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
14524
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
14525
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14526
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14527
+ <!-- Todo: need update -->
14528
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14529
+
14530
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14452
14531
  <xsl:attribute name="src">
14453
14532
  <xsl:choose>
14454
14533
  <xsl:when test="normalize-space() != ''">
@@ -14464,18 +14543,27 @@
14464
14543
  <xsl:if test="$description != ''">
14465
14544
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14466
14545
  </xsl:if>
14546
+ <xsl:if test="$afrelationship != ''">
14547
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14548
+ </xsl:if>
14467
14549
  </pdf:embedded-file>
14468
14550
  </xsl:for-each>
14469
14551
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14470
14552
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14471
14553
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14472
14554
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14555
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
14473
14556
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14474
14557
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14475
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14558
+ <!-- Todo: need update -->
14559
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14560
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14476
14561
  <xsl:if test="$description != ''">
14477
14562
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14478
14563
  </xsl:if>
14564
+ <xsl:if test="$afrelationship != ''">
14565
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14566
+ </xsl:if>
14479
14567
  </pdf:embedded-file>
14480
14568
  </xsl:for-each>
14481
14569
  </xsl:if>
@@ -14495,6 +14583,12 @@
14495
14583
  <!-- Get or calculate depth of the element -->
14496
14584
  <xsl:template name="getLevel">
14497
14585
  <xsl:param name="depth"/>
14586
+ <!-- <xsl:message>
14587
+ <xsl:choose>
14588
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
14589
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
14590
+ </xsl:choose>
14591
+ </xsl:message> -->
14498
14592
  <xsl:choose>
14499
14593
  <xsl:when test="normalize-space(@depth) != ''">
14500
14594
  <xsl:value-of select="@depth"/>
@@ -14515,8 +14609,27 @@
14515
14609
  <xsl:when test="ancestor::*[local-name() = 'preface']">
14516
14610
  <xsl:value-of select="$level_total - 2"/>
14517
14611
  </xsl:when>
14612
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14613
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14614
+ <xsl:choose>
14615
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14616
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14617
+ </xsl:when>
14618
+ <xsl:otherwise>
14619
+ <xsl:value-of select="$level_total - 2"/>
14620
+ </xsl:otherwise>
14621
+ </xsl:choose>
14622
+ </xsl:when>
14518
14623
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14519
- <xsl:value-of select="$level_total - 1"/>
14624
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
14625
+ <xsl:choose>
14626
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14627
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14628
+ </xsl:when>
14629
+ <xsl:otherwise>
14630
+ <xsl:value-of select="$level_total - 1"/>
14631
+ </xsl:otherwise>
14632
+ </xsl:choose>
14520
14633
  </xsl:when>
14521
14634
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
14522
14635
  <xsl:value-of select="$level_total - 1"/>
@@ -14524,6 +14637,17 @@
14524
14637
  <xsl:when test="parent::*[local-name() = 'annex']">
14525
14638
  <xsl:value-of select="$level_total - 1"/>
14526
14639
  </xsl:when>
14640
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
14641
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14642
+ <xsl:choose>
14643
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14644
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14645
+ </xsl:when>
14646
+ <xsl:otherwise>
14647
+ <xsl:value-of select="$level_total - 1"/>
14648
+ </xsl:otherwise>
14649
+ </xsl:choose>
14650
+ </xsl:when>
14527
14651
  <xsl:when test="ancestor::*[local-name() = 'annex']">
14528
14652
  <xsl:value-of select="$level_total"/>
14529
14653
  </xsl:when>
@@ -14882,6 +15006,20 @@
14882
15006
 
14883
15007
  <!-- END: insert cover page image -->
14884
15008
 
15009
+ <xsl:template name="insertVerticalChar">
15010
+ <xsl:param name="str"/>
15011
+ <xsl:if test="string-length($str) &gt; 0">
15012
+ <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">
15013
+ <fo:block-container width="1em">
15014
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
15015
+ </fo:block-container>
15016
+ </fo:inline-container>
15017
+ <xsl:call-template name="insertVerticalChar">
15018
+ <xsl:with-param name="str" select="substring($str, 2)"/>
15019
+ </xsl:call-template>
15020
+ </xsl:if>
15021
+ </xsl:template>
15022
+
14885
15023
  <xsl:template name="number-to-words">
14886
15024
  <xsl:param name="number"/>
14887
15025
  <xsl:param name="first"/>
@@ -15169,4 +15307,18 @@
15169
15307
  </xsl:if>
15170
15308
  </xsl:template>
15171
15309
 
15310
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
15311
+ <xsl:copy>
15312
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
15313
+ </xsl:copy>
15314
+ </xsl:template>
15315
+
15316
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
15317
+ <xsl:copy>
15318
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
15319
+ <xsl:attribute name="role">SKIP</xsl:attribute>
15320
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
15321
+ </xsl:copy>
15322
+ </xsl:template>
15323
+
15172
15324
  </xsl:stylesheet>