metanorma-plateau 0.1.5 → 0.1.7

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: f4834c2ee47e184721abe8ad6bac4d72ee1e1d80eebd1edd5bf67fdf8f640be6
4
- data.tar.gz: cccbce71fa3b654e5183b814114f33490d56b9f738b9cf9db6d66eb9dc9f8881
3
+ metadata.gz: 2a8305a8257b5394f752d00acac7528bef4f3c705d3d48de912a3b7e0e56fc6b
4
+ data.tar.gz: 86a26d997e46cb1df2a6507393a41053e5b97f35f123f2dc88fb6f1c01605298
5
5
  SHA512:
6
- metadata.gz: 5c6185e00e3629e97e8aaace04150b1f44971c66b29e31addb05cffb81669d26c7fd880bb09e395c9317a471b9ab1c190dcb4a978c3838405a1df65ea733d12c
7
- data.tar.gz: a9fd04e142af38ff37848b710098e507652c0311bd6dc6d41392839ea1cb4c0ba4a4de583e977f2eca7542385e3d6a182a853e94eb2b424af112aae1e2f7e6ec
6
+ metadata.gz: ebd2eba5567af8905624373946856776907927f4268a5c9b76cc9c30db7eed2fc522975e871b08c2fd0e0d66f10059178782025efa39b2bc32da9edbbfd98896
7
+ data.tar.gz: 4e7f84a4f116a3cc4b4b6fbfb64d11b1b147b56afe7a79d557de1e28d0fc3ef208338c974abc4b11761592a6aeb9d13b4da15db18fabb5ee4c3c3f57e8d07128
@@ -6,7 +6,7 @@
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
9
- <xsl:variable name="isIgnoreComplexScripts">true</xsl:variable>
9
+ <!-- <xsl:variable name="isIgnoreComplexScripts">true</xsl:variable> -->
10
10
 
11
11
  <xsl:variable name="doctype" select="//plateau:plateau-standard[1]/plateau:bibdata/plateau:ext/plateau:doctype[@language = '' or not(@language)]"/>
12
12
 
@@ -14,6 +14,9 @@
14
14
  <xsl:variable name="i18n_doctype_dict_technical_report"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.technical-report</xsl:with-param></xsl:call-template></xsl:variable>
15
15
  <xsl:variable name="i18n_table_of_contents"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">table_of_contents</xsl:with-param></xsl:call-template></xsl:variable>
16
16
 
17
+ <xsl:variable name="vertical_layout" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout)"/>
18
+ <xsl:variable name="vertical_layout_rotate_clause_numbers" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout-rotate-clause-numbers)"/>
19
+
17
20
  <xsl:variable name="page_header">
18
21
  <xsl:value-of select="/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:use-case"/>
19
22
  <xsl:text>_</xsl:text>
@@ -90,7 +93,15 @@
90
93
  </fo:simple-page-master>
91
94
 
92
95
  <fo:simple-page-master master-name="document_preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
93
- <fo:region-body margin-top="50mm" margin-bottom="35mm" margin-left="26mm" margin-right="34mm"/>
96
+ <xsl:if test="$vertical_layout = 'true'">
97
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
98
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
99
+ </xsl:if>
100
+ <fo:region-body margin-top="50mm" margin-bottom="35mm" margin-left="26mm" margin-right="34mm">
101
+ <xsl:if test="$vertical_layout = 'true'">
102
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
103
+ </xsl:if>
104
+ </fo:region-body>
94
105
  <fo:region-before region-name="header" extent="50mm"/>
95
106
  <fo:region-after region-name="footer" extent="35mm"/>
96
107
  <fo:region-start region-name="left-region" extent="26mm"/>
@@ -98,7 +109,15 @@
98
109
  </fo:simple-page-master>
99
110
 
100
111
  <fo:simple-page-master master-name="document_toc" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
