metanorma-jis 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,6 +88,22 @@
88
88
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
89
89
  </fo:simple-page-master>
90
90
 
91
+ <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"/>
93
+ <fo:region-before region-name="header-odd-first" extent="{$marginTop}mm"/>
94
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
95
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
96
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
97
+ </fo:simple-page-master>
98
+
99
+ <fo:page-sequence-master master-name="document_toc">
100
+ <fo:repeatable-page-master-alternatives>
101
+ <fo:conditional-page-master-reference page-position="first" master-reference="first_page_toc"/>
102
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
103
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
104
+ </fo:repeatable-page-master-alternatives>
105
+ </fo:page-sequence-master>
106
+
91
107
  <fo:page-sequence-master master-name="document_preface">
92
108
  <fo:repeatable-page-master-alternatives>
93
109
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
@@ -113,14 +129,14 @@
113
129
  <!-- landscape -->
114
130
  <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
115
131
  <fo:region-body margin-top="{$marginLeftRight1}mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"/>
116
- <fo:region-before region-name="header" extent="{$marginLeftRight1}mm" precedence="true"/>
132
+ <fo:region-before region-name="header-odd" extent="{$marginLeftRight1}mm" precedence="true"/>
117
133
  <fo:region-after region-name="footer" extent="{$marginLeftRight2}mm" precedence="true"/>
118
134
  <fo:region-start region-name="left-region-landscape" extent="{$marginBottom}mm"/>
119
135
  <fo:region-end region-name="right-region-landscape" extent="{$marginTop}mm"/>
120
136
  </fo:simple-page-master>
121
137
  <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
122
138
  <fo:region-body margin-top="{$marginLeftRight2}mm" margin-bottom="{$marginLeftRight1}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"/>
123
- <fo:region-before region-name="header" extent="{$marginLeftRight2}mm" precedence="true"/>
139
+ <fo:region-before region-name="header-even" extent="{$marginLeftRight2}mm" precedence="true"/>
124
140
  <fo:region-after region-name="footer" extent="{$marginLeftRight1}mm" precedence="true"/>
125
141
  <fo:region-start region-name="left-region-landscape" extent="{$marginBottom}mm"/>
126
142
  <fo:region-end region-name="right-region-landspace" extent="{$marginTop}mm"/>
@@ -166,13 +182,27 @@
166
182
 
167
183
  <xsl:variable name="year_published" select="substring(/*/jis:bibdata/jis:date[@type = 'published']/jis:on, 1, 4)"/>
168
184
 
185
+ <xsl:variable name="element_name_colon_gothic">colon_gothic</xsl:variable>
186
+ <xsl:variable name="tag_colon_gothic_open">###<xsl:value-of select="$element_name_colon_gothic"/>###</xsl:variable>
187
+ <xsl:variable name="tag_colon_gothic_close">###/<xsl:value-of select="$element_name_colon_gothic"/>###</xsl:variable>
188
+
189
+ <xsl:variable name="docidentifier_" select="java:replaceAll(java:java.lang.String.new(/*/jis:bibdata/jis:docidentifier), '(:)', concat($tag_colon_gothic_open,'$1',$tag_colon_gothic_close))"/>
190
+
191
+ <xsl:variable name="docidentifier__"><text><xsl:call-template name="replace_text_tags">
192
+ <xsl:with-param name="tag_open" select="$tag_colon_gothic_open"/>
193
+ <xsl:with-param name="tag_close" select="$tag_colon_gothic_close"/>
194
+ <xsl:with-param name="text" select="$docidentifier_"/>
195
+ </xsl:call-template></text></xsl:variable>
196
+
169
197
  <xsl:variable name="docidentifier">
170
- <fo:inline><xsl:value-of select="$docnumber"/></fo:inline>
171
- <fo:inline font-family="IPAexGothic">:</fo:inline>
172
- <fo:inline><xsl:value-of select="$year_published"/></fo:inline>
198
+ <xsl:apply-templates select="xalan:nodeset($docidentifier__)/node()"/>
173
199
  </xsl:variable>
174
200
 
175
- <xsl:variable name="copyrightText">著作権法により無断での複製,転載等は禁止されております。</xsl:variable>
201
+ <xsl:variable name="copyrightText">
202
+ <xsl:call-template name="getLocalizedString">
203
+ <xsl:with-param name="key">permission_footer</xsl:with-param>
204
+ </xsl:call-template>
205
+ </xsl:variable>
176
206
 
177
207
  <xsl:variable name="doctype" select="/*/jis:bibdata/jis:ext/jis:doctype"/>
178
208
 
@@ -193,12 +223,20 @@
193
223
  <!-- Contents and preface pages -->
194
224
  <!-- ========================== -->
195
225
 
196
- <fo:page-sequence master-reference="document_preface" initial-page-number="1" force-page-count="no-force">
226
+ <fo:page-sequence master-reference="document_toc" initial-page-number="1" force-page-count="no-force">
197
227
 
198
228
  <xsl:call-template name="insertHeaderFooter">
199
229
  <xsl:with-param name="docidentifier" select="$docidentifier"/>
200
230
  <xsl:with-param name="copyrightText" select="$copyrightText"/>
201
231
  <xsl:with-param name="section">preface</xsl:with-param>
232
+ <xsl:with-param name="section_title">
233
+ <fo:inline font-family="IPAexGothic">
234
+ <xsl:text> </xsl:text>
235
+ <xsl:call-template name="getLocalizedString">
236
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
237
+ </xsl:call-template>
238
+ </fo:inline>
239
+ </xsl:with-param>
202
240
  </xsl:call-template>
203
241
 
204
242
  <fo:flow flow-name="xsl-region-body">
@@ -210,65 +248,9 @@
210
248
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
211
249
  </xsl:if>
212
250
 
213
- <fo:block text-align="center" font-size="14pt" font-family="IPAexGothic" margin-top="8.5mm">
214
- <!-- Contents -->
215
- <!-- <xsl:call-template name="getLocalizedString">
216
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
217
- </xsl:call-template> -->
218
- <xsl:text>目 次</xsl:text>
219
- </fo:block>
220
-
221
- <fo:block text-align="right" font-size="8pt" font-family="IPAexMincho" margin-top="10mm">
222
- <!-- Page -->
223
- <!-- <xsl:call-template name="getLocalizedString">
224
- <xsl:with-param name="key">locality.page</xsl:with-param>
225
- </xsl:call-template> -->
226
- <xsl:text>ページ</xsl:text>
227
- </fo:block>
228
-
229
- <fo:block role="TOC" font-family="IPAexGothic">
230
- <xsl:if test="$contents/doc[@num = $num]//item[@display = 'true']">
231
- <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true'][@level &lt;= $toc_level or @type='figure' or @type = 'table']">
232
- <fo:block role="TOCI">
233
- <xsl:choose>
234
- <xsl:when test="@type = 'bibliography'">
235
- </xsl:when>
236
- <xsl:when test="@type = 'annex'">
237
- <fo:block space-after="5pt">
238
- <xsl:call-template name="insertTocItem"/>
239
- </fo:block>
240
- </xsl:when>
241
- <xsl:otherwise>
242
- <fo:list-block space-after="5pt">
243
- <xsl:attribute name="provisional-distance-between-starts">
244
- <xsl:choose>
245
- <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
246
- <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
247
- <xsl:when test="@type = 'annex'">16mm</xsl:when>
248
- <xsl:otherwise>5mm</xsl:otherwise>
249
- </xsl:choose>
250
- </xsl:attribute>
251
- <fo:list-item>
252
- <fo:list-item-label end-indent="label-end()">
253
- <fo:block>
254
- <xsl:if test="@section != '' and @type != 'annex'">
255
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
256
- <xsl:attribute name="font-weight">bold</xsl:attribute>
257
- </xsl:if>
258
- <xsl:value-of select="@section"/>
259
- </fo:block>
260
- </fo:list-item-label>
261
- <fo:list-item-body start-indent="body-start()">
262
- <xsl:call-template name="insertTocItem"/>
263
- </fo:list-item-body>
264
- </fo:list-item>
265
- </fo:list-block>
266
- </xsl:otherwise>
267
- </xsl:choose>
268
- </fo:block>
269
- </xsl:for-each>
270
- </xsl:if>
271
- </fo:block>
251
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']">
252
+ <xsl:with-param name="num" select="$num"/>
253
+ </xsl:apply-templates>
272
254
 
273
255
  </fo:flow>
274
256
 
@@ -290,7 +272,7 @@
290
272
  <xsl:variable name="paged_xml_preface" select="xalan:nodeset($paged_xml_preface_)"/>
291
273
 
292
274
  <xsl:if test="$paged_xml_preface/*[local-name()='page'] and count($paged_xml_preface/*[local-name()='page']/*) != 0">
293
- <!-- BSI Preface pages -->
275
+ <!-- Preface pages -->
294
276
  <fo:page-sequence master-reference="document_preface" force-page-count="no-force">
295
277
 
296
278
  <fo:static-content flow-name="xsl-footnote-separator">
@@ -316,7 +298,7 @@
316
298
  </xsl:for-each>
317
299
  </fo:block>
318
300
  </fo:flow>
319
- </fo:page-sequence> <!-- END BSI Preface pages -->
301
+ </fo:page-sequence> <!-- END Preface pages -->
320
302
  </xsl:if>
321
303
 
322
304
  <!-- Document type rendering -->
@@ -331,7 +313,9 @@
331
313
  <fo:block-container margin-left="70mm">
332
314
  <fo:block-container margin-left="0mm" margin-top="30mm" width="26.5mm" height="8.5mm" text-align="center" display-align="center" border="1pt solid black">
333
315
  <fo:block>
334
- <xsl:text>白 紙</xsl:text>
316
+ <xsl:call-template name="getLocalizedString">
317
+ <xsl:with-param name="key">white-paper</xsl:with-param>
318
+ </xsl:call-template>
335
319
  </fo:block>
336
320
  </fo:block-container>
337
321
  </fo:block-container>
@@ -483,6 +467,84 @@
483
467
  </fo:root>
484
468
  </xsl:template>
485
469
 
