metanorma-jis 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -272,7 +272,7 @@
272
272
  <xsl:variable name="paged_xml_preface" select="xalan:nodeset($paged_xml_preface_)"/>
273
273
 
274
274
  <xsl:if test="$paged_xml_preface/*[local-name()='page'] and count($paged_xml_preface/*[local-name()='page']/*) != 0">
275
- <!-- BSI Preface pages -->
275
+ <!-- Preface pages -->
276
276
  <fo:page-sequence master-reference="document_preface" force-page-count="no-force">
277
277
 
278
278
  <fo:static-content flow-name="xsl-footnote-separator">
@@ -298,7 +298,7 @@
298
298
  </xsl:for-each>
299
299
  </fo:block>
300
300
  </fo:flow>
301
- </fo:page-sequence> <!-- END BSI Preface pages -->
301
+ </fo:page-sequence> <!-- END Preface pages -->
302
302
  </xsl:if>
303
303
 
304
304
  <!-- Document type rendering -->
@@ -467,6 +467,12 @@
467
467
  </fo:root>
468
468
  </xsl:template>
469
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
+
470
476
  <xsl:template match="*[local-name() = 'colon_gothic']">
471
477
  <!-- replace : to : (Fullwidth colon) and render it in the font IPAexGothic -->
472
478
  <fo:inline font-family="IPAexGothic">:</fo:inline>
@@ -941,7 +947,7 @@
941
947
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
942
948
  </xsl:if>
943
949
 
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]">
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">
945
951
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
946
952
  </xsl:if>
947
953
 
@@ -989,6 +995,109 @@
989
995
  </fo:block>
990
996
  </xsl:template>
991
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
+
992
1101
  <xsl:template name="makePagedXML">
993
1102
  <xsl:param name="structured_xml"/>
994
1103
  <xsl:choose>
@@ -1062,6 +1171,18 @@
1062
1171
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1063
1172
  </xsl:template>
1064
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
+
1065
1186
  <!-- move example title to the first paragraph -->
1066
1187
  <xsl:template match="jis:example[contains(jis:name/text(), ' — ')]" mode="update_xml_step1">
1067
1188
  <xsl:copy>
@@ -1615,6 +1736,10 @@
1615
1736
 
1616
1737
  </xsl:attribute-set>
1617
1738
 
1739
+ <xsl:template name="refine_link-style">
1740
+
1741
+ </xsl:template> <!-- refine_link-style -->
1742
+
1618
1743
  <xsl:attribute-set name="sourcecode-container-style">
1619
1744
 
1620
1745
  </xsl:attribute-set>
@@ -1626,6 +1751,10 @@
1626
1751
 
1627
1752
  </xsl:attribute-set>
1628
1753
 
1754
+ <xsl:template name="refine_sourcecode-style">
1755
+
1756
+ </xsl:template> <!-- refine_sourcecode-style -->
1757
+
1629
1758
  <xsl:attribute-set name="pre-style">
1630
1759
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
1631
1760
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1707,6 +1836,10 @@
1707
1836
 
1708
1837
  </xsl:attribute-set> <!-- example-style -->
1709
1838
 
1839
+ <xsl:template name="refine_example-style">
1840
+
1841
+ </xsl:template> <!-- refine_example-style -->
1842
+
1710
1843
  <xsl:attribute-set name="example-body-style">
1711
1844
 
1712
1845
  </xsl:attribute-set> <!-- example-body-style -->
@@ -1723,6 +1856,10 @@
1723
1856
 
1724
1857
  </xsl:attribute-set> <!-- example-p-style -->
1725
1858
 
1859
+ <xsl:template name="refine_example-p-style">
1860
+
1861
+ </xsl:template> <!-- refine_example-p-style -->
1862
+
1726
1863
  <xsl:attribute-set name="termexample-name-style">
1727
1864
 
1728
1865
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
@@ -1751,6 +1888,12 @@
1751
1888
 
1752
1889
  </xsl:attribute-set> <!-- table-container-style -->
1753
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
+
1754
1897
  <xsl:attribute-set name="table-style">
1755
1898
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
1756
1899
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
@@ -1759,6 +1902,17 @@
1759
1902
 
1760
1903
  </xsl:attribute-set><!-- table-style -->
1761
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
+
1762
1916
  <xsl:attribute-set name="table-name-style">
1763
1917
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1764
1918
 
@@ -1768,6 +1922,11 @@
1768
1922
 
1769
1923
  </xsl:attribute-set> <!-- table-name-style -->
1770
1924
 
1925
+ <xsl:template name="refine_table-name-style">
1926
+ <xsl:param name="continued"/>
1927
+
1928
+ </xsl:template> <!-- refine_table-name-style -->
1929
+
1771
1930
  <xsl:attribute-set name="table-row-style">
1772
1931
  <xsl:attribute name="min-height">4mm</xsl:attribute>
1773
1932
 
@@ -1781,6 +1940,17 @@
1781
1940
 
1782
1941
  </xsl:attribute-set>
1783
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
+
1784
1954
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
1785
1955
 
1786
1956
  <xsl:attribute name="border-left"><xsl:value-of select="$table-border"/></xsl:attribute>
@@ -1788,10 +1958,20 @@
1788
1958
 
1789
1959
  </xsl:attribute-set>
1790
1960
 
1961
+ <xsl:template name="refine_table-footer-row-style">
1962
+
1963
+ </xsl:template> <!-- refine_table-footer-row-style -->
1964
+
1791
1965
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
1792
1966
 
