metanorma-jis 0.3.4 → 0.3.5

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: 767a090a3aebe22d2d6f00eb901394cc4c03b2e0bd27cc742ed5474234dc3ae7
4
- data.tar.gz: f3bf668006d08059015df61d5970c17cb812f95ab524e403d0be44570e7f6925
3
+ metadata.gz: fd38af1784c6d7f4494cbf4203af167b130319d5d339c56dff97b0e42d1fb264
4
+ data.tar.gz: a54d5df226904400904b7e907fbdb665e20096c3136c6aa4c37ccc98b6c9b3e3
5
5
  SHA512:
6
- metadata.gz: 415691142621e73ecad0196c8538ef4ee69a3101fb54273f93493c0ea8bf213f0d2e53b080f04834e39b85d282b043a59270b3332f37bc40e6511eeeebc4e7e1
7
- data.tar.gz: 45c5df4d2172923555dd91a7071a06f113a2d7990608f755ee7cb9d8f7ddee1c00ec9a7b4197d09ad0d0308044ab1573ff65750913b5aedba29265880d1b0985
6
+ metadata.gz: 3733abc0cc0b77fc8401adb1ae3430afc980384ae45a3a9f45739913ce8d963e29c354b7bdbe9a9149f1fef1bd7681c6d0f8167de9a44979c680383f2d6295d4
7
+ data.tar.gz: 267bc08daa21eda8885b747ba70503441643a5dd99dca434878573045d477f4757991fe8f89e6a922f026272cf17f04128031d29d7f4cfbfb3d058533dbe97ff
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -6,7 +6,10 @@
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
+
11
+ <xsl:variable name="vertical_layout" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:vertical-layout)"/>
12
+ <xsl:variable name="vertical_layout_rotate_clause_numbers" select="normalize-space(/*/jis:metanorma-extension/jis:presentation-metadata/jis:vertical-layout-rotate-clause-numbers)"/>
10
13
 
11
14
  <xsl:variable name="contents_">
12
15
  <xsl:variable name="bundle" select="count(//jis:jis-standard) &gt; 1"/>
@@ -67,21 +70,45 @@
67
70
  </fo:simple-page-master>
68
71
 
69
72
  <fo:simple-page-master master-name="first_page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
70
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
73
+ <xsl:if test="$vertical_layout = 'true'">
74
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
75
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
76
+ </xsl:if>
77
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
78
+ <xsl:if test="$vertical_layout = 'true'">
79
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
80
+ </xsl:if>
81
+ </fo:region-body>
71
82
  <fo:region-before region-name="header" extent="{$marginTop}mm"/>
72
83
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
73
84
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
85
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
75
86
  </fo:simple-page-master>
76
87
  <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
88
+ <xsl:if test="$vertical_layout = 'true'">
89
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
90
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
91
+ </xsl:if>
92
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
93
+ <xsl:if test="$vertical_layout = 'true'">
94
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
95
+ </xsl:if>
96
+ </fo:region-body>
78
97
  <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
79
98
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
80
99
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
81
100
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
82
101
  </fo:simple-page-master>
83
102
  <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
84
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
103
+ <xsl:if test="$vertical_layout = 'true'">
104
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
105
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
106
+ </xsl:if>
107
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
108
+ <xsl:if test="$vertical_layout = 'true'">
109
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
110
+ </xsl:if>
111
+ </fo:region-body>
85
112
  <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
86
113
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
87
114
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -89,7 +116,15 @@
89
116
  </fo:simple-page-master>
90
117
 
91
118
  <fo:simple-page-master master-name="first_page_toc" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
92
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
119
+ <xsl:if test="$vertical_layout = 'true'">
120
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
121
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
122
+ </xsl:if>
123
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
124
+ <xsl:if test="$vertical_layout = 'true'">
125
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
126
+ </xsl:if>
127
+ </fo:region-body>
93
128
  <fo:region-before region-name="header-odd-first" extent="{$marginTop}mm"/>
94
129
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
95
130
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -127,7 +162,15 @@
127
162
  </fo:page-sequence-master>
128
163
 
129
164
  <fo:simple-page-master master-name="commentary_first_page_even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
130
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
165
+ <xsl:if test="$vertical_layout = 'true'">
166
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
167
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
168
+ </xsl:if>
169
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
170
+ <xsl:if test="$vertical_layout = 'true'">
171
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
172
+ </xsl:if>
173
+ </fo:region-body>
131
174
  <fo:region-before region-name="header-commentary-even-first" extent="{$marginTop}mm"/>
132
175
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
133
176
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -135,7 +178,15 @@
135
178
  </fo:simple-page-master>
136
179
 
137
180
  <fo:simple-page-master master-name="commentary_first_page_odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