470
+ <xsl:template match="*[local-name() = 'references'][not(@hidden = 'true')]" mode="linear_xml" priority="2">
471
+ <xsl:copy>
472
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
473
+ </xsl:copy>
474
+ </xsl:template>
475
+
476
+ <xsl:template match="*[local-name() = 'colon_gothic']">
477
+ <!-- replace : to : (Fullwidth colon) and render it in the font IPAexGothic -->
478
+ <fo:inline font-family="IPAexGothic">:</fo:inline>
479
+ </xsl:template>
480
+
481
+ <xsl:template match="*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']" priority="4">
482
+ <xsl:param name="num"/>
483
+ <xsl:apply-templates/>
484
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
485
+ <!-- fill ToC -->
486
+ <fo:block role="TOC" font-family="IPAexGothic">
487
+ <xsl:if test="$contents/doc[@num = $num]//item[@display = 'true']">
488
+ <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true'][@level &lt;= $toc_level or @type='figure' or @type = 'table']">
489
+ <fo:block role="TOCI">
490
+ <xsl:choose>
491
+ <xsl:when test="@type = 'bibliography'">
492
+ </xsl:when>
493
+ <xsl:when test="@type = 'annex'">
494
+ <fo:block space-after="5pt">
495
+ <xsl:call-template name="insertTocItem"/>
496
+ </fo:block>
497
+ </xsl:when>
498
+ <xsl:otherwise>
499
+ <fo:list-block space-after="5pt">
500
+ <xsl:attribute name="provisional-distance-between-starts">
501
+ <xsl:choose>
502
+ <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
503
+ <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
504
+ <xsl:when test="@type = 'annex'">16mm</xsl:when>
505
+ <xsl:otherwise>5mm</xsl:otherwise>
506
+ </xsl:choose>
507
+ </xsl:attribute>
508
+ <fo:list-item>
509
+ <fo:list-item-label end-indent="label-end()">
510
+ <fo:block>
511
+ <xsl:if test="@section != '' and @type != 'annex'">
512
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
513
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
514
+ </xsl:if>
515
+ <xsl:value-of select="@section"/>
516
+ </fo:block>
517
+ </fo:list-item-label>
518
+ <fo:list-item-body start-indent="body-start()">
519
+ <xsl:call-template name="insertTocItem"/>
520
+ </fo:list-item-body>
521
+ </fo:list-item>
522
+ </fo:list-block>
523
+ </xsl:otherwise>
524
+ </xsl:choose>
525
+ </fo:block>
526
+ </xsl:for-each>
527
+ </xsl:if>
528
+ </fo:block>
529
+ </xsl:if>
530
+ </xsl:template>
531
+
532
+ <xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" priority="3">
533
+ <fo:block text-align="center" font-size="14pt" font-family="IPAexGothic" margin-top="8.5mm">
534
+ <!-- Contents -->
535
+ <!-- <xsl:call-template name="getLocalizedString">
536
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
537
+ </xsl:call-template> -->
538
+ <xsl:apply-templates/>
539
+ </fo:block>
540
+ <fo:block text-align="right" font-size="8pt" font-family="IPAexMincho" margin-top="10mm">
541
+ <!-- Page -->
542
+ <xsl:call-template name="getLocalizedString">
543
+ <xsl:with-param name="key">locality.page</xsl:with-param>
544
+ </xsl:call-template>
545
+ </fo:block>
546
+ </xsl:template>
547
+
486
548
  <xsl:template name="insertTocItem">
487
549
  <fo:block text-align-last="justify" role="TOCI">
488
550
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
@@ -517,7 +579,15 @@
517
579
  <!-- title -->
518
580
  <fo:block role="H1" font-family="IPAexGothic" font-size="22pt" margin-top="27mm"><xsl:apply-templates select="/*/jis:bibdata/jis:title[@language = 'ja' and @type = 'main']/node()"/></fo:block>
519
581
  <!-- docidentifier, 3 part: number, colon and year-->
520
- <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm"><fo:inline font-family="Arial">JIS Z 8301</fo:inline><fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline><fo:inline font-family="Times New Roman" font-size="10pt">2019</fo:inline></fo:inline></fo:block>
582
+ <xsl:variable name="docidentifier" select="/*/jis:bibdata/jis:docidentifier[@type = 'JIS']"/>
583
+ <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier), '^(.*)(:)(.*)$', '$1')"/>
584
+ <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier), '^(.*)(:)(.*)$', '$3')"/>
585
+
586
+ <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm">
587
+ <fo:inline font-family="Arial">JIS <xsl:value-of select="$docidentifier_number"/></fo:inline>
588
+ <fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline>
589
+ <fo:inline font-family="Times New Roman" font-size="10pt"><xsl:value-of select="$docidentifier_year"/></fo:inline></fo:inline>
590
+ </fo:block>
521
591
  <fo:block font-family="Arial" font-size="14pt" margin-top="12mm"><fo:inline font-family="IPAexMincho">(</fo:inline>JSA<fo:inline font-family="IPAexMincho">)</fo:inline></fo:block>
522
592
  </fo:block-container>
523
593
 
@@ -877,7 +947,7 @@
877
947
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
878
948
  </xsl:if>
879
949
 
880
- <xsl:if test="parent::jis:li or following-sibling::*[1][self::jis:ol or self::jis:ul or self::jis:note or self::jis:example]">
950
+ <xsl:if test="parent::jis:li or following-sibling::*[1][self::jis:ol or self::jis:ul or self::jis:note or self::jis:example] or parent::jis:quote">
881
951
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
882
952
  </xsl:if>
883
953
 
@@ -925,6 +995,109 @@
925
995
  </fo:block>
926
996
  </xsl:template>
927
997
 
998
+ <xsl:template match="*[local-name()='li']" priority="2">
999
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
1000
+ <xsl:copy-of select="@id"/>
1001
+
1002
+ <xsl:call-template name="refine_list-item-style"/>
1003
+
1004
+ <fo:list-item-label end-indent="label-end()">
1005
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
1006
+
1007
+ <xsl:call-template name="refine_list-item-label-style"/>
1008
+
1009
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
1010
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
1011
+ <xsl:call-template name="append_add-style"/>
1012
+ </xsl:if>
1013
+
1014
+ <xsl:variable name="list_item_label">
1015
+ <xsl:call-template name="getListItemFormat"/>
1016
+ </xsl:variable>
1017
+ <xsl:choose>
1018
+ <xsl:when test="contains($list_item_label, ')')">
1019
+ <xsl:value-of select="substring-before($list_item_label,')')"/>
1020
+ <fo:inline font-weight="normal">)</fo:inline>
1021
+ <xsl:value-of select="substring-after($list_item_label,')')"/>
1022
+ </xsl:when>
1023
+ <xsl:otherwise>
1024
+ <xsl:value-of select="$list_item_label"/>
1025
+ </xsl:otherwise>
1026
+ </xsl:choose>
1027
+
1028
+ </fo:block>
1029
+ </fo:list-item-label>
1030
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
1031
+ <fo:block>
1032
+
1033
+ <xsl:call-template name="refine_list-item-body-style"/>
1034
+
1035
+ <xsl:apply-templates mode="list_jis"/>
1036
+
1037
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
1038
+
1039
+ <xsl:for-each select="./bsi:note">
1040
+ <xsl:call-template name="note"/>
1041
+ </xsl:for-each> -->
1042
+ </fo:block>
1043
+ </fo:list-item-body>
1044
+ </fo:list-item>
1045
+ </xsl:template>
1046
+
1047
+ <xsl:template match="node()" priority="2" mode="list_jis">
1048
+ <xsl:apply-templates select="."/>
1049
+ </xsl:template>
1050
+
1051
+ <!-- display footnote after last element in li, except ol or ul -->
1052
+ <xsl:template match="*[local-name()='li']/*[not(local-name() = 'ul') and not(local-name() = 'ol')][last()]" priority="3" mode="list_jis">
1053
+ <xsl:apply-templates select="."/>
1054
+
1055
+ <xsl:variable name="list_id" select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]/@id"/>
1056
+ <!-- render footnotes after current list-item, if there aren't footnotes anymore in the list -->
1057
+ <!-- i.e. i.e. if list-item is latest with footnote -->
1058
+ <xsl:if test="ancestor::*[local-name() = 'li'][1]//jis:fn[ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1][@id = $list_id]] and not(ancestor::*[local-name() = 'li'][1]/following-sibling::*[local-name() = 'li'][.//jis:fn[ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1][@id = $list_id]]])">
1059
+ <xsl:apply-templates select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]//jis:fn[ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1][@id = $list_id]][generate-id(.)=generate-id(key('kfn',@reference)[1])]" mode="fn_after_element">
1060
+ <xsl:with-param name="ancestor">li</xsl:with-param>
1061
+ </xsl:apply-templates>
1062
+ </xsl:if>
1063
+ </xsl:template>
1064
+
1065
+ <xsl:template match="jis:fn" mode="fn_after_element">
1066
+ <xsl:param name="ancestor">li</xsl:param>
1067
+
1068
+ <xsl:variable name="ancestor_tree_">
1069
+ <xsl:for-each select="ancestor::*[local-name() != 'p' and local-name() != 'bibitem' and local-name() != 'biblio-tag']">
1070
+ <item><xsl:value-of select="local-name()"/></item>
1071
+ </xsl:for-each>
1072
+ </xsl:variable>
1073
+ <xsl:variable name="ancestor_tree" select="xalan:nodeset($ancestor_tree_)"/>
1074
+ <!-- <debug><xsl:copy-of select="$ancestor_tree"/></debug>
1075
+ <debug><ancestor><xsl:value-of select="$ancestor"/></ancestor></debug> -->
1076
+
1077
+ <xsl:if test="$ancestor_tree//item[last()][. = $ancestor]">
1078
+ <fo:block-container margin-left="11mm" margin-bottom="4pt" id="{@ref_id}">
1079
+
1080
+ <xsl:if test="position() = last()">
1081
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
1082
+ </xsl:if>
1083
+ <fo:block-container margin-left="0mm">
1084
+ <fo:list-block provisional-distance-between-starts="10mm">
1085
+ <fo:list-item>
1086
+ <fo:list-item-label end-indent="label-end()">
1087
+ <fo:block xsl:use-attribute-sets="note-name-style">注 <fo:inline xsl:use-attribute-sets="fn-num-style"><xsl:value-of select="@current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></fo:inline></fo:block>
1088
+ </fo:list-item-label>
1089
+ <fo:list-item-body start-indent="body-start()">
1090
+ <fo:block>
1091
+ <xsl:apply-templates/>
1092
+ </fo:block>
1093
+ </fo:list-item-body>
1094
+ </fo:list-item>
1095
+ </fo:list-block>
1096
+ </fo:block-container>
1097
+ </fo:block-container>
1098
+ </xsl:if>
1099
+ </xsl:template>
1100
+
928
1101
  <xsl:template name="makePagedXML">
929
1102
  <xsl:param name="structured_xml"/>
930
1103
  <xsl:choose>
@@ -988,7 +1161,7 @@
988
1161
  <!-- jis:term/jis:preferred2//text() | -->
989
1162
 
990
1163
  <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
991
- <xsl:template match="jis:title/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:example/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
1164
+ <xsl:template match="jis:title/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
992
1165
  <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
993
1166
  <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
994
1167
  <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
@@ -998,6 +1171,44 @@
998
1171
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
999
1172
  </xsl:template>
1000
1173
 
1174
+ <!-- for $contents -->
1175
+ <xsl:template match="title/text()">
1176
+ <xsl:variable name="regex_en_contents">([^\u3000-\u9FFF\uF900-\uFFFF\(\)]{1,})</xsl:variable>
1177
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en_contents, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
1178
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1179
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1180
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1181
+ <xsl:with-param name="text" select="$text_en_"/>
1182
+ </xsl:call-template></text></xsl:variable>
1183
+ <xsl:apply-templates select="xalan:nodeset($text_en)/text/node()"/>
1184
+ </xsl:template>
1185
+
1186
+ <!-- move example title to the first paragraph -->
1187
+ <xsl:template match="jis:example[contains(jis:name/text(), ' — ')]" mode="update_xml_step1">
1188
+ <xsl:copy>
1189
+ <xsl:copy-of select="@*"/>
1190
+ <xsl:element name="p" namespace="https://www.metanorma.org/ns/jis">
1191
+ <xsl:value-of select="substring-after(jis:name/text(), ' — ')"/>
1192
+ </xsl:element>
1193
+ <xsl:apply-templates mode="update_xml_step1"/>
1194
+ </xsl:copy>
1195
+ </xsl:template>
1196
+ <xsl:template match="jis:example/jis:name/text()" mode="update_xml_step1">
1197
+ <xsl:variable name="example_name">
1198
+ <xsl:choose>
1199
+ <xsl:when test="contains(., ' — ')"><xsl:value-of select="substring-before(., ' — ')"/></xsl:when>
1200
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1201
+ </xsl:choose>
1202
+ </xsl:variable>
1203
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new($example_name), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
1204
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1205
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1206
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1207
+ <xsl:with-param name="text" select="$text_en_"/>
1208
+ </xsl:call-template></text></xsl:variable>
1209
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1210
+ </xsl:template>
1211
+
1001
1212
  <xsl:template match="jis:eref//text()" mode="update_xml_step1">