1793
1967
  </xsl:attribute-set>
1794
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
+
1795
1975
  <xsl:attribute-set name="table-header-cell-style">
1796
1976
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1797
1977
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1805,6 +1985,24 @@
1805
1985
 
1806
1986
  </xsl:attribute-set> <!-- table-header-cell-style -->
1807
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
+
1808
2006
  <xsl:attribute-set name="table-cell-style">
1809
2007
  <xsl:attribute name="display-align">center</xsl:attribute>
1810
2008
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1815,6 +2013,22 @@
1815
2013
 
1816
2014
  </xsl:attribute-set> <!-- table-cell-style -->
1817
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
+
1818
2032
  <xsl:attribute-set name="table-footer-cell-style">
1819
2033
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
1820
2034
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -1826,12 +2040,20 @@
1826
2040
 
1827
2041
  </xsl:attribute-set> <!-- table-footer-cell-style -->
1828
2042
 
2043
+ <xsl:template name="refine_table-footer-cell-style">
2044
+
2045
+ </xsl:template> <!-- refine_table-footer-cell-style -->
2046
+
1829
2047
  <xsl:attribute-set name="table-note-style">
1830
2048
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1831
2049
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1832
2050
 
1833
2051
  </xsl:attribute-set><!-- table-note-style -->
1834
2052
 
2053
+ <xsl:template name="refine_table-note-style">
2054
+
2055
+ </xsl:template> <!-- refine_table-note-style -->
2056
+
1835
2057
  <xsl:attribute-set name="table-fn-style">
1836
2058
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1837
2059
 
@@ -1894,6 +2116,10 @@
1894
2116
 
1895
2117
  </xsl:attribute-set>
1896
2118
 
2119
+ <xsl:template name="refine_dt-cell-style">
2120
+
2121
+ </xsl:template> <!-- refine_dt-cell-style -->
2122
+
1897
2123
  <xsl:attribute-set name="dt-block-style">
1898
2124
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1899
2125
 
@@ -1901,6 +2127,10 @@
1901
2127
 
1902
2128
  </xsl:attribute-set>
1903
2129
 
2130
+ <xsl:template name="refine_dt-block-style">
2131
+
2132
+ </xsl:template> <!-- refine_dt-block-style -->
2133
+
1904
2134
  <xsl:attribute-set name="dl-name-style">
1905
2135
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1906
2136
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -1912,6 +2142,10 @@
1912
2142
 
1913
2143
  </xsl:attribute-set>
1914
2144
 
2145
+ <xsl:template name="refine_dd-cell-style">
2146
+
2147
+ </xsl:template> <!-- refine_dd-cell-style -->
2148
+
1915
2149
  <!-- ========================== -->
1916
2150
  <!-- END Definition's list styles -->
1917
2151
  <!-- ========================== -->
@@ -1925,7 +2159,6 @@
1925
2159
  </xsl:attribute-set>
1926
2160
 
1927
2161
  <xsl:attribute-set name="xref-style">
1928
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1929
2162
 
1930
2163
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
1931
2164
 
@@ -1935,6 +2168,12 @@
1935
2168
 
1936
2169
  </xsl:attribute-set>
1937
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
+
1938
2177
  <xsl:attribute-set name="note-style">
1939
2178
 
1940
2179
  <xsl:attribute name="text-indent">0mm</xsl:attribute>
@@ -1942,6 +2181,10 @@
1942
2181
 
1943
2182
  </xsl:attribute-set>
1944
2183
 
2184
+ <xsl:template name="refine_note-style">
2185
+
2186
+ </xsl:template>
2187
+
1945
2188
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
1946
2189
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
1947
2190
 
@@ -1951,11 +2194,19 @@
1951
2194
 
1952
2195
  </xsl:attribute-set>
1953
2196
 
2197
+ <xsl:template name="refine_note-name-style">
2198
+
2199
+ </xsl:template> <!-- refine_note-name-style -->
2200
+
1954
2201
  <xsl:attribute-set name="table-note-name-style">
1955
2202
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
1956
2203
 
1957
2204
  </xsl:attribute-set>
1958
2205
 
2206
+ <xsl:template name="refine_table-note-name-style">
2207
+
2208
+ </xsl:template> <!-- refine_table-note-name-style -->
2209
+
1959
2210
  <xsl:attribute-set name="note-p-style">
1960
2211
 
1961
2212
  </xsl:attribute-set>
@@ -1968,12 +2219,20 @@
1968
2219
 
1969
2220
  </xsl:attribute-set>
1970
2221
 
2222
+ <xsl:template name="refine_termnote-style">
2223
+
2224
+ </xsl:template> <!-- refine_termnote-style -->
2225
+
1971
2226
  <xsl:attribute-set name="termnote-name-style">
1972
2227
 
1973
2228
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
1974
2229
 
1975
2230
  </xsl:attribute-set>
1976
2231
 
2232
+ <xsl:template name="refine_termnote-name-style">
2233
+
2234
+ </xsl:template>
2235
+
1977
2236
  <xsl:attribute-set name="termnote-p-style">
1978
2237
 
1979
2238
  </xsl:attribute-set>
@@ -1982,8 +2241,19 @@
1982
2241
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1983
2242
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
1984
2243
 
2244
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2245
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2246
+
1985
2247
  </xsl:attribute-set>
1986
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
+
1987
2257
  <xsl:attribute-set name="quote-source-style">
