metanorma-jis 0.0.3 → 0.0.5

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
 
@@ -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,78 @@
483
467
  </fo:root>
484
468
  </xsl:template>
485
469
 
470
+ <xsl:template match="*[local-name() = 'colon_gothic']">
471
+ <!-- replace : to : (Fullwidth colon) and render it in the font IPAexGothic -->
472
+ <fo:inline font-family="IPAexGothic">:</fo:inline>
473
+ </xsl:template>
474
+
475
+ <xsl:template match="*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']" priority="4">
476
+ <xsl:param name="num"/>
477
+ <xsl:apply-templates/>
478
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
479
+ <!-- fill ToC -->
480
+ <fo:block role="TOC" font-family="IPAexGothic">
481
+ <xsl:if test="$contents/doc[@num = $num]//item[@display = 'true']">
482
+ <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true'][@level &lt;= $toc_level or @type='figure' or @type = 'table']">
483
+ <fo:block role="TOCI">
484
+ <xsl:choose>
485
+ <xsl:when test="@type = 'bibliography'">
486
+ </xsl:when>
487
+ <xsl:when test="@type = 'annex'">
488
+ <fo:block space-after="5pt">
489
+ <xsl:call-template name="insertTocItem"/>
490
+ </fo:block>
491
+ </xsl:when>
492
+ <xsl:otherwise>
493
+ <fo:list-block space-after="5pt">
494
+ <xsl:attribute name="provisional-distance-between-starts">
495
+ <xsl:choose>
496
+ <xsl:when test="string-length(@section) = 1">5mm</xsl:when>
497
+ <xsl:when test="string-length(@section) &gt;= 2"><xsl:value-of select="5 + (string-length(@section) - 1) * 2"/>mm</xsl:when>
498
+ <xsl:when test="@type = 'annex'">16mm</xsl:when>
499
+ <xsl:otherwise>5mm</xsl:otherwise>
500
+ </xsl:choose>
501
+ </xsl:attribute>
502
+ <fo:list-item>
503
+ <fo:list-item-label end-indent="label-end()">
504
+ <fo:block>
505
+ <xsl:if test="@section != '' and @type != 'annex'">
506
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
507
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
508
+ </xsl:if>
509
+ <xsl:value-of select="@section"/>
510
+ </fo:block>
511
+ </fo:list-item-label>
512
+ <fo:list-item-body start-indent="body-start()">
513
+ <xsl:call-template name="insertTocItem"/>
514
+ </fo:list-item-body>
515
+ </fo:list-item>
516
+ </fo:list-block>
517
+ </xsl:otherwise>
518
+ </xsl:choose>
519
+ </fo:block>
520
+ </xsl:for-each>
521
+ </xsl:if>
522
+ </fo:block>
523
+ </xsl:if>
524
+ </xsl:template>
525
+
526
+ <xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" priority="3">
527
+ <fo:block text-align="center" font-size="14pt" font-family="IPAexGothic" margin-top="8.5mm">
528
+ <!-- Contents -->
529
+ <!-- <xsl:call-template name="getLocalizedString">
530
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
531
+ </xsl:call-template> -->
532
+ <xsl:apply-templates/>
533
+ </fo:block>
534
+ <fo:block text-align="right" font-size="8pt" font-family="IPAexMincho" margin-top="10mm">
535
+ <!-- Page -->
536
+ <xsl:call-template name="getLocalizedString">
537
+ <xsl:with-param name="key">locality.page</xsl:with-param>
538
+ </xsl:call-template>
539
+ </fo:block>
540
+ </xsl:template>
541
+
486
542
  <xsl:template name="insertTocItem">
487
543
  <fo:block text-align-last="justify" role="TOCI">
488
544
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
@@ -515,10 +571,18 @@
515
571
 
516
572
  <fo:block-container text-align="center">
517
573
  <!-- title -->
518
- <fo:block role="H1" font-family="IPAexGothic" font-size="22pt" margin-top="27mm">規格票の様式及び作成方法</fo:block>
574
+ <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
575
  <!-- docidentifier, 3 part: number, colon and year-->
520
- <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm">JIS Z 8301<fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline><fo:inline font-family="IPAexMincho" font-size="10pt">2019</fo:inline></fo:inline></fo:block>
521
- <fo:block font-family="IPAexGothic" font-size="14pt" margin-top="12mm"><fo:inline font-family="IPAexMincho">(</fo:inline>JSA<fo:inline font-family="IPAexMincho">)</fo:inline></fo:block>
576
+ <xsl:variable name="docidentifier" select="/*/jis:bibdata/jis:docidentifier[@type = 'JIS']"/>
577
+ <xsl:variable name="docidentifier_number" select="java:replaceAll(java:java.lang.String.new($docidentifier), '^(.*)(:)(.*)$', '$1')"/>
578
+ <xsl:variable name="docidentifier_year" select="java:replaceAll(java:java.lang.String.new($docidentifier), '^(.*)(:)(.*)$', '$3')"/>
579
+
580
+ <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm">
581
+ <fo:inline font-family="Arial">JIS <xsl:value-of select="$docidentifier_number"/></fo:inline>
582
+ <fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline>
583
+ <fo:inline font-family="Times New Roman" font-size="10pt"><xsl:value-of select="$docidentifier_year"/></fo:inline></fo:inline>
584
+ </fo:block>
585
+ <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
586
  </fo:block-container>
523
587
 
524
588
  <fo:block-container absolute-position="fixed" left="0mm" top="200mm" height="69mm" text-align="center" display-align="after" font-family="IPAexMincho">
@@ -540,7 +604,7 @@
540
604
 
541
605
  <fo:static-content flow-name="xsl-footnote-separator">
542
606
  <fo:block text-align="center" margin-bottom="6pt">
543
- <fo:leader leader-pattern="rule" leader-length="80mm"/>
607
+ <fo:leader leader-pattern="rule" leader-length="80mm" rule-style="solid" rule-thickness="0.3pt"/>
544
608
  </fo:block>
545
609
  </fo:static-content>
546
610
 
@@ -559,7 +623,7 @@
559
623
  <fo:inline/>
560
624
  <fo:footnote-body>
561
625
  <fo:block font-size="8.5pt">