1002
1213
  <!-- Example: JIS Z 8301:2011 to <font_en_bold>JIS Z 8301</font_en_bold><font_en>:2011</font_en> -->
1003
1214
  <xsl:variable name="parts">
@@ -1037,22 +1248,26 @@
1037
1248
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1038
1249
  </xsl:template>
1039
1250
 
1040
- <xsl:template match="*[local-name() = 'font_en_bold']">
1251
+ <xsl:template match="*[local-name() = 'font_en_bold'][normalize-space() != '']">
1252
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1041
1253
  <fo:inline font-family="Times New Roman" font-weight="bold">
1042
1254
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
1043
1255
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1044
1256
  </xsl:if>
1045
1257
  <xsl:apply-templates/>
1046
1258
  </fo:inline>
1259
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1047
1260
  </xsl:template>
1048
1261
 
1049
- <xsl:template match="*[local-name() = 'font_en']">
1262
+ <xsl:template match="*[local-name() = 'font_en'][normalize-space() != '']">
1263
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1050
1264
  <fo:inline font-family="Times New Roman">
1051
1265
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
1052
1266
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1053
1267
  </xsl:if>
1054
1268
  <xsl:apply-templates/>
1055
1269
  </fo:inline>
1270
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1056
1271
  </xsl:template>
1057
1272
 
1058
1273
  <!-- ========================= -->
@@ -1064,16 +1279,31 @@
1064
1279
  <xsl:param name="hidePageNumber">false</xsl:param>
1065
1280
  <xsl:param name="section"/>
1066
1281
  <xsl:param name="copyrightText"/>
1282
+ <xsl:param name="section_title"/>
1283
+ <fo:static-content flow-name="header-odd-first" role="artifact">
1284
+ <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1285
+ <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1286
+ <fo:block>
1287
+ <xsl:copy-of select="$docidentifier"/>
1288
+ </fo:block>
1289
+ </fo:block-container>
1290
+ </fo:static-content>
1067
1291
  <fo:static-content flow-name="header-odd" role="artifact">
1068
1292
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1069
1293
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1070
- <fo:block><xsl:copy-of select="$docidentifier"/></fo:block>
1294
+ <fo:block>
1295
+ <xsl:copy-of select="$docidentifier"/>
1296
+ <xsl:copy-of select="$section_title"/>
1297
+ </fo:block>
1071
1298
  </fo:block-container>
1072
1299
  </fo:static-content>
1073
1300
  <fo:static-content flow-name="header-even" role="artifact">
1074
1301
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after">
1075
1302
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1076
- <fo:block><xsl:copy-of select="$docidentifier"/></fo:block>
1303
+ <fo:block>
1304
+ <xsl:copy-of select="$docidentifier"/>
1305
+ <xsl:copy-of select="$section_title"/>
1306
+ </fo:block>
1077
1307
  </fo:block-container>
1078
1308
  </fo:static-content>
1079
1309
  <xsl:call-template name="insertFooter">
@@ -1506,6 +1736,10 @@
1506
1736
 
1507
1737
  </xsl:attribute-set>
1508
1738
 
1739
+ <xsl:template name="refine_link-style">
1740
+
1741
+ </xsl:template> <!-- refine_link-style -->
1742
+
1509
1743
  <xsl:attribute-set name="sourcecode-container-style">
1510
1744
 
1511
1745
  </xsl:attribute-set>
@@ -1517,6 +1751,10 @@
1517
1751
 
1518
1752
  </xsl:attribute-set>
1519
1753
 
1754
+ <xsl:template name="refine_sourcecode-style">
1755
+
1756
+ </xsl:template> <!-- refine_sourcecode-style -->
1757
+
1520
1758
  <xsl:attribute-set name="pre-style">
1521
1759
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1522
1760
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1598,6 +1836,10 @@
1598
1836
 
1599
1837
  </xsl:attribute-set> <!-- example-style -->
1600
1838
 
1839
+ <xsl:template name="refine_example-style">
1840
+
1841
+ </xsl:template> <!-- refine_example-style -->
1842
+
1601
1843
  <xsl:attribute-set name="example-body-style">
1602
1844
 
1603
1845
  </xsl:attribute-set> <!-- example-body-style -->
@@ -1614,6 +1856,10 @@
1614
1856
 
1615
1857
  </xsl:attribute-set> <!-- example-p-style -->
1616
1858
 
1859
+ <xsl:template name="refine_example-p-style">
1860
+
1861
+ </xsl:template> <!-- refine_example-p-style -->
1862
+
1617
1863
  <xsl:attribute-set name="termexample-name-style">
1618
1864
 
1619
1865
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
@@ -1642,6 +1888,12 @@
1642
1888
 
1643
1889
  </xsl:attribute-set> <!-- table-container-style -->
1644
1890
 
1891
+ <xsl:template name="refine_table-container-style">
1892
+ <xsl:param name="margin-side"/>
1893
+
1894
+ <!-- end table block-container attributes -->
1895
+ </xsl:template> <!-- refine_table-container-style -->
1896
+
1645
1897
  <xsl:attribute-set name="table-style">
1646
1898
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1647
1899
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -1650,6 +1902,17 @@
1650
1902
 
1651
1903
  </xsl:attribute-set><!-- table-style -->
1652
1904
 
1905
+ <xsl:template name="refine_table-style">
1906
+ <xsl:param name="margin-side"/>
1907
+
1908
+ <xsl:call-template name="setBordersTableArray"/>
1909
+
1910
+ <xsl:if test="ancestor::*[local-name()='preface']">
1911
+ <xsl:attribute name="border">none</xsl:attribute>
1912
+ </xsl:if>
1913
+
1914
+ </xsl:template> <!-- refine_table-style -->
1915
+
1653
1916
  <xsl:attribute-set name="table-name-style">
1654
1917
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1655
1918
 
@@ -1659,6 +1922,11 @@
1659
1922
 
1660
1923
  </xsl:attribute-set> <!-- table-name-style -->
1661
1924
 
1925
+ <xsl:template name="refine_table-name-style">
1926
+ <xsl:param name="continued"/>
1927
+
1928
+ </xsl:template> <!-- refine_table-name-style -->
1929
+
1662
1930
  <xsl:attribute-set name="table-row-style">
1663
1931
  <xsl:attribute name="min-height">4mm</xsl:attribute>
1664
1932
 
@@ -1672,6 +1940,17 @@
1672
1940
 
1673
1941
  </xsl:attribute-set>
1674
1942
 
1943
+ <xsl:template name="refine_table-header-row-style">
1944
+
1945
+ <xsl:call-template name="setBordersTableArray"/>
1946
+
1947
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
1948
+ <xsl:attribute name="border-top">none</xsl:attribute>
1949
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
1950
+ </xsl:if>
1951
+
1952
+ </xsl:template> <!-- refine_table-header-row-style -->
1953
+
1675
1954
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
1676
1955
 
1677
1956
  <xsl:attribute name="border-left"><xsl:value-of select="$table-border"/></xsl:attribute>
@@ -1679,10 +1958,20 @@
1679
1958
 
1680
1959
  </xsl:attribute-set>
1681
1960
 
1961
+ <xsl:template name="refine_table-footer-row-style">
1962
+
1963
+ </xsl:template> <!-- refine_table-footer-row-style -->
1964
+
1682
1965
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
1683
1966
 
1684
1967
  </xsl:attribute-set>
1685
1968
 
1969
+ <xsl:template name="refine_table-body-row-style">
1970
+
1971
+ <xsl:call-template name="setBordersTableArray"/>
1972
+
1973
+ </xsl:template> <!-- refine_table-body-row-style -->
1974
+
1686
1975
  <xsl:attribute-set name="table-header-cell-style">
1687
1976
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1688
1977
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1696,6 +1985,24 @@
1696
1985
 
1697
1986
  </xsl:attribute-set> <!-- table-header-cell-style -->
1698
1987
 
1988
+ <xsl:template name="refine_table-header-cell-style">
1989
+
1990
+ <xsl:attribute name="text-align">center</xsl:attribute>
1991
+
1992
+ <xsl:call-template name="setBordersTableArray"/>
1993
+
1994
+ <xsl:if test="ancestor::*[local-name()='preface']">
1995
+ <xsl:attribute name="border">none</xsl:attribute>
1996
+ </xsl:if>
1997
+
1998
+ <xsl:if test="$lang = 'ar'">
1999
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2000
+ </xsl:if>
2001
+
2002
+ <xsl:call-template name="setTableCellAttributes"/>
2003
+
2004
+ </xsl:template> <!-- refine_table-header-cell-style -->
2005
+
1699
2006
  <xsl:attribute-set name="table-cell-style">
1700
2007
  <xsl:attribute name="display-align">center</xsl:attribute>
1701
2008
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1706,6 +2013,22 @@
1706
2013
 
1707
2014
  </xsl:attribute-set> <!-- table-cell-style -->
1708
2015
 
2016
+ <xsl:template name="refine_table-cell-style">
2017
+
2018
+ <xsl:if test="$lang = 'ar'">
2019
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2020
+ </xsl:if>
2021
+
2022
+ <!-- bsi -->
2023
+
2024
+ <xsl:call-template name="setBordersTableArray"/>
2025
+
2026
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
2027
+ <xsl:attribute name="border">none</xsl:attribute>
2028
+ </xsl:if>
2029
+
2030
+ </xsl:template> <!-- refine_table-cell-style -->
2031
+
1709
2032
  <xsl:attribute-set name="table-footer-cell-style">
1710
2033
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1711
2034
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1717,12 +2040,20 @@
1717
2040
 
1718
2041
  </xsl:attribute-set> <!-- table-footer-cell-style -->
1719
2042
 
2043
+ <xsl:template name="refine_table-footer-cell-style">
2044
+
2045
+ </xsl:template> <!-- refine_table-footer-cell-style -->
2046
+
1720
2047
  <xsl:attribute-set name="table-note-style">
1721
2048
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1722
2049
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1723
2050
 
1724
2051
  </xsl:attribute-set><!-- table-note-style -->
1725
2052
 
2053
+ <xsl:template name="refine_table-note-style">
2054
+
2055
+ </xsl:template> <!-- refine_table-note-style -->
2056
+
1726
2057
  <xsl:attribute-set name="table-fn-style">
1727
2058
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1728
2059
 
@@ -1785,11 +2116,21 @@
1785
2116
 
1786
2117
  </xsl:attribute-set>
1787
2118
 
2119
+ <xsl:template name="refine_dt-cell-style">
2120
+
2121
+ </xsl:template> <!-- refine_dt-cell-style -->
2122
+
1788
2123
  <xsl:attribute-set name="dt-block-style">