101
- <fo:region-body margin-top="16.5mm" margin-bottom="22mm" margin-left="14.5mm" margin-right="22.3mm"/>
112
+ <xsl:if test="$vertical_layout = 'true'">
113
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
114
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
115
+ </xsl:if>
116
+ <fo:region-body margin-top="16.5mm" margin-bottom="22mm" margin-left="14.5mm" margin-right="22.3mm">
117
+ <xsl:if test="$vertical_layout = 'true'">
118
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
119
+ </xsl:if>
120
+ </fo:region-body>
102
121
  <fo:region-before region-name="header" extent="16.5mm"/>
103
122
  <fo:region-after region-name="footer" extent="22mm"/>
104
123
  <fo:region-start region-name="left-region" extent="14.5mm"/>
@@ -106,7 +125,15 @@
106
125
  </fo:simple-page-master>
107
126
 
108
127
  <fo:simple-page-master master-name="document" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
109
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
128
+ <xsl:if test="$vertical_layout = 'true'">
129
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
130
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
131
+ </xsl:if>
132
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
133
+ <xsl:if test="$vertical_layout = 'true'">
134
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
135
+ </xsl:if>
136
+ </fo:region-body>
110
137
  <fo:region-before region-name="header" extent="{$marginTop}mm"/>
111
138
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
112
139
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -235,6 +262,11 @@
235
262
  <fo:static-content flow-name="header" role="artifact" id="__internal_layout__preface_header_{generate-id()}">
236
263
  <!-- grey background -->
237
264
  <fo:block-container absolute-position="fixed" left="24.2mm" top="40mm" height="231.4mm" width="161mm" background-color="rgb(242,242,242)" id="__internal_layout__preface_header_{$num}_{generate-id()}">
265
+ <xsl:if test="$vertical_layout = 'true'">
266
+ <xsl:attribute name="top">24.2mm</xsl:attribute>
267
+ <xsl:attribute name="left">40mm</xsl:attribute>
268
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
269
+ </xsl:if>
238
270
  <fo:block> </fo:block>
239
271
  </fo:block-container>
240
272
  </fo:static-content>
@@ -469,12 +501,22 @@
469
501
  <xsl:choose>
470
502
  <xsl:when test="$doctype = 'technical-report'">
471
503
  <fo:block space-after="5pt">
504
+ <xsl:variable name="margin-left">
505
+ <xsl:choose>
506
+ <xsl:when test="@level = 1">1</xsl:when>
507
+ <xsl:when test="@level = 2">3.5</xsl:when>
508
+ <xsl:when test="@level = 3">7</xsl:when>
509
+ <xsl:otherwise>10</xsl:otherwise>
510
+ </xsl:choose>
511
+ </xsl:variable>
472
512
  <xsl:attribute name="margin-left">
473
513
  <xsl:choose>
474
- <xsl:when test="@level = 1">1mm</xsl:when>
475
- <xsl:when test="@level = 2">3.5mm</xsl:when>
476
- <xsl:when test="@level = 3">7mm</xsl:when>
477
- <xsl:otherwise>10mm</xsl:otherwise>
514
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
515
+ <xsl:value-of select="concat($margin-left * 1.5, 'mm')"/>
516
+ </xsl:when>
517
+ <xsl:otherwise>
518
+ <xsl:value-of select="concat($margin-left, 'mm')"/>
519
+ </xsl:otherwise>
478
520
  </xsl:choose>
479
521
  </xsl:attribute>
480
522
  <xsl:call-template name="insertTocItem">
@@ -492,18 +534,38 @@
492
534
  <xsl:otherwise>
493
535
  <xsl:variable name="margin_left" select="number(@level - 1) * 3"/>
494
536
  <fo:list-block space-after="2pt" margin-left="{$margin_left}mm">
537
+ <xsl:variable name="provisional-distance-between-starts">
538
+ <xsl:choose>
539
+ <xsl:when test="@level = 1">7</xsl:when>
540
+ <xsl:when test="@level = 2">10</xsl:when>
541
+ <xsl:when test="@level = 3">14</xsl:when>
542
+ <xsl:otherwise>14</xsl:otherwise>
543
+ </xsl:choose>
544
+ </xsl:variable>
545
+
495
546
  <xsl:attribute name="provisional-distance-between-starts">
496
547
  <xsl:choose>
497
- <xsl:when test="@level = 1">7mm</xsl:when>
498
- <xsl:when test="@level = 2">10mm</xsl:when>
499
- <xsl:when test="@level = 3">14mm</xsl:when>
500
- <xsl:otherwise>14mm</xsl:otherwise>
548
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
549
+ <xsl:value-of select="concat($provisional-distance-between-starts * 1.5, 'mm')"/>
550
+ </xsl:when>
551
+ <xsl:otherwise>
552
+ <xsl:value-of select="concat($provisional-distance-between-starts, 'mm')"/>
553
+ </xsl:otherwise>
501
554
  </xsl:choose>
502
555
  </xsl:attribute>
503
556
  <fo:list-item>
504
557
  <fo:list-item-label end-indent="label-end()">
505
558
  <fo:block>
506
- <xsl:value-of select="@section"/>
559
+ <xsl:choose>
560
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
561
+ <xsl:call-template name="insertVerticalChar">
562
+ <xsl:with-param name="str" select="@section"/>
563
+ </xsl:call-template>
564
+ </xsl:when>
565
+ <xsl:otherwise>
566
+ <xsl:value-of select="@section"/>
567
+ </xsl:otherwise>
568
+ </xsl:choose>
507
569
  </fo:block>
508
570
  </fo:list-item-label>
509
571
  <fo:list-item-body start-indent="body-start()">
@@ -993,10 +1055,20 @@
993
1055
  <xsl:call-template name="extractSection"/>
994
1056
  </xsl:variable>
995
1057
  <xsl:if test="normalize-space($section) != ''">
996
- <fo:inline> <!-- font-family="Noto Sans Condensed" font-weight="bold" -->
997
- <xsl:value-of select="$section"/>
998
- <fo:inline padding-right="4mm"> </fo:inline>
999
- </fo:inline>
1058
+ <xsl:choose>
1059
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
1060
+ <xsl:call-template name="insertVerticalChar">
1061
+ <xsl:with-param name="str" select="$section"/>
1062
+ </xsl:call-template>
1063
+ <fo:inline padding-right="4mm"> </fo:inline>
1064
+ </xsl:when>
1065
+ <xsl:otherwise>
1066
+ <fo:inline> <!-- font-family="Noto Sans Condensed" font-weight="bold" -->
1067
+ <xsl:value-of select="$section"/>
1068
+ <fo:inline padding-right="4mm"> </fo:inline>
1069
+ </fo:inline>
1070
+ </xsl:otherwise>
1071
+ </xsl:choose>
1000
1072
  </xsl:if>
1001
1073
 
1002
1074
  <xsl:call-template name="extractTitle"/>
@@ -1648,12 +1720,24 @@
1648
1720
  <xsl:choose>
1649
1721
  <xsl:when test="$doctype = 'technical-report'">
1650
1722
  <fo:block-container height="23mm" display-align="after">
1651
- <fo:block text-align="center" margin-bottom="16mm">- <fo:page-number/> -</fo:block>
1723
+ <fo:block text-align="center" margin-bottom="16mm">
1724
+ <xsl:if test="$vertical_layout = 'true'">
1725
+ <xsl:attribute name="margin-bottom">0mm</xsl:attribute>
1726
+ </xsl:if>
1727
+ <xsl:text>- </xsl:text>
1728
+ <fo:page-number/>
1729
+ <xsl:text> -</xsl:text>
1730
+ </fo:block>
1652
1731
  </fo:block-container>
1653
1732
  </xsl:when>
1654
1733
  <xsl:otherwise>
1655
1734
  <fo:block-container height="24mm" display-align="after">
1656
- <fo:block text-align="center" margin-bottom="16mm"><fo:page-number/></fo:block>
1735
+ <fo:block text-align="center" margin-bottom="16mm">
1736
+ <xsl:if test="$vertical_layout = 'true'">
1737
+ <xsl:attribute name="margin-bottom">0mm</xsl:attribute>
1738
+ </xsl:if>
1739
+ <fo:page-number/>
1740
+ </fo:block>
1657
1741
  </fo:block-container>