562
- <xsl:apply-templates select="/*/*[local-name() = 'preface']/*[local-name() = 'clause'][@type = 'inner-cover-note']/*[not(local-name() = 'title')]"/>
626
+ <xsl:apply-templates select="/*/*[local-name() = 'preface']/*[local-name() = 'clause'][@type = 'inner-cover-note']"/> <!-- /*[not(local-name() = 'title')] -->
563
627
  </fo:block>
564
628
  </fo:footnote-body>
565
629
  </fo:footnote>
@@ -653,6 +717,13 @@
653
717
  </xsl:if>
654
718
  </xsl:template>
655
719
 
720
+ <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'clause']" priority="3">
721
+ <fo:block>
722
+ <xsl:call-template name="setId"/>
723
+ <xsl:apply-templates/>
724
+ </fo:block>
725
+ </xsl:template>
726
+
656
727
  <xsl:template match="*" priority="3" mode="page">
657
728
  <xsl:call-template name="elementProcessing"/>
658
729
  </xsl:template>
@@ -736,7 +807,7 @@
736
807
  <xsl:variable name="margin-top">
737
808
  <xsl:choose>
738
809
  <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
739
- <xsl:when test="$level = 1">4.5mm</xsl:when>
810
+ <xsl:when test="$level = 1">6.5mm</xsl:when>
740
811
  <xsl:when test="@ancestor = 'foreword' and $level = 2">0mm</xsl:when>
741
812
  <xsl:when test="@ancestor = 'annex' and $level = 2">4.5mm</xsl:when>
742
813
  <xsl:when test="@ancestor = 'bibliography' and $level = 2">0mm</xsl:when>
@@ -755,12 +826,13 @@
755
826
 
756
827
  <xsl:variable name="margin-bottom">
757
828
  <xsl:choose>
829
+ <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
830
+ <xsl:when test="$level = 1 and following-sibling::jis:clause">8pt</xsl:when>
758
831
  <xsl:when test="$level = 1">12pt</xsl:when>
832
+ <xsl:when test="$level = 2 and following-sibling::jis:clause">8pt</xsl:when>
759
833
  <xsl:when test="$level &gt;= 2">12pt</xsl:when>
760
834
  <xsl:when test="@type = 'section-title'">6mm</xsl:when>
761
835
  <xsl:when test="@inline-header = 'true'">0pt</xsl:when>
762
- <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
763
- <xsl:when test="@ancestor = 'introduction' and $level = 1">5.5mm</xsl:when>
764
836
  <xsl:when test="@ancestor = 'annex' and $level = 1">6mm</xsl:when>
765
837
  <xsl:otherwise>0mm</xsl:otherwise>
766
838
  </xsl:choose>
@@ -841,7 +913,9 @@
841
913
  <xsl:variable name="element-name">fo:block</xsl:variable>
842
914
 
843
915
  <xsl:element name="{$element-name}">
844
- <xsl:call-template name="setBlockAttributes"/>
916
+ <xsl:call-template name="setBlockAttributes">
917
+ <xsl:with-param name="text_align_default">justify</xsl:with-param>
918
+ </xsl:call-template>
845
919
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
846
920
 
847
921
  <xsl:if test="not(parent::jis:note or parent::jis:li or ancestor::jis:table)">
@@ -867,10 +941,18 @@
867
941
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
868
942
  </xsl:if>
869
943
 
870
- <xsl:if test="parent::jis:li or following-sibling::*[1][self::jis:ol or self::jis:ul]">
944
+ <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]">
871
945
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
872
946
  </xsl:if>
873
947
 
948
+ <xsl:if test="parent::jis:td or parent::jis:th or parent::jis:dd">
949
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
950
+ </xsl:if>
951
+
952
+ <xsl:if test="parent::jis:clause[@type = 'inner-cover-note']">
953
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
954
+ </xsl:if>
955
+
874
956
  <xsl:apply-templates>
875
957
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
876
958
  </xsl:apply-templates>
@@ -890,8 +972,6 @@
890
972
 
891
973
  <xsl:template match="jis:termnote" priority="2">
892
974
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
893
- <xsl:attribute name="text-indent">0mm</xsl:attribute>
894
- <xsl:attribute name="space-before">2pt</xsl:attribute>
895
975
  <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
896
976
  <fo:list-item>
897
977
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
@@ -949,12 +1029,17 @@
949
1029
  <!-- ========================= -->
950
1030
  <!-- Allocate non-Japanese text -->
951
1031
  <!-- ========================= -->
952
- <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
953
- <xsl:template match="jis:note/jis:name/text() | jis:term/jis:preferred//text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:example/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text() | jis:strong/text()" mode="update_xml_step1">
954
- <xsl:variable name="regex_en">([^\u3000-\u9FFF\uF900-\uFFFF]{1,})</xsl:variable>
955
- <xsl:variable name="element_name_font_en">font_en</xsl:variable>
956
- <xsl:variable name="tag_font_en_open">###<xsl:value-of select="$element_name_font_en"/>###</xsl:variable>
957
- <xsl:variable name="tag_font_en_close">###/<xsl:value-of select="$element_name_font_en"/>###</xsl:variable>
1032
+
1033
+ <xsl:variable name="regex_en">([^\u3000-\u9FFF\uF900-\uFFFF]{1,})</xsl:variable>
1034
+
1035
+ <xsl:variable name="element_name_font_en">font_en</xsl:variable>
1036
+ <xsl:variable name="tag_font_en_open">###<xsl:value-of select="$element_name_font_en"/>###</xsl:variable>
1037
+ <xsl:variable name="tag_font_en_close">###/<xsl:value-of select="$element_name_font_en"/>###</xsl:variable>
1038
+ <xsl:variable name="element_name_font_en_bold">font_en_bold</xsl:variable>
1039
+ <xsl:variable name="tag_font_en_bold_open">###<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
1040
+ <xsl:variable name="tag_font_en_bold_close">###/<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
1041
+
1042
+ <xsl:template match="jis:p//text()[not(ancestor::jis:strong)] | jis:dt/text()" mode="update_xml_step1">
958
1043
  <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_open,'$1',$tag_font_en_close))"/>
959
1044
  <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
960
1045
  <xsl:with-param name="tag_open" select="$tag_font_en_open"/>
@@ -964,13 +1049,104 @@
964
1049
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
965
1050
  </xsl:template>
966
1051
 
967
- <xsl:template match="*[local-name() = 'font_en']">
1052
+ <!-- jis:term/jis:preferred2//text() | -->
1053
+
1054
+ <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
1055
+ <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">
1056
+ <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))"/>
1057
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1058
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1059
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1060
+ <xsl:with-param name="text" select="$text_en_"/>
1061
+ </xsl:call-template></text></xsl:variable>
1062
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1063
+ </xsl:template>
1064
+
1065
+ <!-- move example title to the first paragraph -->
1066
+ <xsl:template match="jis:example[contains(jis:name/text(), ' — ')]" mode="update_xml_step1">
1067
+ <xsl:copy>
1068
+ <xsl:copy-of select="@*"/>
1069
+ <xsl:element name="p" namespace="https://www.metanorma.org/ns/jis">
1070
+ <xsl:value-of select="substring-after(jis:name/text(), ' — ')"/>
1071
+ </xsl:element>
1072
+ <xsl:apply-templates mode="update_xml_step1"/>
1073
+ </xsl:copy>
1074
+ </xsl:template>
1075
+ <xsl:template match="jis:example/jis:name/text()" mode="update_xml_step1">
1076
+ <xsl:variable name="example_name">
1077
+ <xsl:choose>
1078
+ <xsl:when test="contains(., ' — ')"><xsl:value-of select="substring-before(., ' — ')"/></xsl:when>
1079
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
1080
+ </xsl:choose>
1081
+ </xsl:variable>
1082
+ <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))"/>
1083
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1084
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1085
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1086
+ <xsl:with-param name="text" select="$text_en_"/>
1087
+ </xsl:call-template></text></xsl:variable>
1088
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1089
+ </xsl:template>
1090
+
1091
+ <xsl:template match="jis:eref//text()" mode="update_xml_step1">
1092
+ <!-- Example: JIS Z 8301:2011 to <font_en_bold>JIS Z 8301</font_en_bold><font_en>:2011</font_en> -->
1093
+ <xsl:variable name="parts">
1094
+ <xsl:choose>
1095
+ <xsl:when test="contains(., ':')">
1096
+ <xsl:element name="{$element_name_font_en_bold}"><xsl:value-of select="substring-before(., ':')"/></xsl:element>
1097
+ <xsl:element name="{$element_name_font_en}">:<xsl:value-of select="substring-after(., ':')"/></xsl:element>
1098
+ </xsl:when>
1099
+ <xsl:otherwise>
1100
+ <xsl:element name="{$element_name_font_en_bold}"><xsl:value-of select="."/></xsl:element>
1101
+ </xsl:otherwise>
1102
+ </xsl:choose>
1103
+ </xsl:variable>
1104
+ <xsl:for-each select="xalan:nodeset($parts)/*">
1105
+ <xsl:variable name="tag_open">###<xsl:value-of select="local-name()"/>###</xsl:variable>
1106
+ <xsl:variable name="tag_close">###/<xsl:value-of select="local-name()"/>###</xsl:variable>
1107
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_open,'$1',$tag_close))"/>
1108
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1109
+ <xsl:with-param name="tag_open" select="$tag_open"/>
1110
+ <xsl:with-param name="tag_close" select="$tag_close"/>
1111
+ <xsl:with-param name="text" select="$text_en_"/>
1112
+ </xsl:call-template></text></xsl:variable>
1113
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1114
+ </xsl:for-each>
1115
+ </xsl:template>
1116
+
1117
+ <xsl:template match="jis:strong" priority="2" mode="update_xml_step1">
1118
+ <xsl:apply-templates mode="update_xml_step1"/>
1119
+ </xsl:template>
1120
+ <xsl:template match="jis:strong/text()" priority="2" mode="update_xml_step1">
1121
+ <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))"/>
1122
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1123
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1124
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1125
+ <xsl:with-param name="text" select="$text_en_"/>
1126
+ </xsl:call-template></text></xsl:variable>
1127
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1128
+ </xsl:template>
1129
+
1130
+ <xsl:template match="*[local-name() = 'font_en_bold'][normalize-space() != '']">
1131
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
968
1132
  <fo:inline font-family="Times New Roman" font-weight="bold">
969
1133
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
970
1134
  <xsl:attribute name="font-weight">normal</xsl:attribute>
971
1135
  </xsl:if>
972
1136
  <xsl:apply-templates/>
973
1137
  </fo:inline>
1138
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1139
+ </xsl:template>
1140
+
1141
+ <xsl:template match="*[local-name() = 'font_en'][normalize-space() != '']">
1142
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1143
+ <fo:inline font-family="Times New Roman">
1144
+ <xsl:if test="ancestor::*[local-name() = 'preferred']">
1145
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1146
+ </xsl:if>
1147
+ <xsl:apply-templates/>
1148
+ </fo:inline>
1149
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
974
1150
  </xsl:template>
975
1151
 
976
1152
  <!-- ========================= -->
@@ -982,16 +1158,31 @@
982
1158
  <xsl:param name="hidePageNumber">false</xsl:param>
983
1159
  <xsl:param name="section"/>
984
1160
  <xsl:param name="copyrightText"/>
1161
+ <xsl:param name="section_title"/>
1162
+ <fo:static-content flow-name="header-odd-first" role="artifact">
1163
+ <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
1164
+ <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
1165
+ <fo:block>
1166
+ <xsl:copy-of select="$docidentifier"/>
1167
+ </fo:block>
1168
+ </fo:block-container>
1169
+ </fo:static-content>
985
1170
  <fo:static-content flow-name="header-odd" role="artifact">
986
1171
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after" text-align="right">
987
1172
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
988
- <fo:block><xsl:copy-of select="$docidentifier"/></fo:block>
1173
+ <fo:block>
1174
+ <xsl:copy-of select="$docidentifier"/>
1175
+ <xsl:copy-of select="$section_title"/>
1176
+ </fo:block>
989
1177
  </fo:block-container>
990
1178
  </fo:static-content>
991
1179
  <fo:static-content flow-name="header-even" role="artifact">
992
1180
  <fo:block-container font-family="Arial" font-size="9pt" height="26mm" display-align="after">
993
1181
  <xsl:if test="$section = 'main'"><fo:block><fo:page-number/></fo:block></xsl:if>
994
- <fo:block><xsl:copy-of select="$docidentifier"/></fo:block>
1182
+ <fo:block>
1183
+ <xsl:copy-of select="$docidentifier"/>
1184
+ <xsl:copy-of select="$section_title"/>
1185
+ </fo:block>
995
1186
  </fo:block-container>
996
1187
  </fo:static-content>
997
1188
  <xsl:call-template name="insertFooter">
@@ -1004,7 +1195,7 @@
1004
1195
  <xsl:param name="section"/>
1005
1196
  <xsl:param name="copyrightText"/>
1006
1197
  <fo:static-content flow-name="footer">
1007
- <fo:block-container height="24.5mm" display-align="after">
1198
+ <fo:block-container height="24mm" display-align="after">
1008
1199
  <xsl:if test="$section = 'preface'">
1009
1200
  <fo:block font-size="9pt" text-align="center" space-after="10pt">(<fo:inline font-family="Times New Roman"><fo:page-number/></fo:inline>)</fo:block>
1010
1201
  </xsl:if>
@@ -1528,6 +1719,8 @@
1528
1719
 
1529
1720
  <xsl:attribute-set name="example-p-style">
1530
1721
 
1722
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1723
+
1531
1724
  </xsl:attribute-set> <!-- example-p-style -->
1532
1725
 
1533
1726
  <xsl:attribute-set name="termexample-name-style">
@@ -1605,8 +1798,10 @@
1605
1798
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1606
1799
  <xsl:attribute name="display-align">center</xsl:attribute>
1607
1800
 
1801
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1608
1802
  <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
1609
1803
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
1804
+ <xsl:attribute name="text-align">center</xsl:attribute>
1610
1805
 
1611
1806
  </xsl:attribute-set> <!-- table-header-cell-style -->
1612
1807
 
@@ -1686,16 +1881,24 @@
1686
1881
  <!-- ========================== -->
1687
1882
  <!-- Definition's list styles -->
1688
1883
  <!-- ========================== -->
1884
+
1885
+ <xsl:attribute-set name="dl-block-style">
1886
+
1887
+ </xsl:attribute-set>
1888
+
1689
1889
  <xsl:attribute-set name="dt-row-style">
1690
1890
 
1691
1891
  </xsl:attribute-set>
1692
1892
 
1693
1893
  <xsl:attribute-set name="dt-cell-style">
1894
+
1694
1895
  </xsl:attribute-set>
1695
1896
 
1696
1897
  <xsl:attribute-set name="dt-block-style">
1697
1898
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1698
1899
 
1900
+ <xsl:attribute name="line-height">1.5</xsl:attribute>
1901
+
1699
1902
  </xsl:attribute-set>
1700
1903
 
1701
1904
  <xsl:attribute-set name="dl-name-style">
@@ -1706,6 +1909,7 @@
1706
1909
 
1707
1910
  <xsl:attribute-set name="dd-cell-style">
1708
1911
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1912
+
1709
1913
  </xsl:attribute-set>
1710
1914
 
1711
1915
  <!-- ========================== -->
@@ -1721,6 +1925,9 @@
1721
1925
  </xsl:attribute-set>
1722
1926
 
1723
1927
  <xsl:attribute-set name="xref-style">
1928
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1929
+
1930
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
1724
1931
 
1725
1932
  </xsl:attribute-set>
1726
1933
 
@@ -1755,6 +1962,10 @@
1755
1962
 
1756
1963
  <xsl:attribute-set name="termnote-style">
1757
1964
 
1965
+ <xsl:attribute name="text-indent">0mm</xsl:attribute>
1966
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
1967
+ <xsl:attribute name="space-after">4pt</xsl:attribute>
1968
+
1758
1969
  </xsl:attribute-set>
1759
1970
 
1760
1971
  <xsl:attribute-set name="termnote-name-style">
@@ -1817,6 +2028,16 @@
1817
2028
 
1818
2029
  <xsl:attribute-set name="figure-name-style">
1819
2030
 
2031
+ <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
2032
+ <xsl:attribute name="text-align">center</xsl:attribute>
2033
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2034
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2035
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2036
+
2037
+ </xsl:attribute-set>
2038
+
2039
+ <xsl:attribute-set name="figure-source-style">
2040
+
1820
2041
  </xsl:attribute-set>
1821
2042
 
1822
2043
  <!-- Formula's styles -->
@@ -1935,6 +2156,7 @@
1935
2156
  <xsl:attribute-set name="list-style">
1936
2157
 
1937
2158
  <xsl:attribute name="provisional-distance-between-starts">7.5mm</xsl:attribute>
2159
+ <xsl:attribute name="space-after">4pt</xsl:attribute>
1938
2160
 
1939
2161
  </xsl:attribute-set> <!-- list-style -->
1940
2162
 
@@ -2331,7 +2553,7 @@
2331
2553
 
2332
2554
  <xsl:template name="processTables_Contents">
2333
2555
  <tables>
2334
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2556
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2335
2557
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2336
2558
  <xsl:copy-of select="*[local-name() = 'name']"/>
2337
2559
  </table>
@@ -2655,6 +2877,10 @@
2655
2877
 
2656
2878
  <xsl:call-template name="setBordersTableArray"/>
2657
2879
 
2880
+ <xsl:if test="ancestor::*[local-name()='preface']">
2881
+ <xsl:attribute name="border">none</xsl:attribute>
2882
+ </xsl:if>
2883
+
2658
2884
  </xsl:element>
2659
2885
  </xsl:variable>
2660
2886
 
@@ -2675,7 +2901,7 @@
2675
2901
  </xsl:attribute>
2676
2902
  </xsl:for-each>
2677
2903
 
2678
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2904
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2679
2905
  <xsl:if test="$isNoteOrFnExist = 'true'">
2680
2906
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2681
2907
  </xsl:if>
@@ -2719,7 +2945,7 @@
2719
2945
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2720
2946
  </xsl:when>
2721
2947
  <xsl:otherwise>
2722
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2948
+ <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 -->
2723
2949
  </xsl:otherwise>
2724
2950
  </xsl:choose>
2725
2951
 
@@ -2803,6 +3029,11 @@
2803
3029
  </xsl:if>
2804
3030
  </xsl:template> <!-- table/name -->
2805
3031
 
3032
+ <!-- SOURCE: ... -->
3033
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3034
+ <xsl:call-template name="termsource"/>
3035
+ </xsl:template>
3036
+
2806
3037
  <xsl:template name="calculate-columns-numbers">
2807
3038
  <xsl:param name="table-row"/>
2808
3039
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3159,7 +3390,7 @@
3159
3390
  </fo:table-header>
3160
3391
  </xsl:template> <!-- thead -->
3161
3392
 
3162
- <!-- template is using for iso, jcgm, bsi only -->
3393
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3163
3394
  <xsl:template name="table-header-title">
3164
3395
  <xsl:param name="cols-count"/>
3165
3396
  <!-- row for title -->
@@ -3202,7 +3433,7 @@
3202
3433
  <xsl:param name="colwidths"/>
3203
3434
  <xsl:param name="colgroup"/>
3204
3435
 
3205
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3436
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3206
3437
 
3207
3438
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3208
3439
 
@@ -3272,6 +3503,7 @@
3272
3503
 
3273
3504
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3274
3505
  <xsl:apply-templates select="../*[local-name()='note']"/>
3506
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3275
3507
 
3276
3508
  <xsl:variable name="isDisplayRowSeparator">
3277
3509
 
@@ -3402,6 +3634,11 @@
3402
3634
 
3403
3635
  <xsl:call-template name="setBordersTableArray"/>
3404
3636
 
3637
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
3638
+ <xsl:attribute name="border-top">none</xsl:attribute>
3639
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
3640
+ </xsl:if>
3641
+
3405
3642
  <xsl:call-template name="setTableRowAttributes"/>
3406
3643
 
3407
3644
  <xsl:apply-templates/>
@@ -3468,8 +3705,14 @@
3468
3705
  <xsl:with-param name="default">center</xsl:with-param>
3469
3706
  </xsl:call-template>
3470
3707
 
3708
+ <xsl:attribute name="text-align">center</xsl:attribute>
3709
+
3471
3710
  <xsl:call-template name="setBordersTableArray"/>
3472
3711
 
3712
+ <xsl:if test="ancestor::*[local-name()='preface']">
3713
+ <xsl:attribute name="border">none</xsl:attribute>
3714
+ </xsl:if>
3715
+
3473
3716
  <xsl:if test="$lang = 'ar'">
3474
3717
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3475
3718
  </xsl:if>
@@ -3524,6 +3767,10 @@
3524
3767
 
3525
3768
  <xsl:call-template name="setBordersTableArray"/>
3526
3769
 
3770
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
3771
+ <xsl:attribute name="border">none</xsl:attribute>
3772
+ </xsl:if>
3773
+
3527
3774
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3528
3775
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3529
3776
  </xsl:if>
@@ -3630,9 +3877,13 @@
3630
3877
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3631
3878
  </xsl:if>
3632
3879
 
3633
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3634
- <xsl:value-of select="$current_fn_number_text"/>
3635
- </fo:basic-link>
3880
+ <xsl:call-template name="insert_basic_link">
3881
+ <xsl:with-param name="element">
3882
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3883
+ <xsl:value-of select="$current_fn_number_text"/>
3884
+ </fo:basic-link>
3885
+ </xsl:with-param>
3886
+ </xsl:call-template>
3636
3887
  </fo:inline>
3637
3888
  </xsl:variable>
3638
3889
 
@@ -3721,7 +3972,11 @@
3721
3972
  <fo:list-item>
3722
3973
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
3723
3974
  <fo:block>
3724
- <fo:inline font-size="9pt" font-family="IPAexGothic">注</fo:inline>
3975
+ <fo:inline font-size="9pt" font-family="IPAexGothic">
3976
+ <xsl:call-template name="getLocalizedString">
3977
+ <xsl:with-param name="key">table_footnote</xsl:with-param>
3978
+ </xsl:call-template>
3979
+ </fo:inline>
3725
3980
  <xsl:text> </xsl:text>
3726
3981
  <fo:inline xsl:use-attribute-sets="table-fn-number-style">
3727
3982
  <xsl:value-of select="@reference"/>
@@ -3914,7 +4169,7 @@
3914
4169
  <xsl:variable name="isAdded" select="@added"/>
3915
4170
  <xsl:variable name="isDeleted" select="@deleted"/>
3916
4171
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3917
- <fo:block-container>
4172
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3918
4173
 
3919
4174
  <xsl:call-template name="setBlockSpanAll"/>
3920
4175
 
@@ -3922,6 +4177,18 @@
3922
4177
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3923
4178
  </xsl:if>
3924
4179
 
4180
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
4181
+ <!-- set font-size as sourcecode font-size -->
4182
+ <xsl:variable name="sourcecode_attributes">
4183
+ <xsl:call-template name="get_sourcecode_attributes"/>
4184
+ </xsl:variable>
4185
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
4186
+ <xsl:attribute name="{local-name()}">
4187
+ <xsl:value-of select="."/>
4188
+ </xsl:attribute>
4189
+ </xsl:for-each>
4190
+ </xsl:if>
4191
+
3925
4192
  <xsl:if test="parent::*[local-name() = 'note']">
3926
4193
  <xsl:attribute name="margin-left">
3927
4194
  <xsl:choose>
@@ -3963,8 +4230,10 @@
3963
4230
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3964
4231
  <xsl:text> </xsl:text>
3965
4232
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3966
- <xsl:text/>
3967
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
4233
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
4234
+ <xsl:text> </xsl:text>
4235
+ </xsl:if>
4236
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3968
4237
  </fo:block>
3969
4238
 
3970
4239
  </xsl:when> <!-- END: only one component -->
@@ -4355,6 +4624,7 @@
4355
4624
  <xsl:param name="split_keep-within-line"/>
4356
4625
 
4357
4626
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4627
+
4358
4628
  <xsl:call-template name="insert_dt_cell">
4359
4629
  <xsl:with-param name="key_iso" select="$key_iso"/>
4360
4630
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4376,6 +4646,7 @@
4376
4646
  <!-- border is mandatory, to calculate real width -->
4377
4647
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4378
4648
  <xsl:attribute name="text-align">left</xsl:attribute>
4649
+
4379
4650
  </xsl:if>
4380
4651
 
4381
4652
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4449,8 +4720,18 @@
4449
4720
  </xsl:if>
4450
4721
  </xsl:template>
4451
4722
 
4452
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4453
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4723
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4724
+ <xsl:variable name="is_inline_element_after_where">
4725
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4726
+ </xsl:variable>
4727
+ <xsl:choose>
4728
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4729
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4730
+ </xsl:when>
4731
+ <xsl:otherwise>
4732
+ <xsl:apply-templates select="."/>
4733
+ </xsl:otherwise>
4734
+ </xsl:choose>
4454
4735
  </xsl:template>
4455
4736
 
4456
4737
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4544,6 +4825,8 @@
4544
4825
  <xsl:param name="split_keep-within-line"/>
4545
4826
  <fo:inline font-weight="bold">
4546
4827
 
4828
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
4829
+
4547
4830
  <xsl:apply-templates>
4548
4831
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4549
4832
  </xsl:apply-templates>
@@ -4818,6 +5101,11 @@
4818
5101
  <fo:inline>
4819
5102
  <xsl:for-each select="$styles/style">
4820
5103
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5104
+
5105
+ <xsl:if test="@name = 'font-family' and . = 'MS Gothic'">
5106
+ <xsl:attribute name="{@name}">IPAexGothic</xsl:attribute>
5107
+ </xsl:if>
5108
+
4821
5109
  </xsl:for-each>
4822
5110
  <xsl:apply-templates/>
4823
5111
  </fo:inline>
@@ -5877,6 +6165,79 @@
5877
6165
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5878
6166
  </xsl:template>
5879
6167
 
6168
+ <!-- special case for:
6169
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
6170
+ <mstyle displaystyle="true">
6171
+ <msup>
6172
+ <mi color="#00000000">C</mi>
6173
+ <mtext>R</mtext>
6174
+ </msup>
6175
+ <msubsup>
6176
+ <mtext>C</mtext>
6177
+ <mi>n</mi>
6178
+ <mi>k</mi>
6179
+ </msubsup>
6180
+ </mstyle>
6181
+ </math>
6182
+ -->
6183
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
6184
+ <xsl:copy>
6185
+ <xsl:copy-of select="@*"/>
6186
+ <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"/>
6187
+ <xsl:if test="string-length($next_mtext) != ''">
6188
+ <xsl:attribute name="color">#00000000</xsl:attribute>
6189
+ </xsl:if>
6190
+ <xsl:apply-templates/>
6191
+ <xsl:value-of select="$next_mtext"/>
6192
+ </xsl:copy>
6193
+ </xsl:template>
6194
+
6195
+ <!-- special case for:
6196
+ <msup>
6197
+ <mtext/>
6198
+ <mn>1</mn>
6199
+ </msup>
6200
+ convert to (add mspace after mtext and enclose them into mrow):
6201
+ <msup>
6202
+ <mrow>
6203
+ <mtext/>
6204
+ <mspace height="1.47ex"/>
6205
+ </mrow>
6206
+ <mn>1</mn>
6207
+ </msup>
6208
+ -->
6209
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
6210
+ <mathml:mrow>
6211
+ <xsl:copy-of select="."/>
6212
+ <mathml:mspace height="1.47ex"/>
6213
+ </mathml:mrow>
6214
+ </xsl:template>
6215
+
6216
+ <!-- add space around vertical line -->
6217
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
6218
+ <xsl:copy>
6219
+ <xsl:apply-templates select="@*" mode="mathml"/>
6220
+ <xsl:if test="not(@lspace)">
6221
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
6222
+ </xsl:if>
6223
+ <xsl:if test="not(@rspace)">
6224
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
6225
+ </xsl:if>
6226
+ <xsl:apply-templates mode="mathml"/>
6227
+ </xsl:copy>
6228
+ </xsl:template>
6229
+
6230
+ <!-- decrease fontsize for 'Circled Times' char -->
6231
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
6232
+ <xsl:copy>
6233
+ <xsl:apply-templates select="@*" mode="mathml"/>
6234
+ <xsl:if test="not(@fontsize)">
6235
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
6236
+ </xsl:if>
6237
+ <xsl:apply-templates mode="mathml"/>
6238
+ </xsl:copy>
6239
+ </xsl:template>
6240
+
5880
6241
  <!-- Examples:
5881
6242
  <stem type="AsciiMath">x = 1</stem>
5882
6243
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5934,19 +6295,23 @@
5934
6295
  <xsl:apply-templates/>
5935
6296
  </xsl:when>
5936
6297
  <xsl:otherwise>
5937
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5938
- <xsl:choose>
5939
- <xsl:when test="normalize-space(.) = ''">
5940
- <xsl:call-template name="add-zero-spaces-link-java">
5941
- <xsl:with-param name="text" select="$target_text"/>
5942
- </xsl:call-template>
5943
- </xsl:when>
5944
- <xsl:otherwise>
5945
- <!-- output text from <link>text</link> -->
5946
- <xsl:apply-templates/>
5947
- </xsl:otherwise>
5948
- </xsl:choose>
5949
- </fo:basic-link>
6298
+ <xsl:call-template name="insert_basic_link">
6299
+ <xsl:with-param name="element">
6300
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6301
+ <xsl:choose>
6302
+ <xsl:when test="normalize-space(.) = ''">
6303
+ <xsl:call-template name="add-zero-spaces-link-java">
6304
+ <xsl:with-param name="text" select="$target_text"/>
6305
+ </xsl:call-template>
6306
+ </xsl:when>
6307
+ <xsl:otherwise>
6308
+ <!-- output text from <link>text</link> -->
6309
+ <xsl:apply-templates/>
6310
+ </xsl:otherwise>
6311
+ </xsl:choose>
6312
+ </fo:basic-link>
6313
+ </xsl:with-param>
6314
+ </xsl:call-template>
5950
6315
  </xsl:otherwise>
5951
6316
  </xsl:choose>
5952
6317
  </fo:inline>
@@ -6009,12 +6374,16 @@
6009
6374
  </xsl:template>
6010
6375
 
6011
6376
  <xsl:template match="*[local-name() = 'xref']">
6012
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6013
- <xsl:if test="parent::*[local-name() = 'add']">
6014
- <xsl:call-template name="append_add-style"/>
6015
- </xsl:if>
6016
- <xsl:apply-templates/>
6017
- </fo:basic-link>
6377
+ <xsl:call-template name="insert_basic_link">
6378
+ <xsl:with-param name="element">
6379
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6380
+ <xsl:if test="parent::*[local-name() = 'add']">
6381
+ <xsl:call-template name="append_add-style"/>
6382
+ </xsl:if>
6383
+ <xsl:apply-templates/>
6384
+ </fo:basic-link>
6385
+ </xsl:with-param>
6386
+ </xsl:call-template>
6018
6387
  </xsl:template>
6019
6388
 
6020
6389
  <!-- ====== -->
@@ -6112,7 +6481,14 @@
6112
6481
 
6113
6482
  <fo:block-container margin-left="0mm" margin-right="0mm">
6114
6483
 
6115
- <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
6484
+ <fo:list-block>
6485
+ <xsl:attribute name="provisional-distance-between-starts">
6486
+ <xsl:choose>
6487
+ <!-- if last char is digit -->
6488
+ <xsl:when test="translate(substring(*[local-name() = 'name'], string-length(*[local-name() = 'name'])),'0123456789','') = ''"><xsl:value-of select="14 + $text_indent"/>mm</xsl:when>
6489
+ <xsl:otherwise><xsl:value-of select="10 + $text_indent"/>mm</xsl:otherwise>
6490
+ </xsl:choose>
6491
+ </xsl:attribute>
6116
6492
  <fo:list-item>
6117
6493
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
6118
6494
  <fo:block xsl:use-attribute-sets="note-name-style">
@@ -6307,6 +6683,13 @@
6307
6683
  </fo:block>
6308
6684
  </xsl:template>
6309
6685
 
6686
+ <!-- SOURCE: ... -->
6687
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6688
+
6689
+ <xsl:call-template name="termsource"/>
6690
+
6691
+ </xsl:template>
6692
+
6310
6693
  <xsl:template match="*[local-name() = 'image']">
6311
6694
  <xsl:variable name="isAdded" select="../@added"/>
6312
6695
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -6380,7 +6763,7 @@
6380
6763
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6381
6764
  </xsl:when>
6382
6765
  <xsl:when test="not(starts-with(@src, 'data:'))">
6383
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6766
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6384
6767
  </xsl:when>
6385
6768
  <xsl:otherwise>
6386
6769
  <xsl:value-of select="@src"/>
@@ -6402,7 +6785,7 @@
6402
6785
  </xsl:when>
6403
6786
  <xsl:when test="not(starts-with(@src, 'data:'))">
6404
6787
  <xsl:variable name="src">
6405
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6788
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6406
6789
  </xsl:variable>
6407
6790
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6408
6791
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6788,15 +7171,19 @@
6788
7171
  <xsl:param name="dest"/>
6789
7172
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6790
7173
  <fo:block font-size="1pt">
6791
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6792
- <fo:inline-container inline-progression-dimension="100%">
6793
- <fo:block-container height="{$height - 1}px" width="100%">
6794
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6795
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6796
- </xsl:if> -->
6797
- <fo:block> </fo:block></fo:block-container>
6798
- </fo:inline-container>
6799
- </fo:basic-link>
7174
+ <xsl:call-template name="insert_basic_link">
7175
+ <xsl:with-param name="element">
7176
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
7177
+ <fo:inline-container inline-progression-dimension="100%">
7178
+ <fo:block-container height="{$height - 1}px" width="100%">
7179
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
7180
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
7181
+ </xsl:if> -->
7182
+ <fo:block> </fo:block></fo:block-container>
7183
+ </fo:inline-container>
7184
+ </fo:basic-link>
7185
+ </xsl:with-param>
7186
+ </xsl:call-template>
6800
7187
  </fo:block>
6801
7188
  </fo:block-container>
6802
7189
  </xsl:template>
@@ -7167,6 +7554,11 @@
7167
7554
  <xsl:if test="normalize-space() != ''">
7168
7555
  <fo:block xsl:use-attribute-sets="figure-name-style">
7169
7556
 
7557
+ <xsl:if test="ancestor::jis:figure">
7558
+ <xsl:attribute name="margin-top">0</xsl:attribute>
7559
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
7560
+ </xsl:if>
7561
+
7170
7562
  <xsl:apply-templates/>
7171
7563
  </fo:block>
7172
7564
  </xsl:if>
@@ -7436,9 +7828,11 @@
7436
7828
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7437
7829
  </xsl:if>
7438
7830
 
7439
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7831
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7440
7832
  </fo:block>
7441
7833
 
7834
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7835
+
7442
7836
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7443
7837
 
7444
7838
  </fo:block-container>
@@ -7470,11 +7864,22 @@
7470
7864
  <!-- add sourcecode highlighting -->
7471
7865
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7472
7866
  <xsl:variable name="class" select="@class"/>
7867
+
7868
+ <!-- Example: <1> -->
7869
+ <xsl:variable name="is_callout">
7870
+ <xsl:if test="parent::*[local-name() = 'dt']">
7871
+ <xsl:variable name="dt_id" select="../@id"/>
7872
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7873
+ </xsl:if>
7874
+ </xsl:variable>
7875
+
7473
7876
  <xsl:choose>
7474
7877
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7475
7878
  <fo:inline>
7476
7879
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7880
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7477
7881
  <xsl:apply-templates/>
7882
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7478
7883
  </fo:inline>
7479
7884
  </xsl:when>
7480
7885
  <xsl:otherwise>
@@ -7898,6 +8303,10 @@
7898
8303
  </fo:block>
7899
8304
  </xsl:template>
7900
8305
 
8306
+ <xsl:template match="*[local-name() = 'div']">
8307
+ <fo:block><xsl:apply-templates/></fo:block>
8308
+ </xsl:template>
8309
+
7901
8310
  <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
7902
8311
  <fo:block xsl:use-attribute-sets="inherit-style">
7903
8312
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8323,14 +8732,18 @@
8323
8732
  </xsl:template>
8324
8733
 
8325
8734
  <xsl:template match="*[local-name() = 'origin']">
8326
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8327
- <xsl:if test="normalize-space(@citeas) = ''">
8328
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8329
- </xsl:if>
8330
- <fo:inline xsl:use-attribute-sets="origin-style">
8331
- <xsl:apply-templates/>
8332
- </fo:inline>
8333
- </fo:basic-link>
8735
+ <xsl:call-template name="insert_basic_link">
8736
+ <xsl:with-param name="element">
8737
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8738
+ <xsl:if test="normalize-space(@citeas) = ''">
8739
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8740
+ </xsl:if>
8741
+ <fo:inline xsl:use-attribute-sets="origin-style">
8742
+ <xsl:apply-templates/>
8743
+ </fo:inline>
8744
+ </fo:basic-link>
8745
+ </xsl:with-param>
8746
+ </xsl:call-template>
8334
8747
  </xsl:template>
8335
8748
 
8336
8749
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8404,9 +8817,13 @@
8404
8817
  <xsl:if test="../*[local-name() = 'author']">
8405
8818
  <xsl:text>, </xsl:text>
8406
8819
  </xsl:if>
8407
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8408
- <xsl:apply-templates/>
8409
- </fo:basic-link>
8820
+ <xsl:call-template name="insert_basic_link">
8821
+ <xsl:with-param name="element">
8822
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8823
+ <xsl:apply-templates/>
8824
+ </fo:basic-link>
8825
+ </xsl:with-param>
8826
+ </xsl:call-template>
8410
8827
  </xsl:template>
8411
8828
 
8412
8829
  <xsl:template match="*[local-name() = 'author']">
@@ -8455,25 +8872,29 @@
8455
8872
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8456
8873
  <xsl:variable name="text" select="normalize-space()"/>
8457
8874
 
8458
- <fo:basic-link fox:alt-text="{@citeas}">
8459
- <xsl:if test="normalize-space(@citeas) = ''">
8460
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8461
- </xsl:if>
8462
- <xsl:if test="@type = 'inline'">
8875
+ <xsl:call-template name="insert_basic_link">
8876
+ <xsl:with-param name="element">
8877
+ <fo:basic-link fox:alt-text="{@citeas}">
8878
+ <xsl:if test="normalize-space(@citeas) = ''">
8879
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8880
+ </xsl:if>
8881
+ <xsl:if test="@type = 'inline'">
8463
8882
 
8464
- </xsl:if>
8883
+ </xsl:if>
8465
8884
 
8466
- <xsl:choose>
8467
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8468
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8469
- </xsl:when>
8470
- <xsl:otherwise>
8471
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8472
- </xsl:otherwise>
8473
- </xsl:choose>
8885
+ <xsl:choose>
8886
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8887
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8888
+ </xsl:when>
8889
+ <xsl:otherwise>
8890
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8891
+ </xsl:otherwise>
8892
+ </xsl:choose>
8474
8893
 
8475
- <xsl:apply-templates/>
8476
- </fo:basic-link>
8894
+ <xsl:apply-templates/>
8895
+ </fo:basic-link>
8896
+ </xsl:with-param>
8897
+ </xsl:call-template>
8477
8898
 
8478
8899
  </fo:inline>
8479
8900
  </xsl:when>
@@ -8584,13 +9005,8 @@
8584
9005
  </xsl:template>
8585
9006
 
8586
9007
  <xsl:template match="*[local-name() = 'deprecates']">
8587
- <xsl:variable name="title-deprecated">
8588
- <xsl:call-template name="getLocalizedString">
8589
- <xsl:with-param name="key">deprecated</xsl:with-param>
8590
- </xsl:call-template>
8591
- </xsl:variable>
8592
9008
  <fo:block xsl:use-attribute-sets="deprecates-style">
8593
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
9009
+ <xsl:apply-templates/>
8594
9010
  </fo:block>
8595
9011
  </xsl:template>
8596
9012
 
@@ -8702,15 +9118,17 @@
8702
9118
  <!-- ===================================== -->
8703
9119
  <xsl:variable name="ul_labels_">
8704
9120
 
8705
- <label level="1">–</label>
8706
- <label level="2">•</label>
8707
- <label level="3" font-size="75%">o</label> <!-- white circle -->
9121
+ <label level="1">-</label> <!-- full-width hyphen minus -->
9122
+ <label level="2" font-size="130%" line-height="1.2">・</label> <!-- Katakana Middle Dot -->
8708
9123
 
8709
9124
  </xsl:variable>
8710
9125
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8711
9126
 
8712
9127
  <xsl:template name="setULLabel">
8713
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9128
+ <xsl:variable name="list_level__">
9129
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul'])"/>
9130
+ </xsl:variable>
9131
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8714
9132
  <xsl:variable name="list_level">
8715
9133
  <xsl:choose>
8716
9134
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8843,9 +9261,18 @@
8843
9261
  </fo:block-container>
8844
9262
  </xsl:when>
8845
9263
  <xsl:otherwise>
8846
- <fo:block>
8847
- <xsl:apply-templates select="." mode="list"/>
8848
- </fo:block>
9264
+
9265
+ <fo:block-container>
9266
+ <xsl:if test="ancestor::jis:ol or ancestor::jis:ul">
9267
+ <xsl:attribute name="margin-left">3.5mm</xsl:attribute>
9268
+ </xsl:if>
9269
+ <fo:block-container margin-left="0mm">
9270
+ <fo:block>
9271
+ <xsl:apply-templates select="." mode="list"/>
9272
+ </fo:block>
9273
+ </fo:block-container>
9274
+ </fo:block-container>
9275
+
8849
9276
  </xsl:otherwise>
8850
9277
  </xsl:choose>
8851
9278
  </xsl:template>
@@ -9537,24 +9964,32 @@
9537
9964
  <xsl:for-each select="*[local-name() = 'tab']">
9538
9965
  <xsl:variable name="current_id" select="generate-id()"/>
9539
9966
  <fo:table-cell>
9540
- <fo:block>
9541
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9542
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9543
- <xsl:choose>
9544
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9545
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9546
- </xsl:choose>
9547
- </xsl:for-each>
9548
- </fo:basic-link>
9967
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9968
+ <xsl:call-template name="insert_basic_link">
9969
+ <xsl:with-param name="element">
9970
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9971
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9972
+ <xsl:choose>
9973
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9974
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9975
+ </xsl:choose>
9976
+ </xsl:for-each>
9977
+ </fo:basic-link>
9978
+ </xsl:with-param>
9979
+ </xsl:call-template>
9549
9980
  </fo:block>
9550
9981
  </fo:table-cell>
9551
9982
  </xsl:for-each>
9552
9983
  <!-- last column - for page numbers -->
9553
9984
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9554
9985
  <fo:block>
9555
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9556
- <fo:page-number-citation ref-id="{$target}"/>
9557
- </fo:basic-link>
9986
+ <xsl:call-template name="insert_basic_link">
9987
+ <xsl:with-param name="element">
9988
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9989
+ <fo:page-number-citation ref-id="{$target}"/>
9990
+ </fo:basic-link>
9991
+ </xsl:with-param>
9992
+ </xsl:call-template>
9558
9993
  </fo:block>
9559
9994
  </fo:table-cell>
9560
9995
  </xsl:template>
@@ -9596,6 +10031,27 @@
9596
10031
  <!-- End Table of Contents (ToC) processing -->
9597
10032
  <!-- =================== -->
9598
10033
 
10034
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
10035
+ <xsl:template name="insert_basic_link">
10036
+ <xsl:param name="element"/>
10037
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
10038
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
10039
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
10040
+ <xsl:choose>
10041
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
10042
+ <xsl:copy-of select="$element_node"/>
10043
+ </xsl:when>
10044
+ <xsl:otherwise>
10045
+ <fo:inline>
10046
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
10047
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
10048
+ </xsl:for-each>
10049
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
10050
+ </fo:inline>
10051
+ </xsl:otherwise>
10052
+ </xsl:choose>
10053
+ </xsl:template>
10054
+
9599
10055
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9600
10056
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9601
10057
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9817,6 +10273,23 @@
9817
10273
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9818
10274
  <xsl:copy-of select="."/>
9819
10275
  </xsl:template>
10276
+
10277
+ <!-- add @id, redundant for table auto-layout algorithm -->
10278
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
10279
+ <xsl:copy>
10280
+ <xsl:copy-of select="@*"/>
10281
+ <xsl:call-template name="add_id"/>
10282
+ <xsl:apply-templates mode="update_xml_step1"/>
10283
+ </xsl:copy>
10284
+ </xsl:template>
10285
+
10286
+ <xsl:template name="add_id">
10287
+ <xsl:if test="not(@id)">
10288
+ <!-- add @id - first element with @id plus '_element_name' -->
10289
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
10290
+ </xsl:if>
10291
+ </xsl:template>
10292
+
9820
10293
  <!-- =========================================================================== -->
9821
10294
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9822
10295
  <!-- =========================================================================== -->