1789
2124
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1790
2125
 
2126
+ <xsl:attribute name="line-height">1.5</xsl:attribute>
2127
+
1791
2128
  </xsl:attribute-set>
1792
2129
 
2130
+ <xsl:template name="refine_dt-block-style">
2131
+
2132
+ </xsl:template> <!-- refine_dt-block-style -->
2133
+
1793
2134
  <xsl:attribute-set name="dl-name-style">
1794
2135
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1795
2136
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1801,6 +2142,10 @@
1801
2142
 
1802
2143
  </xsl:attribute-set>
1803
2144
 
2145
+ <xsl:template name="refine_dd-cell-style">
2146
+
2147
+ </xsl:template> <!-- refine_dd-cell-style -->
2148
+
1804
2149
  <!-- ========================== -->
1805
2150
  <!-- END Definition's list styles -->
1806
2151
  <!-- ========================== -->
@@ -1815,12 +2160,20 @@
1815
2160
 
1816
2161
  <xsl:attribute-set name="xref-style">
1817
2162
 
2163
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
2164
+
1818
2165
  </xsl:attribute-set>
1819
2166
 
1820
2167
  <xsl:attribute-set name="eref-style">
1821
2168
 
1822
2169
  </xsl:attribute-set>
1823
2170
 
2171
+ <xsl:template name="refine_eref-style">
2172
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
2173
+ <xsl:variable name="text" select="normalize-space()"/>
2174
+
2175
+ </xsl:template> <!-- refine_eref-style -->
2176
+
1824
2177
  <xsl:attribute-set name="note-style">
1825
2178
 
1826
2179
  <xsl:attribute name="text-indent">0mm</xsl:attribute>
@@ -1828,6 +2181,10 @@
1828
2181
 
1829
2182
  </xsl:attribute-set>
1830
2183
 
2184
+ <xsl:template name="refine_note-style">
2185
+
2186
+ </xsl:template>
2187
+
1831
2188
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1832
2189
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1833
2190
 
@@ -1837,11 +2194,19 @@
1837
2194
 
1838
2195
  </xsl:attribute-set>
1839
2196
 
2197
+ <xsl:template name="refine_note-name-style">
2198
+
2199
+ </xsl:template> <!-- refine_note-name-style -->
2200
+
1840
2201
  <xsl:attribute-set name="table-note-name-style">
1841
2202
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1842
2203
 
1843
2204
  </xsl:attribute-set>
1844
2205
 
2206
+ <xsl:template name="refine_table-note-name-style">
2207
+
2208
+ </xsl:template> <!-- refine_table-note-name-style -->
2209
+
1845
2210
  <xsl:attribute-set name="note-p-style">
1846
2211
 
1847
2212
  </xsl:attribute-set>
@@ -1854,12 +2219,20 @@
1854
2219
 
1855
2220
  </xsl:attribute-set>
1856
2221
 
2222
+ <xsl:template name="refine_termnote-style">
2223
+
2224
+ </xsl:template> <!-- refine_termnote-style -->
2225
+
1857
2226
  <xsl:attribute-set name="termnote-name-style">
1858
2227
 
1859
2228
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
1860
2229
 
1861
2230
  </xsl:attribute-set>
1862
2231
 
2232
+ <xsl:template name="refine_termnote-name-style">
2233
+
2234
+ </xsl:template>
2235
+
1863
2236
  <xsl:attribute-set name="termnote-p-style">
1864
2237
 
1865
2238
  </xsl:attribute-set>
@@ -1868,8 +2241,19 @@
1868
2241
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1869
2242
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
1870
2243
 
2244
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2245
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2246
+
1871
2247
  </xsl:attribute-set>
1872
2248
 
2249
+ <xsl:template name="refine_quote-style">
2250
+
2251
+ <xsl:if test="ancestor::*[local-name() = 'li']">
2252
+ <xsl:attribute name="margin-left">7.5mm</xsl:attribute>
2253
+ </xsl:if>
2254
+
2255
+ </xsl:template>
2256
+
1873
2257
  <xsl:attribute-set name="quote-source-style">
1874
2258
  <xsl:attribute name="text-align">right</xsl:attribute>
1875
2259
 
@@ -1881,6 +2265,10 @@
1881
2265
 
1882
2266
  </xsl:attribute-set>
1883
2267
 
2268
+ <xsl:template name="refine_termsource-style">
2269
+
2270
+ </xsl:template> <!-- refine_termsource-style -->
2271
+
1884
2272
  <xsl:attribute-set name="termsource-text-style">
1885
2273
 
1886
2274
  </xsl:attribute-set>
@@ -1914,8 +2302,23 @@
1914
2302
 
1915
2303
  <xsl:attribute-set name="figure-name-style">
1916
2304
 
2305
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
2306
+ <xsl:attribute name="text-align">center</xsl:attribute>
2307
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2308
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2309
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2310
+
1917
2311
  </xsl:attribute-set>
1918
2312
 
2313
+ <xsl:template name="refine_figure-name-style">
2314
+
2315
+ <xsl:if test="ancestor::jis:figure">
2316
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2317
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2318
+ </xsl:if>
2319
+
2320
+ </xsl:template> <!-- refine_figure-name-style -->
2321
+
1919
2322
  <xsl:attribute-set name="figure-source-style">
1920
2323
 
1921
2324
  </xsl:attribute-set>
@@ -1932,6 +2335,10 @@
1932
2335
 
1933
2336
  </xsl:attribute-set> <!-- formula-stem-block-style -->
1934
2337
 
2338
+ <xsl:template name="refine_formula-stem-block-style">
2339
+
2340
+ </xsl:template> <!-- refine_formula-stem-block-style -->
2341
+
1935
2342
  <xsl:attribute-set name="formula-stem-number-style">
1936
2343
  <xsl:attribute name="text-align">right</xsl:attribute>
1937
2344
 
@@ -1943,6 +2350,10 @@
1943
2350
 
1944
2351
  </xsl:attribute-set>
1945
2352
 
2353
+ <xsl:template name="refine_image-style">
2354
+
2355
+ </xsl:template>
2356
+
1946
2357
  <xsl:attribute-set name="figure-pseudocode-p-style">
1947
2358
 
1948
2359
  </xsl:attribute-set>
@@ -2033,6 +2444,10 @@
2033
2444
 
2034
2445
  </xsl:attribute-set>
2035
2446
 
2447
+ <xsl:template name="refine_mathml-style">
2448
+
2449
+ </xsl:template>
2450
+
2036
2451
  <xsl:attribute-set name="list-style">
2037
2452
 
2038
2453
  <xsl:attribute name="provisional-distance-between-starts">7.5mm</xsl:attribute>
@@ -2040,6 +2455,10 @@
2040
2455
 
2041
2456
  </xsl:attribute-set> <!-- list-style -->
2042
2457
 
2458
+ <xsl:template name="refine_list-style">
2459
+
2460
+ </xsl:template> <!-- refine_list-style -->
2461
+
2043
2462
  <xsl:attribute-set name="list-name-style">
2044
2463
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2045
2464
 
@@ -2049,16 +2468,33 @@
2049
2468
 
2050
2469
  </xsl:attribute-set>
2051
2470
 
2471
+ <xsl:template name="refine_list-item-style">
2472
+
2473
+ </xsl:template> <!-- refine_list-item-style -->
2474
+
2052
2475
  <xsl:attribute-set name="list-item-label-style">
2053
2476
 
2054
2477
  <xsl:attribute name="line-height">1.5</xsl:attribute>
2055
2478
 
2056
2479
  </xsl:attribute-set>
2057
2480
 
2481
+ <xsl:template name="refine_list-item-label-style">
2482
+
2483
+ <xsl:if test="parent::*[local-name() = 'ol']">
2484
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2485
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2486
+ </xsl:if>
2487
+
2488
+ </xsl:template> <!-- refine_list-item-label-style -->
2489
+
2058
2490
  <xsl:attribute-set name="list-item-body-style">
2059
2491
 
2060
2492
  </xsl:attribute-set>
2061
2493
 
2494
+ <xsl:template name="refine_list-item-body-style">
2495
+
2496
+ </xsl:template> <!-- refine_list-item-body-style -->
2497
+
2062
2498
  <xsl:attribute-set name="toc-style">
2063
2499
  <xsl:attribute name="line-height">135%</xsl:attribute>
2064
2500
  </xsl:attribute-set>
@@ -2074,6 +2510,10 @@
2074
2510
 
2075
2511
  </xsl:attribute-set>
2076
2512
 
2513
+ <xsl:template name="refine_fn-reference-style">
2514
+
2515
+ </xsl:template> <!-- refine_fn-reference-style -->
2516
+
2077
2517
  <xsl:attribute-set name="fn-style">
2078
2518
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2079
2519
  </xsl:attribute-set>
@@ -2096,6 +2536,12 @@
2096
2536
 
2097
2537
  </xsl:attribute-set>
2098
2538
 
2539
+ <xsl:template name="refine_fn-body-style">
2540
+
2541
+ <xsl:attribute name="font-family">IPAexMincho</xsl:attribute> <!-- prevent font for footnote in Times New Roman main text -->
2542
+
2543
+ </xsl:template> <!-- refine_fn-body-style -->
2544
+
2099
2545
  <xsl:attribute-set name="fn-body-num-style">
2100
2546
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2101
2547
 
@@ -2106,6 +2552,10 @@
2106
2552
 
2107
2553
  </xsl:attribute-set> <!-- fn-body-num-style -->
2108
2554
 
2555
+ <xsl:template name="refine_fn-body-num-style">
2556
+
2557
+ </xsl:template> <!-- refine_fn-body-num-style -->
2558
+
2109
2559
  <!-- admonition -->
2110
2560
  <xsl:attribute-set name="admonition-style">
2111
2561
 
@@ -2173,6 +2623,11 @@
2173
2623
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2174
2624
  <xsl:attribute name="font-size">65%</xsl:attribute>
2175
2625
 
2626
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2627
+ <xsl:attribute name="font-size">67%</xsl:attribute>
2628
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2629
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2630
+
2176
2631
  </xsl:attribute-set> <!-- bibitem-note-fn-style -->
2177
2632
 
2178
2633
  <!-- footnote number on the page bottom -->
@@ -2734,7 +3189,9 @@
2734
3189
 
2735
3190
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2736
3191
 
2737
- <!-- end table block-container attributes -->
3192
+ <xsl:call-template name="refine_table-container-style">
3193
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3194
+ </xsl:call-template>
2738
3195
 
2739
3196
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2740
3197
 
@@ -2755,11 +3212,9 @@
2755
3212
 
2756
3213
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2757
3214
 
2758
- <xsl:call-template name="setBordersTableArray"/>
2759
-
2760
- <xsl:if test="ancestor::*[local-name()='preface']">
2761
- <xsl:attribute name="border">none</xsl:attribute>
2762
- </xsl:if>
3215
+ <xsl:call-template name="refine_table-style">
3216
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3217
+ </xsl:call-template>
2763
3218
 
2764
3219
  </xsl:element>
2765
3220
  </xsl:variable>
@@ -2825,7 +3280,7 @@
2825
3280
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2826
3281
  </xsl:when>
2827
3282
  <xsl:otherwise>
2828
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3283
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
2829
3284
  </xsl:otherwise>
2830
3285
  </xsl:choose>
2831
3286
 
@@ -2895,6 +3350,10 @@
2895
3350
 