138
- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
181
+ <xsl:if test="$vertical_layout = 'true'">
182
+ <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
183
+ <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
184
+ </xsl:if>
185
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
186
+ <xsl:if test="$vertical_layout = 'true'">
187
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
188
+ </xsl:if>
189
+ </fo:region-body>
139
190
  <fo:region-before region-name="header-commentary-odd-first" extent="{$marginTop}mm"/>
140
191
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
141
192
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
@@ -592,12 +643,22 @@
592
643
  </xsl:when>
593
644
  <xsl:otherwise>
594
645
  <fo:list-block space-after="5pt">
646
+ <xsl:variable name="provisional-distance-between-starts">
647
+ <xsl:choose>
648
+ <xsl:when test="string-length(@section) = 1">5</xsl:when>
649
+ <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/></xsl:when>
650
+ <xsl:when test="@type = 'annex'">16</xsl:when>
651
+ <xsl:otherwise>5</xsl:otherwise>
652
+ </xsl:choose>
653
+ </xsl:variable>
595
654
  <xsl:attribute name="provisional-distance-between-starts">
596
655
  <xsl:choose>
597
- <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
598
- <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
599
- <xsl:when test="@type = 'annex'">16mm</xsl:when>
600
- <xsl:otherwise>5mm</xsl:otherwise>
656
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
657
+ <xsl:value-of select="concat($provisional-distance-between-starts * 1.5, 'mm')"/>
658
+ </xsl:when>
659
+ <xsl:otherwise>
660
+ <xsl:value-of select="concat($provisional-distance-between-starts, 'mm')"/>
661
+ </xsl:otherwise>
601
662
  </xsl:choose>
602
663
  </xsl:attribute>
603
664
  <fo:list-item>
@@ -1112,10 +1173,24 @@
1112
1173
  <xsl:call-template name="extractSection"/>
1113
1174
  </xsl:variable>
1114
1175
  <xsl:if test="normalize-space($section) != ''">
1115
- <fo:inline font-family="Times New Roman" font-weight="bold">
1116
- <xsl:value-of select="$section"/>
1117
- <fo:inline padding-right="4mm"> </fo:inline>
1118
- </fo:inline>
1176
+
1177
+ <xsl:choose>
1178
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
1179
+ <fo:inline font-family="Times New Roman" font-weight="bold">
1180
+ <xsl:call-template name="insertVerticalChar">
1181
+ <xsl:with-param name="str" select="$section"/>
1182
+ </xsl:call-template>
1183
+ </fo:inline>
1184
+ <fo:inline padding-right="4mm"> </fo:inline>
1185
+ </xsl:when>
1186
+ <xsl:otherwise>
1187
+ <fo:inline font-family="Times New Roman" font-weight="bold">
1188
+ <xsl:value-of select="$section"/>
1189
+ <fo:inline padding-right="4mm"> </fo:inline>
1190
+ </fo:inline>
1191
+ </xsl:otherwise>
1192
+ </xsl:choose>
1193
+
1119
1194
  </xsl:if>
1120
1195
 
1121
1196
  <xsl:call-template name="extractTitle"/>
@@ -1595,6 +1670,9 @@
1595
1670
  <xsl:param name="section_title"/>
1596
1671
  <fo:static-content flow-name="header-odd-first" role="artifact">
1597
1672
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1673
+ <xsl:if test="$vertical_layout = 'true'">
1674
+ <xsl:attribute name="display-align">center</xsl:attribute>
1675
+ </xsl:if>
1598
1676
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1599
1677
  <fo:block>
1600
1678
  <xsl:copy-of select="$docidentifier"/>
@@ -1603,6 +1681,9 @@
1603
1681
  </fo:static-content>
1604
1682
  <fo:static-content flow-name="header-odd" role="artifact">
1605
1683
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1684
+ <xsl:if test="$vertical_layout = 'true'">
1685
+ <xsl:attribute name="display-align">center</xsl:attribute>
1686
+ </xsl:if>
1606
1687
  <xsl:if test="$section = 'main' or $section = 'commentary'"><fo:block><fo:page-number/></fo:block></xsl:if>
1607
1688
  <fo:block>
1608
1689
  <xsl:copy-of select="$docidentifier"/>
@@ -1612,6 +1693,9 @@
1612
1693
  </fo:static-content>
1613
1694
  <fo:static-content flow-name="header-even" role="artifact">
1614
1695
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after">
1696
+ <xsl:if test="$vertical_layout = 'true'">
1697
+ <xsl:attribute name="display-align">center</xsl:attribute>
1698
+ </xsl:if>
1615
1699
  <xsl:if test="$section = 'main' or $section = 'commentary'"><fo:block><fo:page-number/></fo:block></xsl:if>