1988
2258
  <xsl:attribute name="text-align">right</xsl:attribute>
1989
2259
 
@@ -1995,6 +2265,10 @@
1995
2265
 
1996
2266
  </xsl:attribute-set>
1997
2267
 
2268
+ <xsl:template name="refine_termsource-style">
2269
+
2270
+ </xsl:template> <!-- refine_termsource-style -->
2271
+
1998
2272
  <xsl:attribute-set name="termsource-text-style">
1999
2273
 
2000
2274
  </xsl:attribute-set>
@@ -2036,6 +2310,15 @@
2036
2310
 
2037
2311
  </xsl:attribute-set>
2038
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
+
2039
2322
  <xsl:attribute-set name="figure-source-style">
2040
2323
 
2041
2324
  </xsl:attribute-set>
@@ -2052,6 +2335,10 @@
2052
2335
 
2053
2336
  </xsl:attribute-set> <!-- formula-stem-block-style -->
2054
2337
 
2338
+ <xsl:template name="refine_formula-stem-block-style">
2339
+
2340
+ </xsl:template> <!-- refine_formula-stem-block-style -->
2341
+
2055
2342
  <xsl:attribute-set name="formula-stem-number-style">
2056
2343
  <xsl:attribute name="text-align">right</xsl:attribute>
2057
2344
 
@@ -2063,6 +2350,10 @@
2063
2350
 
2064
2351
  </xsl:attribute-set>
2065
2352
 
2353
+ <xsl:template name="refine_image-style">
2354
+
2355
+ </xsl:template>
2356
+
2066
2357
  <xsl:attribute-set name="figure-pseudocode-p-style">
2067
2358
 
2068
2359
  </xsl:attribute-set>
@@ -2153,6 +2444,10 @@
2153
2444
 
2154
2445
  </xsl:attribute-set>
2155
2446
 
2447
+ <xsl:template name="refine_mathml-style">
2448
+
2449
+ </xsl:template>
2450
+
2156
2451
  <xsl:attribute-set name="list-style">
2157
2452
 
2158
2453
  <xsl:attribute name="provisional-distance-between-starts">7.5mm</xsl:attribute>
@@ -2160,6 +2455,10 @@
2160
2455
 
2161
2456
  </xsl:attribute-set> <!-- list-style -->
2162
2457
 
2458
+ <xsl:template name="refine_list-style">
2459
+
2460
+ </xsl:template> <!-- refine_list-style -->
2461
+
2163
2462
  <xsl:attribute-set name="list-name-style">
2164
2463
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2165
2464
 
@@ -2169,16 +2468,33 @@
2169
2468
 
2170
2469
  </xsl:attribute-set>
2171
2470
 
2471
+ <xsl:template name="refine_list-item-style">
2472
+
2473
+ </xsl:template> <!-- refine_list-item-style -->
2474
+
2172
2475
  <xsl:attribute-set name="list-item-label-style">
2173
2476
 
2174
2477
  <xsl:attribute name="line-height">1.5</xsl:attribute>
2175
2478
 
2176
2479
  </xsl:attribute-set>
2177
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
+
2178
2490
  <xsl:attribute-set name="list-item-body-style">
2179
2491
 
2180
2492
  </xsl:attribute-set>
2181
2493
 
2494
+ <xsl:template name="refine_list-item-body-style">
2495
+
2496
+ </xsl:template> <!-- refine_list-item-body-style -->
2497
+
2182
2498
  <xsl:attribute-set name="toc-style">
2183
2499
  <xsl:attribute name="line-height">135%</xsl:attribute>
2184
2500
  </xsl:attribute-set>
@@ -2194,6 +2510,10 @@
2194
2510
 
2195
2511
  </xsl:attribute-set>
2196
2512
 
2513
+ <xsl:template name="refine_fn-reference-style">
2514
+
2515
+ </xsl:template> <!-- refine_fn-reference-style -->
2516
+
2197
2517
  <xsl:attribute-set name="fn-style">
2198
2518
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2199
2519
  </xsl:attribute-set>
@@ -2216,6 +2536,12 @@
2216
2536
 
2217
2537
  </xsl:attribute-set>
2218
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
+
2219
2545
  <xsl:attribute-set name="fn-body-num-style">
2220
2546
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2221
2547
 
@@ -2226,6 +2552,10 @@
2226
2552
 
2227
2553
  </xsl:attribute-set> <!-- fn-body-num-style -->
2228
2554
 
2555
+ <xsl:template name="refine_fn-body-num-style">
2556
+
2557
+ </xsl:template> <!-- refine_fn-body-num-style -->
2558
+
2229
2559
  <!-- admonition -->
2230
2560
  <xsl:attribute-set name="admonition-style">
2231
2561
 
@@ -2293,6 +2623,11 @@
2293
2623
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2294
2624
  <xsl:attribute name="font-size">65%</xsl:attribute>
2295
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
+
2296
2631
  </xsl:attribute-set> <!-- bibitem-note-fn-style -->
2297
2632
 
2298
2633
  <!-- footnote number on the page bottom -->
@@ -2854,7 +3189,9 @@
2854
3189
 
2855
3190
  <fo:block-container xsl:use-attribute-sets="table-container-style">
2856
3191
 
2857
- <!-- 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>
2858
3195
 
2859
3196
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2860
3197
 
@@ -2875,11 +3212,9 @@
2875
3212
 
2876
3213
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2877
3214
 
2878
- <xsl:call-template name="setBordersTableArray"/>
2879
-
2880
- <xsl:if test="ancestor::*[local-name()='preface']">
2881
- <xsl:attribute name="border">none</xsl:attribute>
2882
- </xsl:if>
3215
+ <xsl:call-template name="refine_table-style">
3216
+ <xsl:with-param name="margin-side" select="$margin-side"/>
3217
+ </xsl:call-template>
2883
3218
 
2884
3219
  </xsl:element>
2885
3220
  </xsl:variable>
@@ -2945,7 +3280,7 @@
2945
3280
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2946
3281
  </xsl:when>
2947
3282
  <xsl:otherwise>
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 -->
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 -->
2949
3284
  </xsl:otherwise>
2950
3285
  </xsl:choose>
2951
3286
 
@@ -3015,6 +3350,10 @@
3015
3350
 
3016
3351
  <fo:block xsl:use-attribute-sets="table-name-style">
3017
3352
 
3353
+ <xsl:call-template name="refine_table-name-style">
3354
+ <xsl:with-param name="continued" select="$continued"/>
3355
+ </xsl:call-template>
3356
+
3018
3357
  <xsl:choose>
3019
3358
  <xsl:when test="$continued = 'true'">
3020
3359
 
@@ -3397,6 +3736,8 @@
3397
3736
  <fo:table-row>
3398
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">
3399
3738
 
3739
+ <xsl:call-template name="refine_table-header-title-style"/>
3740
+
3400
3741
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
3401
3742
  <xsl:with-param name="continued">true</xsl:with-param>
3402
3743
  </xsl:apply-templates>
@@ -3409,6 +3750,10 @@
3409
3750
  </fo:table-row>
3410
3751
  </xsl:template> <!-- table-header-title -->
3411
3752
 
3753
+ <xsl:template name="refine_table-header-title-style">
3754
+
3755
+ </xsl:template> <!-- refine_table-header-title-style -->
3756
+
3412
3757
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
3413
3758
  <fo:table-body>
3414
3759
  <xsl:apply-templates/>
@@ -3433,7 +3778,7 @@
3433
3778
  <xsl:param name="colwidths"/>
3434
3779
  <xsl:param name="colgroup"/>
3435
3780
 
3436
- <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']"/>
3437
3782
 
3438
3783
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3439
3784
 
@@ -3493,6 +3838,8 @@
3493
3838
  <fo:table-row>
3494
3839
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3495
3840
 
3841
+ <xsl:call-template name="refine_table-footer-cell-style"/>
3842
+
3496
3843
  <xsl:call-template name="setBordersTableArray"/>
3497
3844
 
3498
3845
  <!-- fn will be processed inside 'note' processing -->
@@ -3501,6 +3848,7 @@
3501
3848
 
3502
3849
  <!-- except gb and bsi -->
3503
3850
 
3851
+ <xsl:apply-templates select="../*[local-name()='p']"/>
3504
3852
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3505
3853
  <xsl:apply-templates select="../*[local-name()='note']"/>
3506
3854
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -3632,12 +3980,7 @@
3632
3980
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3633
3981
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3634
3982
 
3635
- <xsl:call-template name="setBordersTableArray"/>
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>
3983
+ <xsl:call-template name="refine_table-header-row-style"/>
3641
3984
 
3642
3985
  <xsl:call-template name="setTableRowAttributes"/>
3643
3986
 
@@ -3671,6 +4014,8 @@
3671
4014
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3672
4015
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3673
4016
 
4017
+ <xsl:call-template name="refine_table-footer-row-style"/>
4018
+
3674
4019
  <xsl:call-template name="setTableRowAttributes"/>
3675
4020
  <xsl:apply-templates/>
3676
4021
  </fo:table-row>
@@ -3684,9 +4029,10 @@
3684
4029
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3685
4030
  </xsl:if>
3686
4031
 
3687
- <xsl:call-template name="setBordersTableArray"/>
4032
+ <xsl:call-template name="refine_table-body-row-style"/>
3688
4033
 
3689
4034
  <xsl:call-template name="setTableRowAttributes"/>
4035
+
3690
4036
  <xsl:apply-templates/>
3691
4037
  </fo:table-row>
3692
4038
  </xsl:template>
@@ -3705,19 +4051,7 @@
3705
4051
  <xsl:with-param name="default">center</xsl:with-param>
3706
4052
  </xsl:call-template>
3707
4053
 
3708
- <xsl:attribute name="text-align">center</xsl:attribute>
3709
-
3710
- <xsl:call-template name="setBordersTableArray"/>
3711
-
3712
- <xsl:if test="ancestor::*[local-name()='preface']">
3713
- <xsl:attribute name="border">none</xsl:attribute>
3714
- </xsl:if>
3715
-
3716
- <xsl:if test="$lang = 'ar'">
3717
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3718
- </xsl:if>
3719
-
3720
- <xsl:call-template name="setTableCellAttributes"/>
4054
+ <xsl:call-template name="refine_table-header-cell-style"/>
3721
4055
 
3722
4056
  <fo:block>
3723
4057
  <xsl:apply-templates/>
@@ -3759,17 +4093,7 @@
3759
4093
  <xsl:with-param name="default">left</xsl:with-param>
3760
4094
  </xsl:call-template>
3761
4095
 
3762
- <xsl:if test="$lang = 'ar'">
3763
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
3764
- </xsl:if>
3765
-
3766
- <!-- bsi -->
3767
-
3768
- <xsl:call-template name="setBordersTableArray"/>
3769
-
3770
- <xsl:if test="ancestor::*[local-name() = 'preface']">
3771
- <xsl:attribute name="border">none</xsl:attribute>
3772
- </xsl:if>
4096
+ <xsl:call-template name="refine_table-cell-style"/>
3773
4097
 
3774
4098
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3775
4099
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -3800,9 +4124,13 @@
3800
4124
 
3801
4125
  <fo:block xsl:use-attribute-sets="table-note-style">
3802
4126
 
4127
+ <xsl:call-template name="refine_table-note-style"/>
4128
+
3803
4129
  <!-- Table's note name (NOTE, for example) -->
3804
4130
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
3805
4131
 
4132
+ <xsl:call-template name="refine_table-note-name-style"/>
4133
+
3806
4134
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3807
4135
 
3808
4136
  </fo:inline>
@@ -3830,6 +4158,14 @@
3830
4158
  <!-- list of footnotes to calculate actual footnotes number -->
3831
4159
  <xsl:variable name="p_fn_">
3832
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> -->
3833
4169
  </xsl:variable>
3834
4170
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3835
4171
 
@@ -3852,9 +4188,18 @@
3852
4188
  <xsl:variable name="current_fn_number_text">
3853
4189
  <xsl:value-of select="$current_fn_number"/>
3854
4190
 
4191
+ <fo:inline font-weight="normal">)</fo:inline>
4192
+
3855
4193
  </xsl:variable>
3856
4194
 
3857
- <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>
3858
4203
  <xsl:variable name="footnote_inline">
3859
4204
  <fo:inline>
3860
4205
 
@@ -3880,7 +4225,7 @@
3880
4225
  <xsl:call-template name="insert_basic_link">
3881
4226
  <xsl:with-param name="element">
3882
4227
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3883
- <xsl:value-of select="$current_fn_number_text"/>
4228
+ <xsl:copy-of select="$current_fn_number_text"/>
3884
4229
  </fo:basic-link>
3885
4230
  </xsl:with-param>
3886
4231
  </xsl:call-template>
@@ -3900,8 +4245,12 @@
3900
4245
 
3901
4246
  <fo:block xsl:use-attribute-sets="fn-body-style">
3902
4247
 
4248
+ <xsl:call-template name="refine_fn-body-style"/>
4249
+
3903
4250
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3904
4251
 
4252
+ <xsl:call-template name="refine_fn-body-num-style"/>
4253
+
3905
4254
  <xsl:value-of select="$current_fn_number_text"/>
3906
4255
  </fo:inline>
3907
4256
  <xsl:apply-templates/>
@@ -3953,6 +4302,28 @@
3953
4302
  </xsl:choose>
3954
4303
  </xsl:template>
3955
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>
3956
4327
  <!-- ============================ -->
3957
4328
  <!-- table's footnotes rendering -->
3958
4329
  <!-- ============================ -->
@@ -4139,6 +4510,8 @@
4139
4510
  <xsl:template match="*[local-name()='fn']">
4140
4511
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4141
4512
 
4513
+ <xsl:call-template name="refine_fn-reference-style"/>
4514
+
4142
4515
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4143
4516
 
4144
4517
  <xsl:value-of select="@reference"/>
@@ -4240,6 +4613,8 @@
4240
4613
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
4241
4614
  <fo:block margin-bottom="12pt" text-align="left">
4242
4615
 
4616
+ <xsl:call-template name="refine_dl_formula_where_style"/>
4617
+
4243
4618
  <!-- <xsl:variable name="title-where">
4244
4619
  <xsl:call-template name="getLocalizedString">
4245
4620
  <xsl:with-param name="key">where</xsl:with-param>
@@ -4253,6 +4628,8 @@
4253
4628
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
4254
4629
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
4255
4630
 
4631
+ <xsl:call-template name="refine_figure_key_style"/>
4632
+
4256
4633
  <xsl:variable name="title-key">
4257
4634
  <xsl:call-template name="getLocalizedString">
4258
4635
  <xsl:with-param name="key">key</xsl:with-param>
@@ -4267,12 +4644,16 @@
4267
4644
  <xsl:if test="$onlyOneComponent = 'false'">
4268
4645
  <fo:block>
4269
4646
 
4647
+ <xsl:call-template name="refine_multicomponent_style"/>
4648
+
4270
4649
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
4271
4650
  <xsl:attribute name="margin-top">0</xsl:attribute>
4272
4651
  </xsl:if>
4273
4652
 
4274
4653
  <fo:block>
4275
4654
 
4655
+ <xsl:call-template name="refine_multicomponent_block_style"/>
4656
+
4276
4657
  <xsl:apply-templates select="*[local-name() = 'name']">
4277
4658
  <xsl:with-param name="process">true</xsl:with-param>
4278
4659
  </xsl:apply-templates>
@@ -4430,6 +4811,24 @@
4430
4811
 
4431
4812
  </xsl:template> <!-- END: dl -->
4432
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
+
4433
4832
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4434
4833
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4435
4834
 
@@ -4649,6 +5048,8 @@
4649
5048
 
4650
5049
  </xsl:if>
4651
5050
 
5051
+ <xsl:call-template name="refine_dt-cell-style"/>
5052
+
4652
5053
  <fo:block xsl:use-attribute-sets="dt-block-style">
4653
5054
  <xsl:copy-of select="@id"/>
4654
5055
 
@@ -4656,6 +5057,8 @@
4656
5057
  <xsl:attribute name="margin-top">0</xsl:attribute>
4657
5058
  </xsl:if>
4658
5059
 
5060
+ <xsl:call-template name="refine_dt-block-style"/>
5061
+
4659
5062
  <xsl:apply-templates>
4660
5063
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4661
5064
  </xsl:apply-templates>
@@ -4675,6 +5078,8 @@
4675
5078
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4676
5079
  </xsl:if>
4677
5080
 
5081
+ <xsl:call-template name="refine_dd-cell-style"/>
5082
+
4678
5083
  <fo:block>
4679
5084
 
4680
5085
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4825,7 +5230,7 @@
4825
5230
  <xsl:param name="split_keep-within-line"/>
4826
5231
  <fo:inline font-weight="bold">
4827
5232
 
4828
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
5233
+ <xsl:call-template name="refine_strong_style"/>
4829
5234
 
4830
5235
  <xsl:apply-templates>
4831
5236
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4833,6 +5238,12 @@
4833
5238
  </fo:inline>
4834
5239
  </xsl:template>
4835
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
+
4836
5247
  <xsl:template match="*[local-name()='padding']">
4837
5248
  <fo:inline padding-right="{@value}"> </fo:inline>
4838
5249
  </xsl:template>
@@ -5303,7 +5714,10 @@
5303
5714
  </xsl:choose>
5304
5715
  </xsl:variable>
5305
5716
 
5306
- <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"/>
5307
5721
  </xsl:template>
5308
5722
 
5309
5723
  <xsl:template name="add-zero-spaces-link-java">
@@ -5978,6 +6392,11 @@
5978
6392
 
5979
6393
  <fo:inline xsl:use-attribute-sets="mathml-style">
5980
6394
 
6395
+ <!-- DEBUG -->
6396
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
6397
+
6398
+ <xsl:call-template name="refine_mathml-style"/>
6399
+
5981
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 -->
5982
6401
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5983
6402
  </xsl:if>
@@ -6082,6 +6501,8 @@
6082
6501
 
6083
6502
  <fo:instream-foreign-object fox:alt-text="Math">
6084
6503
 
6504
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
6505
+
6085
6506
  <!-- put MathML in Actual Text -->
6086
6507
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6087
6508
  <xsl:attribute name="fox:actual-text">
@@ -6102,6 +6523,10 @@
6102
6523
  </fo:instream-foreign-object>
6103
6524
  </xsl:template>
6104
6525
 
6526
+ <xsl:template name="refine_mathml_insteam_object_style">
6527
+
6528
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
6529
+
6105
6530
  <xsl:template match="mathml:*" mode="mathml_actual_text">
6106
6531
  <!-- <xsl:text>a+b</xsl:text> -->
6107
6532
  <xsl:text>&lt;</xsl:text>
@@ -6246,6 +6671,8 @@
6246
6671
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6247
6672
  <fo:inline xsl:use-attribute-sets="mathml-style">
6248
6673
 
6674
+ <xsl:call-template name="refine_mathml-style"/>
6675
+
6249
6676
  <xsl:choose>
6250
6677
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6251
6678
  <xsl:otherwise>
@@ -6290,6 +6717,8 @@
6290
6717
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6291
6718
  </xsl:if>
6292
6719
 
6720
+ <xsl:call-template name="refine_link-style"/>
6721
+
6293
6722
  <xsl:choose>
6294
6723
  <xsl:when test="$target_text = ''">
6295
6724
  <xsl:apply-templates/>
@@ -6377,6 +6806,9 @@
6377
6806
  <xsl:call-template name="insert_basic_link">
6378
6807
  <xsl:with-param name="element">
6379
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>
6380
6812
  <xsl:if test="parent::*[local-name() = 'add']">
6381
6813
  <xsl:call-template name="append_add-style"/>
6382
6814
  </xsl:if>
@@ -6438,6 +6870,8 @@
6438
6870
  <fo:table-cell display-align="center">
6439
6871
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
6440
6872
 
6873
+ <xsl:call-template name="refine_formula-stem-block-style"/>
6874
+
6441
6875
  <xsl:apply-templates/>
6442
6876
  </fo:block>
6443
6877
  </fo:table-cell>
@@ -6479,6 +6913,8 @@
6479
6913
 
6480
6914
  <xsl:call-template name="setBlockSpanAll"/>
6481
6915
 
6916
+ <xsl:call-template name="refine_note-style"/>
6917
+
6482
6918
  <fo:block-container margin-left="0mm" margin-right="0mm">
6483
6919
 
6484
6920
  <fo:list-block>
@@ -6509,6 +6945,10 @@
6509
6945
 
6510
6946
  </xsl:template>
6511
6947
 
6948
+ <xsl:template name="refine_note_block_style">
6949
+
6950
+ </xsl:template>
6951
+
6512
6952
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
6513
6953
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6514
6954
  <xsl:choose>
@@ -6530,12 +6970,16 @@
6530
6970
 
6531
6971
  <xsl:call-template name="setBlockSpanAll"/>
6532
6972
 
6973
+ <xsl:call-template name="refine_termnote-style"/>
6974
+
6533
6975
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6534
6976
 
6535
6977
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
6536
6978
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6537
6979
  </xsl:if>
6538
6980
 
6981
+ <xsl:call-template name="refine_termnote-name-style"/>
6982
+
6539
6983
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
6540
6984
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
6541
6985
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -6705,6 +7149,8 @@
6705
7149
  <xsl:otherwise>
6706
7150
  <fo:block xsl:use-attribute-sets="image-style">
6707
7151
 
7152
+ <xsl:call-template name="refine_image-style"/>
7153
+
6708
7154
  <xsl:variable name="src">
6709
7155
  <xsl:call-template name="image_src"/>
6710
7156
  </xsl:variable>
@@ -7554,10 +8000,7 @@
7554
8000
  <xsl:if test="normalize-space() != ''">
7555
8001
  <fo:block xsl:use-attribute-sets="figure-name-style">
7556
8002
 
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>
8003
+ <xsl:call-template name="refine_figure-name-style"/>
7561
8004
 
7562
8005
  <xsl:apply-templates/>
7563
8006
  </fo:block>
@@ -7822,6 +8265,8 @@
7822
8265
  </xsl:attribute>
7823
8266
  </xsl:for-each>
7824
8267
 
8268
+ <xsl:call-template name="refine_sourcecode-style"/>
8269
+
7825
8270
  <!-- remove margin between rows in the table with sourcecode line numbers -->
7826
8271
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7827
8272
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -8526,6 +8971,8 @@
8526
8971
 
8527
8972
  <xsl:call-template name="setBlockSpanAll"/>
8528
8973
 
8974
+ <xsl:call-template name="refine_example-style"/>
8975
+
8529
8976
  <xsl:variable name="fo_element">
8530
8977
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
8531
8978
  list
@@ -8653,6 +9100,8 @@
8653
9100
  </xsl:if>
8654
9101
  <fo:block xsl:use-attribute-sets="example-p-style">
8655
9102
 
9103
+ <xsl:call-template name="refine_example-p-style"/>
9104
+
8656
9105
  <xsl:apply-templates/>
8657
9106
  </fo:block>
8658
9107
  </fo:block-container>
@@ -8669,6 +9118,7 @@
8669
9118
  </xsl:otherwise>
8670
9119
  </xsl:choose>
8671
9120
  </xsl:template> <!-- example/p -->
9121
+
8672
9122
  <!-- ====== -->
8673
9123
  <!-- ====== -->
8674
9124
 
@@ -8680,6 +9130,8 @@
8680
9130
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
8681
9131
  <fo:block xsl:use-attribute-sets="termsource-style">
8682
9132
 
9133
+ <xsl:call-template name="refine_termsource-style"/>
9134
+
8683
9135
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
8684
9136
  <xsl:variable name="termsource_text">
8685
9137
  <xsl:apply-templates/>
@@ -8795,6 +9247,8 @@
8795
9247
  <fo:block-container margin-left="0mm">
8796
9248
  <fo:block-container xsl:use-attribute-sets="quote-style">
8797
9249
 
9250
+ <xsl:call-template name="refine_quote-style"/>
9251
+
8798
9252
  <fo:block-container margin-left="0mm" margin-right="0mm">
8799
9253
  <fo:block role="BlockQuote">
8800
9254
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -8809,6 +9263,11 @@
8809
9263
  </fo:block>
8810
9264
  </xsl:if>
8811
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
+
8812
9271
  </fo:block-container>
8813
9272
  </fo:block-container>
8814
9273
  </xsl:template>
@@ -8869,8 +9328,7 @@
8869
9328
 
8870
9329
  </xsl:if>
8871
9330
 
8872
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8873
- <xsl:variable name="text" select="normalize-space()"/>
9331
+ <xsl:call-template name="refine_eref-style"/>
8874
9332
 
8875
9333
  <xsl:call-template name="insert_basic_link">
8876
9334
  <xsl:with-param name="element">
@@ -8880,6 +9338,8 @@
8880
9338
  </xsl:if>
8881
9339
  <xsl:if test="@type = 'inline'">
8882
9340
 
9341
+ <xsl:call-template name="refine_basic_link_style"/>
9342
+
8883
9343
  </xsl:if>
8884
9344
 
8885
9345
  <xsl:choose>
@@ -8912,6 +9372,11 @@
8912
9372
  </xsl:otherwise>
8913
9373
  </xsl:choose>
8914
9374
  </xsl:template>
9375
+
9376
+ <xsl:template name="refine_basic_link_style">
9377
+
9378
+ </xsl:template> <!-- refine_basic_link_style -->
9379
+
8915
9380
  <!-- ====== -->
8916
9381
  <!-- END eref -->
8917
9382
  <!-- ====== -->
@@ -9049,11 +9514,17 @@
9049
9514
  <fo:block>
9050
9515
  <xsl:call-template name="setId"/>
9051
9516
 
9517
+ <xsl:call-template name="sections_element_style"/>
9518
+
9052
9519
  <xsl:apply-templates/>
9053
9520
  </fo:block>
9054
9521
 
9055
9522
  </xsl:template>
9056
9523
 
9524
+ <xsl:template name="sections_element_style">
9525
+
9526
+ </xsl:template> <!-- sections_element_style -->
9527
+
9057
9528
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9058
9529
  <fo:block break-after="page"/>
9059
9530
  <fo:block>
@@ -9068,10 +9539,16 @@
9068
9539
 
9069
9540
  <xsl:call-template name="setBlockSpanAll"/>
9070
9541
 
9542
+ <xsl:call-template name="refine_clause_style"/>
9543
+
9071
9544
  <xsl:apply-templates/>
9072
9545
  </fo:block>
9073
9546
  </xsl:template>
9074
9547
 
9548
+ <xsl:template name="refine_clause_style">
9549
+
9550
+ </xsl:template> <!-- refine_clause_style -->
9551
+
9075
9552
  <xsl:template match="*[local-name() = 'definitions']">
9076
9553
  <fo:block id="{@id}">
9077
9554
  <xsl:apply-templates/>
@@ -9084,10 +9561,16 @@
9084
9561
 
9085
9562
  <xsl:call-template name="setBlockSpanAll"/>
9086
9563
 
9564
+ <xsl:call-template name="refine_annex_style"/>
9565
+
9087
9566
  </fo:block>
9088
9567
  <xsl:apply-templates/>
9089
9568
  </xsl:template>
9090
9569
 
9570
+ <xsl:template name="refine_annex_style">
9571
+
9572
+ </xsl:template>
9573
+
9091
9574
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
9092
9575
  <!-- comment 2019-11-29 -->
9093
9576
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -9253,6 +9736,8 @@
9253
9736
  </xsl:choose>
9254
9737
  </xsl:attribute>
9255
9738
 
9739
+ <xsl:call-template name="refine_list_container_style"/>
9740
+
9256
9741
  <fo:block-container margin-left="0mm">
9257
9742
  <fo:block>
9258
9743
  <xsl:apply-templates select="." mode="list"/>
@@ -9277,6 +9762,10 @@
9277
9762
  </xsl:choose>
9278
9763
  </xsl:template>
9279
9764
 
9765
+ <xsl:template name="refine_list_container_style">
9766
+
9767
+ </xsl:template> <!-- refine_list_container_style -->
9768
+
9280
9769
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
9281
9770
 
9282
9771
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -9287,7 +9776,7 @@
9287
9776
 
9288
9777
  <xsl:variable name="provisional_distance_between_starts_">
9289
9778
  <attributes xsl:use-attribute-sets="list-style">
9290
-
9779
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
9291
9780
  </attributes>
9292
9781
  </xsl:variable>
9293
9782
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -9323,6 +9812,8 @@
9323
9812
  <addon><xsl:value-of select="$addon"/></addon> -->
9324
9813
  </xsl:if>
9325
9814
 
9815
+ <xsl:call-template name="refine_list-style"/>
9816
+
9326
9817
  <xsl:if test="*[local-name() = 'name']">
9327
9818
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9328
9819
  </xsl:if>
@@ -9335,6 +9826,10 @@
9335
9826
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
9336
9827
  </xsl:template>
9337
9828
 
9829
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
9830
+
9831
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
9832
+
9338
9833
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
9339
9834
  <xsl:param name="process">false</xsl:param>
9340
9835
  <xsl:if test="$process = 'true'">
@@ -9348,13 +9843,12 @@
9348
9843
  <fo:list-item xsl:use-attribute-sets="list-item-style">
9349
9844
  <xsl:copy-of select="@id"/>
9350
9845
 
9846
+ <xsl:call-template name="refine_list-item-style"/>
9847
+
9351
9848
  <fo:list-item-label end-indent="label-end()">
9352
9849
  <fo:block xsl:use-attribute-sets="list-item-label-style">
9353
9850
 
9354
- <xsl:if test="parent::*[local-name() = 'ol']">
9355
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
9356
- <xsl:attribute name="font-weight">bold</xsl:attribute>
9357
- </xsl:if>
9851
+ <xsl:call-template name="refine_list-item-label-style"/>
9358
9852
 
9359
9853
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9360
9854
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -9362,11 +9856,14 @@
9362
9856
  </xsl:if>
9363
9857
 
9364
9858
  <xsl:call-template name="getListItemFormat"/>
9859
+
9365
9860
  </fo:block>
9366
9861
  </fo:list-item-label>
9367
9862
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9368
9863
  <fo:block>
9369
9864
 
9865
+ <xsl:call-template name="refine_list-item-body-style"/>
9866
+
9370
9867
  <xsl:apply-templates/>
9371
9868
 
9372
9869
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -9684,6 +10181,12 @@
9684
10181
 
9685
10182
  <fo:block id="{@id}">
9686
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
+
9687
10190
  </fo:block>
9688
10191
  </xsl:template>
9689
10192
 
@@ -9703,6 +10206,12 @@
9703
10206
 
9704
10207
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
9705
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
+
9706
10215
  </fo:block>
9707
10216
 
9708
10217
  </xsl:template> <!-- references -->
@@ -10283,6 +10792,9 @@
10283
10792
  </xsl:copy>
10284
10793
  </xsl:template>
10285
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
+
10286
10798
  <xsl:template name="add_id">
10287
10799
  <xsl:if test="not(@id)">
10288
10800
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -10671,6 +11183,14 @@
10671
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">
10672
11184
  <xsl:variable name="p_fn_">
10673
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> -->
10674
11194
  </xsl:variable>
10675
11195
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10676
11196
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -10685,8 +11205,17 @@
10685
11205
  <xsl:attribute name="current_fn_number">
10686
11206
  <xsl:value-of select="$current_fn_number"/>
10687
11207
  </xsl:attribute>
11208
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
10688
11209
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
10689
- <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)"/>
10690
11219
  </xsl:attribute>
10691
11220
  <xsl:apply-templates select="node()" mode="linear_xml"/>
10692
11221
  </xsl:copy>