2896
3351
  <fo:block xsl:use-attribute-sets="table-name-style">
2897
3352
 
3353
+ <xsl:call-template name="refine_table-name-style">
3354
+ <xsl:with-param name="continued" select="$continued"/>
3355
+ </xsl:call-template>
3356
+
2898
3357
  <xsl:choose>
2899
3358
  <xsl:when test="$continued = 'true'">
2900
3359
 
@@ -3277,6 +3736,8 @@
3277
3736
  <fo:table-row>
3278
3737
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
3279
3738
 
3739
+ <xsl:call-template name="refine_table-header-title-style"/>
3740
+
3280
3741
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3281
3742
  <xsl:with-param name="continued">true</xsl:with-param>
3282
3743
  </xsl:apply-templates>
@@ -3289,6 +3750,10 @@
3289
3750
  </fo:table-row>
3290
3751
  </xsl:template> <!-- table-header-title -->
3291
3752
 
3753
+ <xsl:template name="refine_table-header-title-style">
3754
+
3755
+ </xsl:template> <!-- refine_table-header-title-style -->
3756
+
3292
3757
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3293
3758
  <fo:table-body>
3294
3759
  <xsl:apply-templates/>
@@ -3313,7 +3778,7 @@
3313
3778
  <xsl:param name="colwidths"/>
3314
3779
  <xsl:param name="colgroup"/>
3315
3780
 
3316
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3781
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3317
3782
 
3318
3783
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3319
3784
 
@@ -3373,6 +3838,8 @@
3373
3838
  <fo:table-row>
3374
3839
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3375
3840
 
3841
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3842
+
3376
3843
  <xsl:call-template name="setBordersTableArray"/>
3377
3844
 
3378
3845
  <!-- fn will be processed inside 'note' processing -->
@@ -3381,6 +3848,7 @@
3381
3848
 
3382
3849
  <!-- except gb and bsi -->
3383
3850
 
3851
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3384
3852
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3385
3853
  <xsl:apply-templates select="../*[local-name()='note']"/>
3386
3854
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -3512,12 +3980,7 @@
3512
3980
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3513
3981
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3514
3982
 
3515
- <xsl:call-template name="setBordersTableArray"/>
3516
-
3517
- <xsl:if test="ancestor::*[local-name() = 'preface']">
3518
- <xsl:attribute name="border-top">none</xsl:attribute>
3519
- <xsl:attribute name="border-bottom">none</xsl:attribute>
3520
- </xsl:if>
3983
+ <xsl:call-template name="refine_table-header-row-style"/>
3521
3984
 
3522
3985
  <xsl:call-template name="setTableRowAttributes"/>
3523
3986
 
@@ -3551,6 +4014,8 @@
3551
4014
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3552
4015
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3553
4016
 
4017
+ <xsl:call-template name="refine_table-footer-row-style"/>
4018
+
3554
4019
  <xsl:call-template name="setTableRowAttributes"/>
3555
4020
  <xsl:apply-templates/>
3556
4021
  </fo:table-row>
@@ -3564,9 +4029,10 @@
3564
4029
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3565
4030
  </xsl:if>
3566
4031
 
3567
- <xsl:call-template name="setBordersTableArray"/>
4032
+ <xsl:call-template name="refine_table-body-row-style"/>
3568
4033
 
3569
4034
  <xsl:call-template name="setTableRowAttributes"/>
4035
+
3570
4036
  <xsl:apply-templates/>
3571
4037
  </fo:table-row>
3572
4038
  </xsl:template>
@@ -3585,19 +4051,7 @@
3585
4051
  <xsl:with-param name="default">center</xsl:with-param>
3586
4052
  </xsl:call-template>
3587
4053
 
3588
- <xsl:attribute name="text-align">center</xsl:attribute>
3589
-
3590
- <xsl:call-template name="setBordersTableArray"/>
3591
-
3592
- <xsl:if test="ancestor::*[local-name()='preface']">
3593
- <xsl:attribute name="border">none</xsl:attribute>
3594
- </xsl:if>
3595
-
3596
- <xsl:if test="$lang = 'ar'">
3597
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3598
- </xsl:if>
3599
-
3600
- <xsl:call-template name="setTableCellAttributes"/>
4054
+ <xsl:call-template name="refine_table-header-cell-style"/>
3601
4055
 
3602
4056
  <fo:block>
3603
4057
  <xsl:apply-templates/>
@@ -3634,22 +4088,12 @@
3634
4088
 
3635
4089
  <!-- cell in table body, footer -->
3636
4090
  <xsl:template match="*[local-name()='td']" name="td">
3637
- <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
3638
- <xsl:call-template name="setTextAlignment">
3639
- <xsl:with-param name="default">left</xsl:with-param>
3640
- </xsl:call-template>
3641
-
3642
- <xsl:if test="$lang = 'ar'">
3643
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3644
- </xsl:if>
3645
-
3646
- <!-- bsi -->
3647
-
3648
- <xsl:call-template name="setBordersTableArray"/>
4091
+ <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
4092
+ <xsl:call-template name="setTextAlignment">
4093
+ <xsl:with-param name="default">left</xsl:with-param>
4094
+ </xsl:call-template>
3649
4095
 
3650
- <xsl:if test="ancestor::*[local-name() = 'preface']">
3651
- <xsl:attribute name="border">none</xsl:attribute>
3652
- </xsl:if>
4096
+ <xsl:call-template name="refine_table-cell-style"/>
3653
4097
 
3654
4098
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3655
4099
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3680,9 +4124,13 @@
3680
4124
 
3681
4125
  <fo:block xsl:use-attribute-sets="table-note-style">
3682
4126
 
4127
+ <xsl:call-template name="refine_table-note-style"/>
4128
+
3683
4129
  <!-- Table's note name (NOTE, for example) -->
3684
4130
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3685
4131
 
4132
+ <xsl:call-template name="refine_table-note-name-style"/>
4133
+
3686
4134
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3687
4135
 
3688
4136
  </fo:inline>
@@ -3710,6 +4158,14 @@
3710
4158
  <!-- list of footnotes to calculate actual footnotes number -->
3711
4159
  <xsl:variable name="p_fn_">
3712
4160
  <xsl:call-template name="get_fn_list"/>
4161
+ <!-- <xsl:choose>
4162
+ <xsl:when test="$namespace = 'jis'">
4163
+ <xsl:call-template name="get_fn_list_for_element"/>
4164
+ </xsl:when>
4165
+ <xsl:otherwise>
4166
+ <xsl:call-template name="get_fn_list"/>
4167
+ </xsl:otherwise>
4168
+ </xsl:choose> -->
3713
4169
  </xsl:variable>
3714
4170
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3715
4171
 
@@ -3732,9 +4188,18 @@
3732
4188
  <xsl:variable name="current_fn_number_text">
3733
4189
  <xsl:value-of select="$current_fn_number"/>
3734
4190
 
4191
+ <fo:inline font-weight="normal">)</fo:inline>
4192
+
3735
4193
  </xsl:variable>
3736
4194
 
3737
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4195
+ <xsl:variable name="ref_id">
4196
+ <xsl:choose>
4197
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4198
+ <xsl:otherwise>
4199
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4200
+ </xsl:otherwise>
4201
+ </xsl:choose>
4202
+ </xsl:variable>
3738
4203
  <xsl:variable name="footnote_inline">
3739
4204
  <fo:inline>
3740
4205
 
@@ -3757,9 +4222,13 @@
3757
4222
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3758
4223
  </xsl:if>
3759
4224
 
3760
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3761
- <xsl:value-of select="$current_fn_number_text"/>
3762
- </fo:basic-link>
4225
+ <xsl:call-template name="insert_basic_link">
4226
+ <xsl:with-param name="element">
4227
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4228
+ <xsl:copy-of select="$current_fn_number_text"/>
4229
+ </fo:basic-link>
4230
+ </xsl:with-param>
4231
+ </xsl:call-template>
3763
4232
  </fo:inline>
3764
4233
  </xsl:variable>
3765
4234
 
@@ -3776,8 +4245,12 @@
3776
4245
 
3777
4246
  <fo:block xsl:use-attribute-sets="fn-body-style">
3778
4247
 
4248
+ <xsl:call-template name="refine_fn-body-style"/>
4249
+
3779
4250
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3780
4251
 
4252
+ <xsl:call-template name="refine_fn-body-num-style"/>
4253
+
3781
4254
  <xsl:value-of select="$current_fn_number_text"/>
3782
4255
  </fo:inline>
3783
4256
  <xsl:apply-templates/>
@@ -3829,6 +4302,28 @@
3829
4302
  </xsl:choose>
3830
4303
  </xsl:template>
3831
4304
 
4305
+ <xsl:template name="get_fn_list_for_element">
4306
+ <xsl:choose>
4307
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4308
+ <fn gen_id="{generate-id(.)}">
4309
+ <xsl:copy-of select="@*"/>
4310
+ <xsl:copy-of select="node()"/>
4311
+ </fn>
4312
+ </xsl:when>
4313
+ <xsl:otherwise>
4314
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4315
+ <xsl:variable name="element_id" select="@id"/>
4316
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4317
+ <!-- copy unique fn -->
4318
+ <fn gen_id="{generate-id(.)}">
4319
+ <xsl:copy-of select="@*"/>
4320
+ <xsl:copy-of select="node()"/>
4321
+ </fn>
4322
+ </xsl:for-each>
4323
+ </xsl:for-each>
4324
+ </xsl:otherwise>
4325
+ </xsl:choose>
4326
+ </xsl:template>
3832
4327
  <!-- ============================ -->
3833
4328
  <!-- table's footnotes rendering -->
3834
4329
  <!-- ============================ -->
@@ -4015,6 +4510,8 @@
4015
4510
  <xsl:template match="*[local-name()='fn']">
4016
4511
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4017
4512
 
4513
+ <xsl:call-template name="refine_fn-reference-style"/>
4514
+
4018
4515
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4019
4516
 
4020
4517
  <xsl:value-of select="@reference"/>
@@ -4106,14 +4603,18 @@
4106
4603
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
4107
4604
  <xsl:text> </xsl:text>
4108
4605
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
4109
- <xsl:text/>
4110
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4606
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4607
+ <xsl:text> </xsl:text>
4608
+ </xsl:if>
4609
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
4111
4610
  </fo:block>
4112
4611
 
4113
4612
  </xsl:when> <!-- END: only one component -->
4114
4613
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4115
4614
  <fo:block margin-bottom="12pt" text-align="left">
4116
4615
 
4616
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4617
+
4117
4618
  <!-- <xsl:variable name="title-where">
4118
4619
  <xsl:call-template name="getLocalizedString">
4119
4620
  <xsl:with-param name="key">where</xsl:with-param>
@@ -4127,6 +4628,8 @@
4127
4628
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
4128
4629
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4129
4630
 
4631
+ <xsl:call-template name="refine_figure_key_style"/>
4632
+
4130
4633
  <xsl:variable name="title-key">
4131
4634
  <xsl:call-template name="getLocalizedString">
4132
4635
  <xsl:with-param name="key">key</xsl:with-param>
@@ -4141,12 +4644,16 @@
4141
4644
  <xsl:if test="$onlyOneComponent = 'false'">
4142
4645
  <fo:block>
4143
4646
 