1658
1742
  </xsl:otherwise>
1659
1743
  </xsl:choose>
@@ -4942,6 +5026,7 @@
4942
5026
 
4943
5027
  <fo:block role="SKIP">
4944
5028
  <xsl:apply-templates/>
5029
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4945
5030
  </fo:block>
4946
5031
  </fo:table-cell>
4947
5032
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -5005,6 +5090,8 @@
5005
5090
 
5006
5091
  <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"/> -->
5007
5092
 
5093
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5094
+
5008
5095
  </fo:block>
5009
5096
  </fo:table-cell>
5010
5097
  </xsl:template> <!-- td -->
@@ -7794,14 +7881,16 @@
7794
7881
  <xsl:template match="*[local-name()='link']" name="link">
7795
7882
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7796
7883
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7884
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7797
7885
  <xsl:variable name="target">
7798
7886
  <xsl:choose>
7799
7887
  <xsl:when test="@updatetype = 'true'">
7800
7888
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7801
7889
  </xsl:when>
7802
7890
  <!-- link to the PDF attachment -->
7803
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7804
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7891
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7892
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7893
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7805
7894
  </xsl:when>
7806
7895
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7807
7896
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7832,6 +7921,11 @@
7832
7921
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7833
7922
  </xsl:if>
7834
7923
 
7924
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7925
+ <xsl:attribute name="color">inherit</xsl:attribute>
7926
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7927
+ </xsl:if>
7928
+
7835
7929
  <xsl:call-template name="refine_link-style"/>
7836
7930
 
7837
7931
  <xsl:choose>
@@ -7842,6 +7936,9 @@
7842
7936
  <xsl:call-template name="insert_basic_link">
7843
7937
  <xsl:with-param name="element">
7844
7938
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7939
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7940
+ <xsl:attribute name="role">Annot</xsl:attribute>
7941
+ </xsl:if>
7845
7942
  <xsl:choose>
7846
7943
  <xsl:when test="normalize-space(.) = ''">
7847
7944
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7854,6 +7951,10 @@
7854
7951
  </xsl:otherwise>
7855
7952
  </xsl:choose>
7856
7953
  </fo:basic-link>
7954
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7955
+ <!-- reserve space at right for PaperClip icon -->
7956
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7957
+ </xsl:if>
7857
7958
  </xsl:with-param>
7858
7959
  </xsl:call-template>
7859
7960
  </xsl:otherwise>
@@ -13362,6 +13463,39 @@
13362
13463
  </pdf:catalog>
13363
13464
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13364
13465
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13466
+ <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="">
13467
+ <pdfaExtension:schemas>
13468
+ <rdf:Bag>
13469
+ <rdf:li rdf:parseType="Resource">
13470
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
13471
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
13472
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
13473
+ <pdfaSchema:property>
13474
+ <rdf:Seq>
13475
+ <rdf:li rdf:parseType="Resource">
13476
+ <pdfaProperty:category>internal</pdfaProperty:category>
13477
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
13478
+ <pdfaProperty:name>part</pdfaProperty:name>
13479
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
13480
+ </rdf:li>
13481
+ <rdf:li rdf:parseType="Resource">
13482
+ <pdfaProperty:category>internal</pdfaProperty:category>
13483
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
13484
+ <pdfaProperty:name>amd</pdfaProperty:name>
13485
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
13486
+ </rdf:li>
13487
+ <rdf:li rdf:parseType="Resource">
13488
+ <pdfaProperty:category>internal</pdfaProperty:category>
13489
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
13490
+ <pdfaProperty:name>corr</pdfaProperty:name>
13491
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
13492
+ </rdf:li>
13493
+ </rdf:Seq>
13494
+ </pdfaSchema:property>
13495
+ </rdf:li>
13496
+ </rdf:Bag>
13497
+ </pdfaExtension:schemas>
13498
+ </rdf:Description>
13365
13499
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
13366
13500
  <!-- Dublin Core properties go here -->
13367
13501
  <dc:title>
@@ -13372,33 +13506,57 @@
13372
13506
 
13373
13507
  </xsl:for-each>
13374
13508
  </xsl:variable>
13375
- <xsl:choose>
13376
- <xsl:when test="normalize-space($title) != ''">
13377
- <xsl:value-of select="$title"/>
13378
- </xsl:when>
13379
- <xsl:otherwise>
13380
- <xsl:text> </xsl:text>
13381
- </xsl:otherwise>
13382
- </xsl:choose>
13509
+ <rdf:Alt>
13510
+ <rdf:li xml:lang="x-default">
13511
+ <xsl:choose>
13512
+ <xsl:when test="normalize-space($title) != ''">
13513
+ <xsl:value-of select="$title"/>
13514
+ </xsl:when>
13515
+ <xsl:otherwise>
13516
+ <xsl:text> </xsl:text>
13517
+ </xsl:otherwise>
13518
+ </xsl:choose>
13519
+ </rdf:li>
13520
+ </rdf:Alt>
13383
13521
  </dc:title>
13384
- <dc:creator>
13522
+ <xsl:variable name="dc_creator">
13385
13523
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
13386
13524
 
13387
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
13388
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
13389
- <xsl:if test="position() != last()">; </xsl:if>
13390
- </xsl:for-each>
13525
+ <rdf:Seq>
13526
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
13527
+ <rdf:li>
13528
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
13529
+ </rdf:li>
13530
+ <!-- <xsl:if test="position() != last()">; </xsl:if> -->
13531
+ </xsl:for-each>
13532
+ </rdf:Seq>
13391
13533
 
13392
13534
  </xsl:for-each>
13393
- </dc:creator>
13394
- <dc:description>
13535
+ </xsl:variable>
13536
+ <xsl:if test="normalize-space($dc_creator) != ''">
13537
+ <dc:creator>
13538
+ <xsl:copy-of select="$dc_creator"/>
13539
+ </dc:creator>
13540
+ </xsl:if>
13541
+
13542
+ <xsl:variable name="dc_description">
13395
13543
  <xsl:variable name="abstract">
13396
13544
 
13397
13545
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
13398
13546
 
13399
13547
  </xsl:variable>
13400
- <xsl:value-of select="normalize-space($abstract)"/>
13401
- </dc:description>
13548
+ <rdf:Alt>
13549
+ <rdf:li xml:lang="x-default">
13550
+ <xsl:value-of select="normalize-space($abstract)"/>
13551
+ </rdf:li>
13552
+ </rdf:Alt>
13553
+ </xsl:variable>
13554
+ <xsl:if test="normalize-space($dc_description)">
13555
+ <dc:description>
13556
+ <xsl:copy-of select="$dc_description"/>
13557
+ </dc:description>
13558
+ </xsl:if>
13559
+
13402
13560
  <pdf:Keywords>
13403
13561
  <xsl:call-template name="insertKeywords">
13404
13562
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -13413,9 +13571,14 @@
13413
13571
  </x:xmpmeta>
13414
13572
  <!-- add attachments -->
13415
13573
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13416
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13417
-
13418
- <pdf:embedded-file filename="{@name}">
13574
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
13575
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
13576
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13577
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13578
+ <!-- Todo: need update -->
13579
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13580
+
13581
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13419
13582
  <xsl:attribute name="src">
13420
13583
  <xsl:choose>
13421
13584
  <xsl:when test="normalize-space() != ''">
@@ -13431,18 +13594,27 @@
13431
13594
  <xsl:if test="$description != ''">
13432
13595
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13433
13596
  </xsl:if>
13597
+ <xsl:if test="$afrelationship != ''">
13598
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13599
+ </xsl:if>
13434
13600
  </pdf:embedded-file>
13435
13601
  </xsl:for-each>
13436
13602
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13437
13603
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13438
13604
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13439
13605
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13606
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
13440
13607
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13441
13608
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13442
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13609
+ <!-- Todo: need update -->
13610
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13611
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13443
13612
  <xsl:if test="$description != ''">
13444
13613
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13445
13614
  </xsl:if>
13615
+ <xsl:if test="$afrelationship != ''">
13616
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13617
+ </xsl:if>
13446
13618
  </pdf:embedded-file>
13447
13619
  </xsl:for-each>
13448
13620
  </xsl:if>
@@ -13462,6 +13634,12 @@
13462
13634
  <!-- Get or calculate depth of the element -->
13463
13635
  <xsl:template name="getLevel">
13464
13636
  <xsl:param name="depth"/>
13637
+ <!-- <xsl:message>
13638
+ <xsl:choose>
13639
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
13640
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
13641
+ </xsl:choose>
13642
+ </xsl:message> -->
13465
13643
  <xsl:choose>
13466
13644
  <xsl:when test="normalize-space(@depth) != ''">
13467
13645
  <xsl:value-of select="@depth"/>
@@ -13482,8 +13660,27 @@
13482
13660
  <xsl:when test="ancestor::*[local-name() = 'preface']">
13483
13661
  <xsl:value-of select="$level_total - 2"/>
13484
13662
  </xsl:when>
13663
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13664
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13665
+ <xsl:choose>
13666
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13667
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13668
+ </xsl:when>
13669
+ <xsl:otherwise>
13670
+ <xsl:value-of select="$level_total - 2"/>
13671
+ </xsl:otherwise>
13672
+ </xsl:choose>
13673
+ </xsl:when>
13485
13674
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13486
- <xsl:value-of select="$level_total - 1"/>
13675
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13676
+ <xsl:choose>
13677
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13678
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13679
+ </xsl:when>
13680
+ <xsl:otherwise>
13681
+ <xsl:value-of select="$level_total - 1"/>
13682
+ </xsl:otherwise>
13683
+ </xsl:choose>
13487
13684
  </xsl:when>
13488
13685
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13489
13686
  <xsl:value-of select="$level_total - 1"/>
@@ -13491,6 +13688,17 @@
13491
13688
  <xsl:when test="parent::*[local-name() = 'annex']">
13492
13689
  <xsl:value-of select="$level_total - 1"/>
13493
13690
  </xsl:when>
13691
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
13692
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13693
+ <xsl:choose>
13694
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13695
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13696
+ </xsl:when>
13697
+ <xsl:otherwise>
13698
+ <xsl:value-of select="$level_total - 1"/>
13699
+ </xsl:otherwise>
13700
+ </xsl:choose>
13701
+ </xsl:when>
13494
13702
  <xsl:when test="ancestor::*[local-name() = 'annex']">
13495
13703
  <xsl:value-of select="$level_total"/>
13496
13704
  </xsl:when>
@@ -13847,6 +14055,20 @@
13847
14055
 
13848
14056
  <!-- END: insert cover page image -->
13849
14057
 
14058
+ <xsl:template name="insertVerticalChar">
14059
+ <xsl:param name="str"/>
14060
+ <xsl:if test="string-length($str) &gt; 0">
14061
+ <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">
14062
+ <fo:block-container width="1em">
14063
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14064
+ </fo:block-container>
14065
+ </fo:inline-container>
14066
+ <xsl:call-template name="insertVerticalChar">
14067
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14068
+ </xsl:call-template>
14069
+ </xsl:if>
14070
+ </xsl:template>
14071
+
13850
14072
  <xsl:template name="number-to-words">
13851
14073
  <xsl:param name="number"/>
13852
14074
  <xsl:param name="first"/>
@@ -14134,4 +14356,18 @@
14134
14356
  </xsl:if>
14135
14357
  </xsl:template>
14136
14358
 
14359
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14360
+ <xsl:copy>
14361
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14362
+ </xsl:copy>
14363
+ </xsl:template>
14364
+
14365
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14366
+ <xsl:copy>
14367
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14368
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14369
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14370
+ </xsl:copy>
14371
+ </xsl:template>
14372
+
14137
14373
  </xsl:stylesheet>