1616
1700
  <fo:block>
1617
1701
  <xsl:copy-of select="$docidentifier"/>
@@ -1622,6 +1706,9 @@
1622
1706
 
1623
1707
  <fo:static-content flow-name="header-commentary-even-first" role="artifact">
1624
1708
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="left">
1709
+ <xsl:if test="$vertical_layout = 'true'">
1710
+ <xsl:attribute name="display-align">center</xsl:attribute>
1711
+ </xsl:if>
1625
1712
  <fo:block><fo:page-number/></fo:block>
1626
1713
  <fo:block> </fo:block>
1627
1714
  </fo:block-container>
@@ -1629,6 +1716,9 @@
1629
1716
 
1630
1717
  <fo:static-content flow-name="header-commentary-odd-first" role="artifact">
1631
1718
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1719
+ <xsl:if test="$vertical_layout = 'true'">
1720
+ <xsl:attribute name="display-align">center</xsl:attribute>
1721
+ </xsl:if>
1632
1722
  <fo:block><fo:page-number/></fo:block>
1633
1723
  <fo:block> </fo:block>
1634
1724
  </fo:block-container>
@@ -1662,7 +1752,12 @@
1662
1752
  </fo:block>
1663
1753
  </xsl:if>
1664
1754
  <!-- copyright restriction -->
1665
- <fo:block font-size="7pt" text-align="center" font-family="IPAexMincho" margin-bottom="13mm"><xsl:value-of select="$copyrightText"/></fo:block>
1755
+ <fo:block font-size="7pt" text-align="center" font-family="IPAexMincho" margin-bottom="13mm">
1756
+ <xsl:if test="$vertical_layout = 'true'">
1757
+ <xsl:attribute name="margin-bottom">5mm</xsl:attribute>
1758
+ </xsl:if>
1759
+ <xsl:value-of select="$copyrightText"/>
1760
+ </fo:block>
1666
1761
  </fo:block-container>
1667
1762
  </fo:static-content>
1668
1763
  </xsl:template>
@@ -4865,6 +4960,7 @@
4865
4960
 
4866
4961
  <fo:block role="SKIP">
4867
4962
  <xsl:apply-templates/>
4963
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4868
4964
  </fo:block>
4869
4965
  </fo:table-cell>
4870
4966
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -4928,6 +5024,8 @@
4928
5024
 
4929
5025
  <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"/> -->
4930
5026
 
5027
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5028
+
4931
5029
  </fo:block>
4932
5030
  </fo:table-cell>
4933
5031
  </xsl:template> <!-- td -->
@@ -7738,14 +7836,16 @@
7738
7836
  <xsl:template match="*[local-name()='link']" name="link">
7739
7837
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7740
7838
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7839
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7741
7840
  <xsl:variable name="target">
7742
7841
  <xsl:choose>
7743
7842
  <xsl:when test="@updatetype = 'true'">
7744
7843
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7745
7844
  </xsl:when>
7746
7845
  <!-- link to the PDF attachment -->
7747
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7748
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7846
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7847
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7848
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7749
7849
  </xsl:when>
7750
7850
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7751
7851
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7776,6 +7876,11 @@
7776
7876
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7777
7877
  </xsl:if>
7778
7878
 
7879
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7880
+ <xsl:attribute name="color">inherit</xsl:attribute>
7881
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7882
+ </xsl:if>
7883
+
7779
7884
  <xsl:call-template name="refine_link-style"/>
7780
7885
 
7781
7886
  <xsl:choose>
@@ -7786,6 +7891,9 @@
7786
7891
  <xsl:call-template name="insert_basic_link">
7787
7892
  <xsl:with-param name="element">
7788
7893
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7894
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7895
+ <xsl:attribute name="role">Annot</xsl:attribute>
7896
+ </xsl:if>
7789
7897
  <xsl:choose>
7790
7898
  <xsl:when test="normalize-space(.) = ''">
7791
7899
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7798,6 +7906,10 @@
7798
7906
  </xsl:otherwise>
7799
7907
  </xsl:choose>
7800
7908
  </fo:basic-link>
7909
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7910
+ <!-- reserve space at right for PaperClip icon -->
7911
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7912
+ </xsl:if>
7801
7913
  </xsl:with-param>
7802
7914
  </xsl:call-template>
7803
7915
  </xsl:otherwise>
@@ -13416,9 +13528,14 @@
13416
13528
  </x:xmpmeta>
13417
13529
  <!-- add attachments -->
13418
13530
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13419
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13420
-
13421
- <pdf:embedded-file filename="{@name}">
13531
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
13532
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
13533
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13534
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13535
+ <!-- Todo: need update -->
13536
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13537
+
13538
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13422
13539
  <xsl:attribute name="src">