4647
+ <xsl:call-template name="refine_multicomponent_style"/>
4648
+
4144
4649
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4145
4650
  <xsl:attribute name="margin-top">0</xsl:attribute>
4146
4651
  </xsl:if>
4147
4652
 
4148
4653
  <fo:block>
4149
4654
 
4655
+ <xsl:call-template name="refine_multicomponent_block_style"/>
4656
+
4150
4657
  <xsl:apply-templates select="*[local-name() = 'name']">
4151
4658
  <xsl:with-param name="process">true</xsl:with-param>
4152
4659
  </xsl:apply-templates>
@@ -4304,6 +4811,24 @@
4304
4811
 
4305
4812
  </xsl:template> <!-- END: dl -->
4306
4813
 
4814
+ <xsl:template name="refine_dl_formula_where_style">
4815
+
4816
+ </xsl:template> <!-- refine_dl_formula_where_style -->
4817
+
4818
+ <xsl:template name="refine_figure_key_style">
4819
+
4820
+ </xsl:template> <!-- refine_figure_key_style -->
4821
+
4822
+ <xsl:template name="refine_multicomponent_style">
4823
+ <xsl:variable name="parent" select="local-name(..)"/>
4824
+
4825
+ </xsl:template> <!-- refine_multicomponent_style -->
4826
+
4827
+ <xsl:template name="refine_multicomponent_block_style">
4828
+ <xsl:variable name="parent" select="local-name(..)"/>
4829
+
4830
+ </xsl:template> <!-- refine_multicomponent_block_style -->
4831
+
4307
4832
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4308
4833
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4309
4834
 
@@ -4523,6 +5048,8 @@
4523
5048
 
4524
5049
  </xsl:if>
4525
5050
 
5051
+ <xsl:call-template name="refine_dt-cell-style"/>
5052
+
4526
5053
  <fo:block xsl:use-attribute-sets="dt-block-style">
4527
5054
  <xsl:copy-of select="@id"/>
4528
5055
 
@@ -4530,6 +5057,8 @@
4530
5057
  <xsl:attribute name="margin-top">0</xsl:attribute>
4531
5058
  </xsl:if>
4532
5059
 
5060
+ <xsl:call-template name="refine_dt-block-style"/>
5061
+
4533
5062
  <xsl:apply-templates>
4534
5063
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4535
5064
  </xsl:apply-templates>
@@ -4549,6 +5078,8 @@
4549
5078
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4550
5079
  </xsl:if>
4551
5080
 
5081
+ <xsl:call-template name="refine_dd-cell-style"/>
5082
+
4552
5083
  <fo:block>
4553
5084
 
4554
5085
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4594,8 +5125,18 @@
4594
5125
  </xsl:if>
4595
5126
  </xsl:template>
4596
5127
 
4597
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4598
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5128
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5129
+ <xsl:variable name="is_inline_element_after_where">
5130
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5131
+ </xsl:variable>
5132
+ <xsl:choose>
5133
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5134
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5135
+ </xsl:when>
5136
+ <xsl:otherwise>
5137
+ <xsl:apply-templates select="."/>
5138
+ </xsl:otherwise>
5139
+ </xsl:choose>
4599
5140
  </xsl:template>
4600
5141
 
4601
5142
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4689,7 +5230,7 @@
4689
5230
  <xsl:param name="split_keep-within-line"/>
4690
5231
  <fo:inline font-weight="bold">
4691
5232
 
4692
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
5233
+ <xsl:call-template name="refine_strong_style"/>
4693
5234
 
4694
5235
  <xsl:apply-templates>
4695
5236
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4697,6 +5238,12 @@
4697
5238
  </fo:inline>
4698
5239
  </xsl:template>
4699
5240
 
5241
+ <xsl:template name="refine_strong_style">
5242
+
5243
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
5244
+
5245
+ </xsl:template>
5246
+
4700
5247
  <xsl:template match="*[local-name()='padding']">
4701
5248
  <fo:inline padding-right="{@value}"> </fo:inline>
4702
5249
  </xsl:template>
@@ -5167,7 +5714,10 @@
5167
5714
  </xsl:choose>
5168
5715
  </xsl:variable>
5169
5716
 
5170
- <xsl:value-of select="$text9"/>
5717
+ <!-- replace sequence #x200B and space TO space -->
5718
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
5719
+
5720
+ <xsl:value-of select="$text10"/>
5171
5721
  </xsl:template>
5172
5722
 
5173
5723
  <xsl:template name="add-zero-spaces-link-java">
@@ -5842,6 +6392,11 @@
5842
6392
 
5843
6393
  <fo:inline xsl:use-attribute-sets="mathml-style">
5844
6394
 
6395
+ <!-- DEBUG -->
6396
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
6397
+
6398
+ <xsl:call-template name="refine_mathml-style"/>
6399
+
5845
6400
  <xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element -->
5846
6401
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5847
6402
  </xsl:if>
@@ -5946,6 +6501,8 @@
5946
6501
 
5947
6502
  <fo:instream-foreign-object fox:alt-text="Math">
5948
6503
 
6504
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6505
+
5949
6506
  <!-- put MathML in Actual Text -->
5950
6507
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5951
6508
  <xsl:attribute name="fox:actual-text">
@@ -5966,6 +6523,10 @@
5966
6523
  </fo:instream-foreign-object>
5967
6524
  </xsl:template>
5968
6525
 
6526
+ <xsl:template name="refine_mathml_insteam_object_style">
6527
+
6528
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
6529
+
5969
6530
  <xsl:template match="mathml:*" mode="mathml_actual_text">
5970
6531
  <!-- <xsl:text>a+b</xsl:text> -->
5971
6532
  <xsl:text>&lt;</xsl:text>
@@ -6029,6 +6590,79 @@
6029
6590
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6030
6591
  </xsl:template>
6031
6592
 
6593
+ <!-- special case for:
6594
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
6595
+ <mstyle displaystyle="true">
6596
+ <msup>
6597
+ <mi color="#00000000">C</mi>
6598
+ <mtext>R</mtext>
6599
+ </msup>
6600
+ <msubsup>
6601
+ <mtext>C</mtext>
6602
+ <mi>n</mi>
6603
+ <mi>k</mi>
6604
+ </msubsup>
6605
+ </mstyle>
6606
+ </math>
6607
+ -->
6608
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6609
+ <xsl:copy>
6610
+ <xsl:copy-of select="@*"/>
6611
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
6612
+ <xsl:if test="string-length($next_mtext) != ''">
6613
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6614
+ </xsl:if>
6615
+ <xsl:apply-templates/>
6616
+ <xsl:value-of select="$next_mtext"/>
6617
+ </xsl:copy>
6618
+ </xsl:template>
6619
+
6620
+ <!-- special case for:
6621
+ <msup>
6622
+ <mtext/>
6623
+ <mn>1</mn>
6624
+ </msup>
6625
+ convert to (add mspace after mtext and enclose them into mrow):
6626
+ <msup>
6627
+ <mrow>
6628
+ <mtext/>
6629
+ <mspace height="1.47ex"/>
6630
+ </mrow>
6631
+ <mn>1</mn>
6632
+ </msup>
6633
+ -->
6634
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6635
+ <mathml:mrow>
6636
+ <xsl:copy-of select="."/>
6637
+ <mathml:mspace height="1.47ex"/>
6638
+ </mathml:mrow>
6639
+ </xsl:template>
6640
+
6641
+ <!-- add space around vertical line -->
6642
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6643
+ <xsl:copy>
6644
+ <xsl:apply-templates select="@*" mode="mathml"/>
6645
+ <xsl:if test="not(@lspace)">
6646
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6647
+ </xsl:if>
6648
+ <xsl:if test="not(@rspace)">
6649
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6650
+ </xsl:if>
6651
+ <xsl:apply-templates mode="mathml"/>
6652
+ </xsl:copy>
6653
+ </xsl:template>
6654
+
6655
+ <!-- decrease fontsize for 'Circled Times' char -->
6656
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6657
+ <xsl:copy>
6658
+ <xsl:apply-templates select="@*" mode="mathml"/>
6659
+ <xsl:if test="not(@fontsize)">
6660
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6661
+ </xsl:if>
6662
+ <xsl:apply-templates mode="mathml"/>
6663
+ </xsl:copy>
6664
+ </xsl:template>
6665
+
6032
6666
  <!-- Examples:
6033
6667
  <stem type="AsciiMath">x = 1</stem>
6034
6668
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -6037,6 +6671,8 @@
6037
6671
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6038
6672
  <fo:inline xsl:use-attribute-sets="mathml-style">
6039
6673
 
6674
+ <xsl:call-template name="refine_mathml-style"/>
6675
+
6040
6676
  <xsl:choose>
6041
6677
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6042
6678
  <xsl:otherwise>
@@ -6081,24 +6717,30 @@
6081
6717
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6082
6718
  </xsl:if>
6083
6719
 
6720
+ <xsl:call-template name="refine_link-style"/>
6721
+
6084
6722
  <xsl:choose>
6085
6723
  <xsl:when test="$target_text = ''">
6086
6724
  <xsl:apply-templates/>
6087
6725
  </xsl:when>
6088
6726
  <xsl:otherwise>
6089
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6090
- <xsl:choose>
6091
- <xsl:when test="normalize-space(.) = ''">
6092
- <xsl:call-template name="add-zero-spaces-link-java">
6093
- <xsl:with-param name="text" select="$target_text"/>
6094
- </xsl:call-template>
6095
- </xsl:when>
6096
- <xsl:otherwise>
6097
- <!-- output text from <link>text</link> -->
6098
- <xsl:apply-templates/>
6099
- </xsl:otherwise>
6100
- </xsl:choose>
6101
- </fo:basic-link>
6727
+ <xsl:call-template name="insert_basic_link">
6728
+ <xsl:with-param name="element">
6729
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6730
+ <xsl:choose>
6731
+ <xsl:when test="normalize-space(.) = ''">
6732
+ <xsl:call-template name="add-zero-spaces-link-java">
6733
+ <xsl:with-param name="text" select="$target_text"/>
6734
+ </xsl:call-template>
6735
+ </xsl:when>
6736
+ <xsl:otherwise>
6737
+ <!-- output text from <link>text</link> -->
6738
+ <xsl:apply-templates/>
6739
+ </xsl:otherwise>
6740
+ </xsl:choose>
6741
+ </fo:basic-link>
6742
+ </xsl:with-param>
6743
+ </xsl:call-template>
6102
6744
  </xsl:otherwise>
6103
6745
  </xsl:choose>
6104
6746
  </fo:inline>
@@ -6161,12 +6803,19 @@
6161
6803
  </xsl:template>
6162
6804
 
6163
6805
  <xsl:template match="*[local-name() = 'xref']">
6164
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6165
- <xsl:if test="parent::*[local-name() = 'add']">
6166
- <xsl:call-template name="append_add-style"/>
6167
- </xsl:if>
6168
- <xsl:apply-templates/>
6169
- </fo:basic-link>
6806
+ <xsl:call-template name="insert_basic_link">
6807
+ <xsl:with-param name="element">
6808
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6809
+ <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
6810
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6811
+ </xsl:if>
6812
+ <xsl:if test="parent::*[local-name() = 'add']">
6813
+ <xsl:call-template name="append_add-style"/>
6814
+ </xsl:if>
6815
+ <xsl:apply-templates/>
6816
+ </fo:basic-link>
6817
+ </xsl:with-param>
6818
+ </xsl:call-template>
6170
6819
  </xsl:template>
6171
6820
 
6172
6821
  <!-- ====== -->
@@ -6221,6 +6870,8 @@
6221
6870
  <fo:table-cell display-align="center">
6222
6871
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
6223
6872
 
6873
+ <xsl:call-template name="refine_formula-stem-block-style"/>
6874
+
6224
6875
  <xsl:apply-templates/>
6225
6876
  </fo:block>
6226
6877
  </fo:table-cell>
@@ -6262,6 +6913,8 @@
6262
6913
 
6263
6914
  <xsl:call-template name="setBlockSpanAll"/>
6264
6915
 
6916
+ <xsl:call-template name="refine_note-style"/>
6917
+
6265
6918
  <fo:block-container margin-left="0mm" margin-right="0mm">
6266
6919
 
6267
6920
  <fo:list-block>
@@ -6292,6 +6945,10 @@
6292
6945
 
6293
6946
  </xsl:template>
6294
6947
 
6948
+ <xsl:template name="refine_note_block_style">
6949
+
6950
+ </xsl:template>
6951
+
6295
6952
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
6296
6953
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6297
6954
  <xsl:choose>
@@ -6313,12 +6970,16 @@
6313
6970
 
6314
6971
  <xsl:call-template name="setBlockSpanAll"/>
6315
6972
 
6973
+ <xsl:call-template name="refine_termnote-style"/>
6974
+
6316
6975
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6317
6976
 
6318
6977
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
6319
6978
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6320
6979
  </xsl:if>
6321
6980
 
6981
+ <xsl:call-template name="refine_termnote-name-style"/>
6982
+
6322
6983
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6323
6984
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6324
6985
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6488,6 +7149,8 @@
6488
7149
  <xsl:otherwise>
6489
7150
  <fo:block xsl:use-attribute-sets="image-style">
6490
7151
 
7152
+ <xsl:call-template name="refine_image-style"/>
7153
+
6491
7154
  <xsl:variable name="src">
6492
7155
  <xsl:call-template name="image_src"/>
6493
7156
  </xsl:variable>
@@ -6546,7 +7209,7 @@
6546
7209
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6547
7210
  </xsl:when>
6548
7211
  <xsl:when test="not(starts-with(@src, 'data:'))">
6549
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7212
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6550
7213
  </xsl:when>
6551
7214
  <xsl:otherwise>
6552
7215
  <xsl:value-of select="@src"/>
@@ -6568,7 +7231,7 @@
6568
7231
  </xsl:when>
6569
7232
  <xsl:when test="not(starts-with(@src, 'data:'))">
6570
7233
  <xsl:variable name="src">
6571
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7234
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6572
7235
  </xsl:variable>
6573
7236
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6574
7237
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6954,15 +7617,19 @@
6954
7617
  <xsl:param name="dest"/>
6955
7618
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6956
7619
  <fo:block font-size="1pt">
6957
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6958
- <fo:inline-container inline-progression-dimension="100%">
6959
- <fo:block-container height="{$height - 1}px" width="100%">
6960
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6961
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6962
- </xsl:if> -->
6963
- <fo:block> </fo:block></fo:block-container>
6964
- </fo:inline-container>
6965
- </fo:basic-link>
7620
+ <xsl:call-template name="insert_basic_link">
7621
+ <xsl:with-param name="element">
7622
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7623
+ <fo:inline-container inline-progression-dimension="100%">
7624
+ <fo:block-container height="{$height - 1}px" width="100%">
7625
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7626
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7627
+ </xsl:if> -->
7628
+ <fo:block> </fo:block></fo:block-container>
7629
+ </fo:inline-container>
7630
+ </fo:basic-link>
7631
+ </xsl:with-param>
7632
+ </xsl:call-template>
6966
7633
  </fo:block>
6967
7634
  </fo:block-container>
6968
7635
  </xsl:template>
@@ -7333,6 +8000,8 @@
7333
8000
  <xsl:if test="normalize-space() != ''">
7334
8001
  <fo:block xsl:use-attribute-sets="figure-name-style">
7335
8002
 
8003
+ <xsl:call-template name="refine_figure-name-style"/>
8004
+
7336
8005
  <xsl:apply-templates/>
7337
8006
  </fo:block>
7338
8007
  </xsl:if>
@@ -7596,6 +8265,8 @@
7596
8265
  </xsl:attribute>
7597
8266
  </xsl:for-each>
7598
8267
 
8268
+ <xsl:call-template name="refine_sourcecode-style"/>
8269
+
7599
8270
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7600
8271
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7601
8272
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -8300,6 +8971,8 @@
8300
8971
 
8301
8972
  <xsl:call-template name="setBlockSpanAll"/>
8302
8973
 
8974
+ <xsl:call-template name="refine_example-style"/>
8975
+
8303
8976
  <xsl:variable name="fo_element">
8304
8977
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8305
8978
  list
@@ -8427,6 +9100,8 @@
8427
9100
  </xsl:if>
8428
9101
  <fo:block xsl:use-attribute-sets="example-p-style">
8429
9102
 
9103
+ <xsl:call-template name="refine_example-p-style"/>
9104
+
8430
9105
  <xsl:apply-templates/>
8431
9106
  </fo:block>
8432
9107
  </fo:block-container>
@@ -8443,6 +9118,7 @@
8443
9118
  </xsl:otherwise>
8444
9119
  </xsl:choose>
8445
9120
  </xsl:template> <!-- example/p -->
9121
+
8446
9122
  <!-- ====== -->
8447
9123
  <!-- ====== -->
8448
9124
 
@@ -8454,6 +9130,8 @@
8454
9130
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8455
9131
  <fo:block xsl:use-attribute-sets="termsource-style">
8456
9132
 
9133
+ <xsl:call-template name="refine_termsource-style"/>
9134
+
8457
9135
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8458
9136
  <xsl:variable name="termsource_text">
8459
9137
  <xsl:apply-templates/>
@@ -8506,14 +9184,18 @@
8506
9184
  </xsl:template>
8507
9185
 
8508
9186
  <xsl:template match="*[local-name() = 'origin']">
8509
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8510
- <xsl:if test="normalize-space(@citeas) = ''">
8511
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8512
- </xsl:if>
8513
- <fo:inline xsl:use-attribute-sets="origin-style">
8514
- <xsl:apply-templates/>
8515
- </fo:inline>
8516
- </fo:basic-link>
9187
+ <xsl:call-template name="insert_basic_link">
9188
+ <xsl:with-param name="element">
9189
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9190
+ <xsl:if test="normalize-space(@citeas) = ''">
9191
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9192
+ </xsl:if>
9193
+ <fo:inline xsl:use-attribute-sets="origin-style">
9194
+ <xsl:apply-templates/>
9195
+ </fo:inline>
9196
+ </fo:basic-link>
9197
+ </xsl:with-param>
9198
+ </xsl:call-template>
8517
9199
  </xsl:template>
8518
9200
 
8519
9201
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8565,6 +9247,8 @@
8565
9247
  <fo:block-container margin-left="0mm">
8566
9248
  <fo:block-container xsl:use-attribute-sets="quote-style">
8567
9249
 
9250
+ <xsl:call-template name="refine_quote-style"/>
9251
+
8568
9252
  <fo:block-container margin-left="0mm" margin-right="0mm">
8569
9253
  <fo:block role="BlockQuote">
8570
9254
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8579,6 +9263,11 @@
8579
9263
  </fo:block>
8580
9264
  </xsl:if>
8581
9265
 
9266
+ <!-- render footnotes after references -->
9267
+ <xsl:apply-templates select=".//jis:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]" mode="fn_after_element">
9268
+ <xsl:with-param name="ancestor">quote</xsl:with-param>
9269
+ </xsl:apply-templates>
9270
+
8582
9271
  </fo:block-container>
8583
9272
  </fo:block-container>
8584
9273
  </xsl:template>
@@ -8587,9 +9276,13 @@
8587
9276
  <xsl:if test="../*[local-name() = 'author']">
8588
9277
  <xsl:text>, </xsl:text>
8589
9278
  </xsl:if>
8590
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8591
- <xsl:apply-templates/>
8592
- </fo:basic-link>
9279
+ <xsl:call-template name="insert_basic_link">
9280
+ <xsl:with-param name="element">
9281
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9282
+ <xsl:apply-templates/>
9283
+ </fo:basic-link>
9284
+ </xsl:with-param>
9285
+ </xsl:call-template>
8593
9286
  </xsl:template>
8594
9287
 
8595
9288
  <xsl:template match="*[local-name() = 'author']">
@@ -8635,28 +9328,33 @@
8635
9328
 
8636
9329
  </xsl:if>
8637
9330
 
8638
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8639
- <xsl:variable name="text" select="normalize-space()"/>
9331
+ <xsl:call-template name="refine_eref-style"/>
8640
9332
 
8641
- <fo:basic-link fox:alt-text="{@citeas}">
8642
- <xsl:if test="normalize-space(@citeas) = ''">
8643
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8644
- </xsl:if>
8645
- <xsl:if test="@type = 'inline'">
9333
+ <xsl:call-template name="insert_basic_link">
9334
+ <xsl:with-param name="element">
9335
+ <fo:basic-link fox:alt-text="{@citeas}">
9336
+ <xsl:if test="normalize-space(@citeas) = ''">
9337
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9338
+ </xsl:if>
9339
+ <xsl:if test="@type = 'inline'">
8646
9340
 
8647
- </xsl:if>
9341
+ <xsl:call-template name="refine_basic_link_style"/>
8648
9342
 
8649
- <xsl:choose>
8650
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8651
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8652
- </xsl:when>
8653
- <xsl:otherwise>
8654
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8655
- </xsl:otherwise>
8656
- </xsl:choose>
9343
+ </xsl:if>
8657
9344
 
8658
- <xsl:apply-templates/>
8659
- </fo:basic-link>
9345
+ <xsl:choose>
9346
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9347
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9348
+ </xsl:when>
9349
+ <xsl:otherwise>
9350
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9351
+ </xsl:otherwise>
9352
+ </xsl:choose>
9353
+
9354
+ <xsl:apply-templates/>
9355
+ </fo:basic-link>
9356
+ </xsl:with-param>
9357
+ </xsl:call-template>
8660
9358
 
8661
9359
  </fo:inline>
8662
9360
  </xsl:when>
@@ -8674,6 +9372,11 @@
8674
9372
  </xsl:otherwise>
8675
9373
  </xsl:choose>
8676
9374
  </xsl:template>
9375
+
9376
+ <xsl:template name="refine_basic_link_style">
9377
+
9378
+ </xsl:template> <!-- refine_basic_link_style -->
9379
+
8677
9380
  <!-- ====== -->
8678
9381
  <!-- END eref -->
8679
9382
  <!-- ====== -->
@@ -8811,11 +9514,17 @@
8811
9514
  <fo:block>
8812
9515
  <xsl:call-template name="setId"/>
8813
9516
 
9517
+ <xsl:call-template name="sections_element_style"/>
9518
+
8814
9519
  <xsl:apply-templates/>
8815
9520
  </fo:block>
8816
9521
 
8817
9522
  </xsl:template>
8818
9523
 
9524
+ <xsl:template name="sections_element_style">
9525
+
9526
+ </xsl:template> <!-- sections_element_style -->
9527
+
8819
9528
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
8820
9529
  <fo:block break-after="page"/>
8821
9530
  <fo:block>
@@ -8830,10 +9539,16 @@
8830
9539
 
8831
9540
  <xsl:call-template name="setBlockSpanAll"/>
8832
9541
 
9542
+ <xsl:call-template name="refine_clause_style"/>
9543
+
8833
9544
  <xsl:apply-templates/>
8834
9545
  </fo:block>
8835
9546
  </xsl:template>
8836
9547
 
9548
+ <xsl:template name="refine_clause_style">
9549
+
9550
+ </xsl:template> <!-- refine_clause_style -->
9551
+
8837
9552
  <xsl:template match="*[local-name() = 'definitions']">
8838
9553
  <fo:block id="{@id}">
8839
9554
  <xsl:apply-templates/>
@@ -8846,10 +9561,16 @@
8846
9561
 
8847
9562
  <xsl:call-template name="setBlockSpanAll"/>
8848
9563
 
9564
+ <xsl:call-template name="refine_annex_style"/>
9565
+
8849
9566
  </fo:block>
8850
9567
  <xsl:apply-templates/>
8851
9568
  </xsl:template>
8852
9569
 
9570
+ <xsl:template name="refine_annex_style">
9571
+
9572
+ </xsl:template>
9573
+
8853
9574
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
8854
9575
  <!-- comment 2019-11-29 -->
8855
9576
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -8880,15 +9601,17 @@
8880
9601
  <!-- ===================================== -->
8881
9602
  <xsl:variable name="ul_labels_">
8882
9603
 
8883
- <label level="1">–</label>
8884
- <label level="2">•</label>
8885
- <label level="3" font-size="75%">o</label> <!-- white circle -->
9604
+ <label level="1">-</label> <!-- full-width hyphen minus -->
9605
+ <label level="2" font-size="130%" line-height="1.2">・</label> <!-- Katakana Middle Dot -->
8886
9606
 
8887
9607
  </xsl:variable>
8888
9608
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8889
9609
 
8890
9610
  <xsl:template name="setULLabel">
8891
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9611
+ <xsl:variable name="list_level__">
9612
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul'])"/>
9613
+ </xsl:variable>
9614
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8892
9615
  <xsl:variable name="list_level">
8893
9616
  <xsl:choose>
8894
9617
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -9013,6 +9736,8 @@
9013
9736
  </xsl:choose>
9014
9737
  </xsl:attribute>
9015
9738
 
9739
+ <xsl:call-template name="refine_list_container_style"/>
9740
+
9016
9741
  <fo:block-container margin-left="0mm">
9017
9742
  <fo:block>
9018
9743
  <xsl:apply-templates select="." mode="list"/>
@@ -9021,13 +9746,26 @@
9021
9746
  </fo:block-container>
9022
9747
  </xsl:when>
9023
9748
  <xsl:otherwise>
9024
- <fo:block>
9025
- <xsl:apply-templates select="." mode="list"/>
9026
- </fo:block>
9749
+
9750
+ <fo:block-container>
9751
+ <xsl:if test="ancestor::jis:ol or ancestor::jis:ul">
9752
+ <xsl:attribute name="margin-left">3.5mm</xsl:attribute>
9753
+ </xsl:if>
9754
+ <fo:block-container margin-left="0mm">
9755
+ <fo:block>
9756
+ <xsl:apply-templates select="." mode="list"/>
9757
+ </fo:block>
9758
+ </fo:block-container>
9759
+ </fo:block-container>
9760
+
9027
9761
  </xsl:otherwise>
9028
9762
  </xsl:choose>
9029
9763
  </xsl:template>
9030
9764
 
9765
+ <xsl:template name="refine_list_container_style">
9766
+
9767
+ </xsl:template> <!-- refine_list_container_style -->
9768
+
9031
9769
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
9032
9770
 
9033
9771
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -9038,7 +9776,7 @@
9038
9776
 
9039
9777
  <xsl:variable name="provisional_distance_between_starts_">
9040
9778
  <attributes xsl:use-attribute-sets="list-style">
9041
-
9779
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
9042
9780
  </attributes>
9043
9781
  </xsl:variable>
9044
9782
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -9074,6 +9812,8 @@
9074
9812
  <addon><xsl:value-of select="$addon"/></addon> -->
9075
9813
  </xsl:if>
9076
9814
 
9815
+ <xsl:call-template name="refine_list-style"/>
9816
+
9077
9817
  <xsl:if test="*[local-name() = 'name']">
9078
9818
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9079
9819
  </xsl:if>
@@ -9086,6 +9826,10 @@
9086
9826
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
9087
9827
  </xsl:template>
9088
9828
 
9829
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9830
+
9831
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9832
+
9089
9833
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
9090
9834
  <xsl:param name="process">false</xsl:param>
9091
9835
  <xsl:if test="$process = 'true'">
@@ -9099,13 +9843,12 @@
9099
9843
  <fo:list-item xsl:use-attribute-sets="list-item-style">
9100
9844
  <xsl:copy-of select="@id"/>
9101
9845
 
9846
+ <xsl:call-template name="refine_list-item-style"/>
9847
+
9102
9848
  <fo:list-item-label end-indent="label-end()">
9103
9849
  <fo:block xsl:use-attribute-sets="list-item-label-style">
9104
9850
 
9105
- <xsl:if test="parent::*[local-name() = 'ol']">
9106
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
9107
- <xsl:attribute name="font-weight">bold</xsl:attribute>
9108
- </xsl:if>
9851
+ <xsl:call-template name="refine_list-item-label-style"/>
9109
9852
 
9110
9853
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9111
9854
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -9113,11 +9856,14 @@
9113
9856
  </xsl:if>
9114
9857
 
9115
9858
  <xsl:call-template name="getListItemFormat"/>
9859
+
9116
9860
  </fo:block>
9117
9861
  </fo:list-item-label>
9118
9862
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9119
9863
  <fo:block>
9120
9864
 
9865
+ <xsl:call-template name="refine_list-item-body-style"/>
9866
+
9121
9867
  <xsl:apply-templates/>
9122
9868
 
9123
9869
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9435,6 +10181,12 @@
9435
10181
 
9436
10182
  <fo:block id="{@id}">
9437
10183
  <xsl:apply-templates/>
10184
+
10185
+ <!-- render footnotes after references -->
10186
+ <xsl:apply-templates select=".//jis:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]" mode="fn_after_element">
10187
+ <xsl:with-param name="ancestor">references</xsl:with-param>
10188
+ </xsl:apply-templates>
10189
+
9438
10190
  </fo:block>
9439
10191
  </xsl:template>
9440
10192
 
@@ -9454,6 +10206,12 @@
9454
10206
 
9455
10207
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9456
10208
  <xsl:apply-templates/>
10209
+
10210
+ <!-- render footnotes after references -->
10211
+ <xsl:apply-templates select=".//jis:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]" mode="fn_after_element">
10212
+ <xsl:with-param name="ancestor">references</xsl:with-param>
10213
+ </xsl:apply-templates>
10214
+
9457
10215
  </fo:block>
9458
10216
 
9459
10217
  </xsl:template> <!-- references -->
@@ -9715,24 +10473,32 @@
9715
10473
  <xsl:for-each select="*[local-name() = 'tab']">
9716
10474
  <xsl:variable name="current_id" select="generate-id()"/>
9717
10475
  <fo:table-cell>
9718
- <fo:block>
9719
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9720
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9721
- <xsl:choose>
9722
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9723
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9724
- </xsl:choose>
9725
- </xsl:for-each>
9726
- </fo:basic-link>
10476
+ <fo:block line-height-shift-adjustment="disregard-shifts">
10477
+ <xsl:call-template name="insert_basic_link">
10478
+ <xsl:with-param name="element">
10479
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10480
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10481
+ <xsl:choose>
10482
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10483
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10484
+ </xsl:choose>
10485
+ </xsl:for-each>
10486
+ </fo:basic-link>
10487
+ </xsl:with-param>
10488
+ </xsl:call-template>
9727
10489
  </fo:block>
9728
10490
  </fo:table-cell>
9729
10491
  </xsl:for-each>
9730
10492
  <!-- last column - for page numbers -->
9731
10493
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9732
10494
  <fo:block>
9733
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9734
- <fo:page-number-citation ref-id="{$target}"/>
9735
- </fo:basic-link>
10495
+ <xsl:call-template name="insert_basic_link">
10496
+ <xsl:with-param name="element">
10497
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10498
+ <fo:page-number-citation ref-id="{$target}"/>
10499
+ </fo:basic-link>
10500
+ </xsl:with-param>
10501
+ </xsl:call-template>
9736
10502
  </fo:block>
9737
10503
  </fo:table-cell>
9738
10504
  </xsl:template>
@@ -9774,6 +10540,27 @@
9774
10540
  <!-- End Table of Contents (ToC) processing -->
9775
10541
  <!-- =================== -->
9776
10542
 
10543
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
10544
+ <xsl:template name="insert_basic_link">
10545
+ <xsl:param name="element"/>
10546
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
10547
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
10548
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
10549
+ <xsl:choose>
10550
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
10551
+ <xsl:copy-of select="$element_node"/>
10552
+ </xsl:when>
10553
+ <xsl:otherwise>
10554
+ <fo:inline>
10555
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
10556
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
10557
+ </xsl:for-each>
10558
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
10559
+ </fo:inline>
10560
+ </xsl:otherwise>
10561
+ </xsl:choose>
10562
+ </xsl:template>
10563
+
9777
10564
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9778
10565
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9779
10566
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -10005,6 +10792,9 @@
10005
10792
  </xsl:copy>
10006
10793
  </xsl:template>
10007
10794
 
10795
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
10796
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
10797
+
10008
10798
  <xsl:template name="add_id">
10009
10799
  <xsl:if test="not(@id)">
10010
10800
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -10393,6 +11183,14 @@
10393
11183
  <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
10394
11184
  <xsl:variable name="p_fn_">
10395
11185
  <xsl:call-template name="get_fn_list"/>
11186
+ <!-- <xsl:choose>
11187
+ <xsl:when test="$namespace = 'jis'">
11188
+ <xsl:call-template name="get_fn_list_for_element"/>
11189
+ </xsl:when>
11190
+ <xsl:otherwise>
11191
+ <xsl:call-template name="get_fn_list"/>
11192
+ </xsl:otherwise>
11193
+ </xsl:choose> -->
10396
11194
  </xsl:variable>
10397
11195
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10398
11196
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -10407,8 +11205,17 @@
10407
11205
  <xsl:attribute name="current_fn_number">
10408
11206
  <xsl:value-of select="$current_fn_number"/>
10409
11207
  </xsl:attribute>
11208
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10410
11209
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10411
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
11210
+
11211
+ <xsl:choose>
11212
+ <xsl:when test="ancestor::*[local-name() = 'ul' or local-name() ='ol' or local-name() = 'bibitem' or local-name() = 'quote']">true</xsl:when>
11213
+ <xsl:otherwise><xsl:value-of select="$skip_footnote_body_"/></xsl:otherwise>
11214
+ </xsl:choose>
11215
+
11216
+ </xsl:attribute>
11217
+ <xsl:attribute name="ref_id">
11218
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
10412
11219
  </xsl:attribute>
10413
11220
  <xsl:apply-templates select="node()" mode="linear_xml"/>
10414
11221
  </xsl:copy>