13423
13540
  <xsl:choose>
13424
13541
  <xsl:when test="normalize-space() != ''">
@@ -13434,18 +13551,27 @@
13434
13551
  <xsl:if test="$description != ''">
13435
13552
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13436
13553
  </xsl:if>
13554
+ <xsl:if test="$afrelationship != ''">
13555
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13556
+ </xsl:if>
13437
13557
  </pdf:embedded-file>
13438
13558
  </xsl:for-each>
13439
13559
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13440
13560
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13441
13561
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13442
13562
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13563
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
13443
13564
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13444
13565
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13445
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13566
+ <!-- Todo: need update -->
13567
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13568
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13446
13569
  <xsl:if test="$description != ''">
13447
13570
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13448
13571
  </xsl:if>
13572
+ <xsl:if test="$afrelationship != ''">
13573
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13574
+ </xsl:if>
13449
13575
  </pdf:embedded-file>
13450
13576
  </xsl:for-each>
13451
13577
  </xsl:if>
@@ -13465,6 +13591,12 @@
13465
13591
  <!-- Get or calculate depth of the element -->
13466
13592
  <xsl:template name="getLevel">
13467
13593
  <xsl:param name="depth"/>
13594
+ <!-- <xsl:message>
13595
+ <xsl:choose>
13596
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
13597
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
13598
+ </xsl:choose>
13599
+ </xsl:message> -->
13468
13600
  <xsl:choose>
13469
13601
  <xsl:when test="normalize-space(@depth) != ''">
13470
13602
  <xsl:value-of select="@depth"/>
@@ -13485,8 +13617,27 @@
13485
13617
  <xsl:when test="ancestor::*[local-name() = 'preface']">
13486
13618
  <xsl:value-of select="$level_total - 2"/>
13487
13619
  </xsl:when>
13620
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13621
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13622
+ <xsl:choose>
13623
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13624
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13625
+ </xsl:when>
13626
+ <xsl:otherwise>
13627
+ <xsl:value-of select="$level_total - 2"/>
13628
+ </xsl:otherwise>
13629
+ </xsl:choose>
13630
+ </xsl:when>
13488
13631
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13489
- <xsl:value-of select="$level_total - 1"/>
13632
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13633
+ <xsl:choose>
13634
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13635
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13636
+ </xsl:when>
13637
+ <xsl:otherwise>
13638
+ <xsl:value-of select="$level_total - 1"/>
13639
+ </xsl:otherwise>
13640
+ </xsl:choose>
13490
13641
  </xsl:when>
13491
13642
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13492
13643
  <xsl:value-of select="$level_total - 1"/>
@@ -13494,6 +13645,17 @@
13494
13645
  <xsl:when test="parent::*[local-name() = 'annex']">
13495
13646
  <xsl:value-of select="$level_total - 1"/>
13496
13647
  </xsl:when>
13648
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
13649
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13650
+ <xsl:choose>
13651
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13652
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13653
+ </xsl:when>
13654
+ <xsl:otherwise>
13655
+ <xsl:value-of select="$level_total - 1"/>
13656
+ </xsl:otherwise>
13657
+ </xsl:choose>
13658
+ </xsl:when>
13497
13659
  <xsl:when test="ancestor::*[local-name() = 'annex']">
13498
13660
  <xsl:value-of select="$level_total"/>
13499
13661
  </xsl:when>
@@ -13850,6 +14012,20 @@
13850
14012
 
13851
14013
  <!-- END: insert cover page image -->
13852
14014
 
14015
+ <xsl:template name="insertVerticalChar">
14016
+ <xsl:param name="str"/>
14017
+ <xsl:if test="string-length($str) &gt; 0">
14018
+ <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">
14019
+ <fo:block-container width="1em">
14020
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14021
+ </fo:block-container>
14022
+ </fo:inline-container>
14023
+ <xsl:call-template name="insertVerticalChar">
14024
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14025
+ </xsl:call-template>
14026
+ </xsl:if>
14027
+ </xsl:template>
14028
+
13853
14029
  <xsl:template name="number-to-words">
13854
14030
  <xsl:param name="number"/>
13855
14031
  <xsl:param name="first"/>
@@ -14137,4 +14313,18 @@
14137
14313
  </xsl:if>
14138
14314
  </xsl:template>
14139
14315
 
14316
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14317
+ <xsl:copy>
14318
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14319
+ </xsl:copy>
14320
+ </xsl:template>
14321
+
14322
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14323
+ <xsl:copy>
14324
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14325
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14326
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14327
+ </xsl:copy>
14328
+ </xsl:template>
14329
+
14140
14330
  </xsl:stylesheet>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.3.4".freeze
3
+ VERSION = "0.3.5".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar