metanorma-jis 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -515,10 +515,10 @@
515
515
 
516
516
  <fo:block-container text-align="center">
517
517
  <!-- title -->
518
- <fo:block role="H1" font-family="IPAexGothic" font-size="22pt" margin-top="27mm">規格票の様式及び作成方法</fo:block>
518
+ <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
519
  <!-- 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>
520
+ <fo:block font-family="IPAexGothic" font-size="20pt" margin-top="15mm"><fo:inline font-family="Arial">JIS Z 8301</fo:inline><fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline><fo:inline font-family="Times New Roman" font-size="10pt">2019</fo:inline></fo:inline></fo:block>
521
+ <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
522
  </fo:block-container>
523
523
 
524
524
  <fo:block-container absolute-position="fixed" left="0mm" top="200mm" height="69mm" text-align="center" display-align="after" font-family="IPAexMincho">
@@ -540,7 +540,7 @@
540
540
 
541
541
  <fo:static-content flow-name="xsl-footnote-separator">
542
542
  <fo:block text-align="center" margin-bottom="6pt">
543
- <fo:leader leader-pattern="rule" leader-length="80mm"/>
543
+ <fo:leader leader-pattern="rule" leader-length="80mm" rule-style="solid" rule-thickness="0.3pt"/>
544
544
  </fo:block>
545
545
  </fo:static-content>
546
546
 
@@ -559,7 +559,7 @@
559
559
  <fo:inline/>
560
560
  <fo:footnote-body>
561
561
  <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')]"/>
562
+ <xsl:apply-templates select="/*/*[local-name() = 'preface']/*[local-name() = 'clause'][@type = 'inner-cover-note']"/> <!-- /*[not(local-name() = 'title')] -->
563
563
  </fo:block>
564
564
  </fo:footnote-body>
565
565
  </fo:footnote>
@@ -653,6 +653,13 @@
653
653
  </xsl:if>
654
654
  </xsl:template>
655
655
 
656
+ <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'clause']" priority="3">
657
+ <fo:block>
658
+ <xsl:call-template name="setId"/>
659
+ <xsl:apply-templates/>
660
+ </fo:block>
661
+ </xsl:template>
662
+
656
663
  <xsl:template match="*" priority="3" mode="page">
657
664
  <xsl:call-template name="elementProcessing"/>
658
665
  </xsl:template>
@@ -736,7 +743,7 @@
736
743
  <xsl:variable name="margin-top">
737
744
  <xsl:choose>
738
745
  <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
739
- <xsl:when test="$level = 1">4.5mm</xsl:when>
746
+ <xsl:when test="$level = 1">6.5mm</xsl:when>
740
747
  <xsl:when test="@ancestor = 'foreword' and $level = 2">0mm</xsl:when>
741
748
  <xsl:when test="@ancestor = 'annex' and $level = 2">4.5mm</xsl:when>
742
749
  <xsl:when test="@ancestor = 'bibliography' and $level = 2">0mm</xsl:when>
@@ -755,12 +762,13 @@
755
762
 
756
763
  <xsl:variable name="margin-bottom">
757
764
  <xsl:choose>
765
+ <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
766
+ <xsl:when test="$level = 1 and following-sibling::jis:clause">8pt</xsl:when>
758
767
  <xsl:when test="$level = 1">12pt</xsl:when>
768
+ <xsl:when test="$level = 2 and following-sibling::jis:clause">8pt</xsl:when>
759
769
  <xsl:when test="$level &gt;= 2">12pt</xsl:when>
760
770
  <xsl:when test="@type = 'section-title'">6mm</xsl:when>
761
771
  <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
772
  <xsl:when test="@ancestor = 'annex' and $level = 1">6mm</xsl:when>
765
773
  <xsl:otherwise>0mm</xsl:otherwise>
766
774
  </xsl:choose>
@@ -841,7 +849,9 @@
841
849
  <xsl:variable name="element-name">fo:block</xsl:variable>
842
850
 
843
851
  <xsl:element name="{$element-name}">
844
- <xsl:call-template name="setBlockAttributes"/>
852
+ <xsl:call-template name="setBlockAttributes">
853
+ <xsl:with-param name="text_align_default">justify</xsl:with-param>
854
+ </xsl:call-template>
845
855
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
846
856
 
847
857
  <xsl:if test="not(parent::jis:note or parent::jis:li or ancestor::jis:table)">
@@ -867,10 +877,18 @@
867
877
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
868
878
  </xsl:if>
869
879
 
870
- <xsl:if test="parent::jis:li or following-sibling::*[1][self::jis:ol or self::jis:ul]">
880
+ <xsl:if test="parent::jis:li or following-sibling::*[1][self::jis:ol or self::jis:ul or self::jis:note or self::jis:example]">
871
881
  <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
872
882
  </xsl:if>
873
883
 
884
+ <xsl:if test="parent::jis:td or parent::jis:th or parent::jis:dd">
885
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
886
+ </xsl:if>
887
+
888
+ <xsl:if test="parent::jis:clause[@type = 'inner-cover-note']">
889
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
890
+ </xsl:if>
891
+
874
892
  <xsl:apply-templates>
875
893
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
876
894
  </xsl:apply-templates>
@@ -890,8 +908,6 @@
890
908
 
891
909
  <xsl:template match="jis:termnote" priority="2">
892
910
  <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
911
  <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
896
912
  <fo:list-item>
897
913
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
@@ -949,12 +965,17 @@
949
965
  <!-- ========================= -->
950
966
  <!-- Allocate non-Japanese text -->
951
967
  <!-- ========================= -->
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>
968
+
969
+ <xsl:variable name="regex_en">([^\u3000-\u9FFF\uF900-\uFFFF]{1,})</xsl:variable>
970
+
971
+ <xsl:variable name="element_name_font_en">font_en</xsl:variable>
972
+ <xsl:variable name="tag_font_en_open">###<xsl:value-of select="$element_name_font_en"/>###</xsl:variable>
973
+ <xsl:variable name="tag_font_en_close">###/<xsl:value-of select="$element_name_font_en"/>###</xsl:variable>
974
+ <xsl:variable name="element_name_font_en_bold">font_en_bold</xsl:variable>
975
+ <xsl:variable name="tag_font_en_bold_open">###<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
976
+ <xsl:variable name="tag_font_en_bold_close">###/<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
977
+
978
+ <xsl:template match="jis:p//text()[not(ancestor::jis:strong)] | jis:dt/text()" mode="update_xml_step1">
958
979
  <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
980
  <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
960
981
  <xsl:with-param name="tag_open" select="$tag_font_en_open"/>
@@ -964,7 +985,59 @@
964
985
  <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
965
986
  </xsl:template>
966
987
 
967
- <xsl:template match="*[local-name() = 'font_en']">
988
+ <!-- jis:term/jis:preferred2//text() | -->
989
+
990
+ <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
991
+ <xsl:template match="jis:title/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:example/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
992
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
993
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
994
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
995
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
996
+ <xsl:with-param name="text" select="$text_en_"/>
997
+ </xsl:call-template></text></xsl:variable>
998
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
999
+ </xsl:template>
1000
+
1001
+ <xsl:template match="jis:eref//text()" mode="update_xml_step1">
1002
+ <!-- Example: JIS Z 8301:2011 to <font_en_bold>JIS Z 8301</font_en_bold><font_en>:2011</font_en> -->
1003
+ <xsl:variable name="parts">
1004
+ <xsl:choose>
1005
+ <xsl:when test="contains(., ':')">
1006
+ <xsl:element name="{$element_name_font_en_bold}"><xsl:value-of select="substring-before(., ':')"/></xsl:element>
1007
+ <xsl:element name="{$element_name_font_en}">:<xsl:value-of select="substring-after(., ':')"/></xsl:element>
1008
+ </xsl:when>
1009
+ <xsl:otherwise>
1010
+ <xsl:element name="{$element_name_font_en_bold}"><xsl:value-of select="."/></xsl:element>
1011
+ </xsl:otherwise>
1012
+ </xsl:choose>
1013
+ </xsl:variable>
1014
+ <xsl:for-each select="xalan:nodeset($parts)/*">
1015
+ <xsl:variable name="tag_open">###<xsl:value-of select="local-name()"/>###</xsl:variable>
1016
+ <xsl:variable name="tag_close">###/<xsl:value-of select="local-name()"/>###</xsl:variable>
1017
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_open,'$1',$tag_close))"/>
1018
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1019
+ <xsl:with-param name="tag_open" select="$tag_open"/>
1020
+ <xsl:with-param name="tag_close" select="$tag_close"/>
1021
+ <xsl:with-param name="text" select="$text_en_"/>
1022
+ </xsl:call-template></text></xsl:variable>
1023
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1024
+ </xsl:for-each>
1025
+ </xsl:template>
1026
+
1027
+ <xsl:template match="jis:strong" priority="2" mode="update_xml_step1">
1028
+ <xsl:apply-templates mode="update_xml_step1"/>
1029
+ </xsl:template>
1030
+ <xsl:template match="jis:strong/text()" priority="2" mode="update_xml_step1">
1031
+ <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))"/>
1032
+ <xsl:variable name="text_en"><text><xsl:call-template name="replace_text_tags">
1033
+ <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
1034
+ <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
1035
+ <xsl:with-param name="text" select="$text_en_"/>
1036
+ </xsl:call-template></text></xsl:variable>
1037
+ <xsl:copy-of select="xalan:nodeset($text_en)/text/node()"/>
1038
+ </xsl:template>
1039
+
1040
+ <xsl:template match="*[local-name() = 'font_en_bold']">
968
1041
  <fo:inline font-family="Times New Roman" font-weight="bold">
969
1042
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
970
1043
  <xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -973,6 +1046,15 @@
973
1046
  </fo:inline>
974
1047
  </xsl:template>
975
1048
 
1049
+ <xsl:template match="*[local-name() = 'font_en']">
1050
+ <fo:inline font-family="Times New Roman">
1051
+ <xsl:if test="ancestor::*[local-name() = 'preferred']">
1052
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1053
+ </xsl:if>
1054
+ <xsl:apply-templates/>
1055
+ </fo:inline>
1056
+ </xsl:template>
1057
+
976
1058
  <!-- ========================= -->
977
1059
  <!-- END: Allocate non-Japanese text -->
978
1060
  <!-- ========================= -->
@@ -1004,7 +1086,7 @@
1004
1086
  <xsl:param name="section"/>
1005
1087
  <xsl:param name="copyrightText"/>
1006
1088
  <fo:static-content flow-name="footer">
1007
- <fo:block-container height="24.5mm" display-align="after">
1089
+ <fo:block-container height="24mm" display-align="after">
1008
1090
  <xsl:if test="$section = 'preface'">
1009
1091
  <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
1092
  </xsl:if>
@@ -1528,6 +1610,8 @@
1528
1610
 
1529
1611
  <xsl:attribute-set name="example-p-style">
1530
1612
 
1613
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1614
+
1531
1615
  </xsl:attribute-set> <!-- example-p-style -->
1532
1616
 
1533
1617
  <xsl:attribute-set name="termexample-name-style">
@@ -1605,8 +1689,10 @@
1605
1689
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1606
1690
  <xsl:attribute name="display-align">center</xsl:attribute>
1607
1691
 
1692
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1608
1693
  <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
1609
1694
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
1695
+ <xsl:attribute name="text-align">center</xsl:attribute>
1610
1696
 
1611
1697
  </xsl:attribute-set> <!-- table-header-cell-style -->
1612
1698
 
@@ -1686,11 +1772,17 @@
1686
1772
  <!-- ========================== -->
1687
1773
  <!-- Definition's list styles -->
1688
1774
  <!-- ========================== -->
1775
+
1776
+ <xsl:attribute-set name="dl-block-style">
1777
+
1778
+ </xsl:attribute-set>
1779
+
1689
1780
  <xsl:attribute-set name="dt-row-style">
1690
1781
 
1691
1782
  </xsl:attribute-set>
1692
1783
 
1693
1784
  <xsl:attribute-set name="dt-cell-style">
1785
+
1694
1786
  </xsl:attribute-set>
1695
1787
 
1696
1788
  <xsl:attribute-set name="dt-block-style">
@@ -1706,6 +1798,7 @@
1706
1798
 
1707
1799
  <xsl:attribute-set name="dd-cell-style">
1708
1800
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1801
+
1709
1802
  </xsl:attribute-set>
1710
1803
 
1711
1804
  <!-- ========================== -->
@@ -1755,6 +1848,10 @@
1755
1848
 
1756
1849
  <xsl:attribute-set name="termnote-style">
1757
1850
 
1851
+ <xsl:attribute name="text-indent">0mm</xsl:attribute>
1852
+ <xsl:attribute name="space-before">4pt</xsl:attribute>
1853
+ <xsl:attribute name="space-after">4pt</xsl:attribute>
1854
+
1758
1855
  </xsl:attribute-set>
1759
1856
 
1760
1857
  <xsl:attribute-set name="termnote-name-style">
@@ -1819,6 +1916,10 @@
1819
1916
 
1820
1917
  </xsl:attribute-set>
1821
1918
 
1919
+ <xsl:attribute-set name="figure-source-style">
1920
+
1921
+ </xsl:attribute-set>
1922
+
1822
1923
  <!-- Formula's styles -->
1823
1924
  <xsl:attribute-set name="formula-style">
1824
1925
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1935,6 +2036,7 @@
1935
2036
  <xsl:attribute-set name="list-style">
1936
2037
 
1937
2038
  <xsl:attribute name="provisional-distance-between-starts">7.5mm</xsl:attribute>
2039
+ <xsl:attribute name="space-after">4pt</xsl:attribute>
1938
2040
 
1939
2041
  </xsl:attribute-set> <!-- list-style -->
1940
2042
 
@@ -2331,7 +2433,7 @@
2331
2433
 
2332
2434
  <xsl:template name="processTables_Contents">
2333
2435
  <tables>
2334
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2436
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2335
2437
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2336
2438
  <xsl:copy-of select="*[local-name() = 'name']"/>
2337
2439
  </table>
@@ -2655,6 +2757,10 @@
2655
2757
 
2656
2758
  <xsl:call-template name="setBordersTableArray"/>
2657
2759
 
2760
+ <xsl:if test="ancestor::*[local-name()='preface']">
2761
+ <xsl:attribute name="border">none</xsl:attribute>
2762
+ </xsl:if>
2763
+
2658
2764
  </xsl:element>
2659
2765
  </xsl:variable>
2660
2766
 
@@ -2675,7 +2781,7 @@
2675
2781
  </xsl:attribute>
2676
2782
  </xsl:for-each>
2677
2783
 
2678
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2784
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2679
2785
  <xsl:if test="$isNoteOrFnExist = 'true'">
2680
2786
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2681
2787
  </xsl:if>
@@ -2719,7 +2825,7 @@
2719
2825
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2720
2826
  </xsl:when>
2721
2827
  <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 -->
2828
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
2723
2829
  </xsl:otherwise>
2724
2830
  </xsl:choose>
2725
2831
 
@@ -2803,6 +2909,11 @@
2803
2909
  </xsl:if>
2804
2910
  </xsl:template> <!-- table/name -->
2805
2911
 
2912
+ <!-- SOURCE: ... -->
2913
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2914
+ <xsl:call-template name="termsource"/>
2915
+ </xsl:template>
2916
+
2806
2917
  <xsl:template name="calculate-columns-numbers">
2807
2918
  <xsl:param name="table-row"/>
2808
2919
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3159,7 +3270,7 @@
3159
3270
  </fo:table-header>
3160
3271
  </xsl:template> <!-- thead -->
3161
3272
 
3162
- <!-- template is using for iso, jcgm, bsi only -->
3273
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3163
3274
  <xsl:template name="table-header-title">
3164
3275
  <xsl:param name="cols-count"/>
3165
3276
  <!-- row for title -->
@@ -3202,7 +3313,7 @@
3202
3313
  <xsl:param name="colwidths"/>
3203
3314
  <xsl:param name="colgroup"/>
3204
3315
 
3205
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3316
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3206
3317
 
3207
3318
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3208
3319
 
@@ -3272,6 +3383,7 @@
3272
3383
 
3273
3384
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3274
3385
  <xsl:apply-templates select="../*[local-name()='note']"/>
3386
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3275
3387
 
3276
3388
  <xsl:variable name="isDisplayRowSeparator">
3277
3389
 
@@ -3402,6 +3514,11 @@
3402
3514
 
3403
3515
  <xsl:call-template name="setBordersTableArray"/>
3404
3516
 
3517
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
3518
+ <xsl:attribute name="border-top">none</xsl:attribute>
3519
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
3520
+ </xsl:if>
3521
+
3405
3522
  <xsl:call-template name="setTableRowAttributes"/>
3406
3523
 
3407
3524
  <xsl:apply-templates/>
@@ -3468,8 +3585,14 @@
3468
3585
  <xsl:with-param name="default">center</xsl:with-param>
3469
3586
  </xsl:call-template>
3470
3587
 
3588
+ <xsl:attribute name="text-align">center</xsl:attribute>
3589
+
3471
3590
  <xsl:call-template name="setBordersTableArray"/>
3472
3591
 
3592
+ <xsl:if test="ancestor::*[local-name()='preface']">
3593
+ <xsl:attribute name="border">none</xsl:attribute>
3594
+ </xsl:if>
3595
+
3473
3596
  <xsl:if test="$lang = 'ar'">
3474
3597
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3475
3598
  </xsl:if>
@@ -3524,6 +3647,10 @@
3524
3647
 
3525
3648
  <xsl:call-template name="setBordersTableArray"/>
3526
3649
 
3650
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
3651
+ <xsl:attribute name="border">none</xsl:attribute>
3652
+ </xsl:if>
3653
+
3527
3654
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3528
3655
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3529
3656
  </xsl:if>
@@ -3721,7 +3848,11 @@
3721
3848
  <fo:list-item>
3722
3849
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
3723
3850
  <fo:block>
3724
- <fo:inline font-size="9pt" font-family="IPAexGothic">注</fo:inline>
3851
+ <fo:inline font-size="9pt" font-family="IPAexGothic">
3852
+ <xsl:call-template name="getLocalizedString">
3853
+ <xsl:with-param name="key">table_footnote</xsl:with-param>
3854
+ </xsl:call-template>
3855
+ </fo:inline>
3725
3856
  <xsl:text> </xsl:text>
3726
3857
  <fo:inline xsl:use-attribute-sets="table-fn-number-style">
3727
3858
  <xsl:value-of select="@reference"/>
@@ -3914,7 +4045,7 @@
3914
4045
  <xsl:variable name="isAdded" select="@added"/>
3915
4046
  <xsl:variable name="isDeleted" select="@deleted"/>
3916
4047
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3917
- <fo:block-container>
4048
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3918
4049
 
3919
4050
  <xsl:call-template name="setBlockSpanAll"/>
3920
4051
 
@@ -3922,6 +4053,18 @@
3922
4053
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3923
4054
  </xsl:if>
3924
4055
 
4056
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
4057
+ <!-- set font-size as sourcecode font-size -->
4058
+ <xsl:variable name="sourcecode_attributes">
4059
+ <xsl:call-template name="get_sourcecode_attributes"/>
4060
+ </xsl:variable>
4061
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
4062
+ <xsl:attribute name="{local-name()}">
4063
+ <xsl:value-of select="."/>
4064
+ </xsl:attribute>
4065
+ </xsl:for-each>
4066
+ </xsl:if>
4067
+
3925
4068
  <xsl:if test="parent::*[local-name() = 'note']">
3926
4069
  <xsl:attribute name="margin-left">
3927
4070
  <xsl:choose>
@@ -4355,6 +4498,7 @@
4355
4498
  <xsl:param name="split_keep-within-line"/>
4356
4499
 
4357
4500
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4501
+
4358
4502
  <xsl:call-template name="insert_dt_cell">
4359
4503
  <xsl:with-param name="key_iso" select="$key_iso"/>
4360
4504
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4376,6 +4520,7 @@
4376
4520
  <!-- border is mandatory, to calculate real width -->
4377
4521
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4378
4522
  <xsl:attribute name="text-align">left</xsl:attribute>
4523
+
4379
4524
  </xsl:if>
4380
4525
 
4381
4526
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4544,6 +4689,8 @@
4544
4689
  <xsl:param name="split_keep-within-line"/>
4545
4690
  <fo:inline font-weight="bold">
4546
4691
 
4692
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
4693
+
4547
4694
  <xsl:apply-templates>
4548
4695
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
4549
4696
  </xsl:apply-templates>
@@ -4818,6 +4965,11 @@
4818
4965
  <fo:inline>
4819
4966
  <xsl:for-each select="$styles/style">
4820
4967
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4968
+
4969
+ <xsl:if test="@name = 'font-family' and . = 'MS Gothic'">
4970
+ <xsl:attribute name="{@name}">IPAexGothic</xsl:attribute>
4971
+ </xsl:if>
4972
+
4821
4973
  </xsl:for-each>
4822
4974
  <xsl:apply-templates/>
4823
4975
  </fo:inline>
@@ -6112,7 +6264,14 @@
6112
6264
 
6113
6265
  <fo:block-container margin-left="0mm" margin-right="0mm">
6114
6266
 
6115
- <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
6267
+ <fo:list-block>
6268
+ <xsl:attribute name="provisional-distance-between-starts">
6269
+ <xsl:choose>
6270
+ <!-- if last char is digit -->
6271
+ <xsl:when test="translate(substring(*[local-name() = 'name'], string-length(*[local-name() = 'name'])),'0123456789','') = ''"><xsl:value-of select="14 + $text_indent"/>mm</xsl:when>
6272
+ <xsl:otherwise><xsl:value-of select="10 + $text_indent"/>mm</xsl:otherwise>
6273
+ </xsl:choose>
6274
+ </xsl:attribute>
6116
6275
  <fo:list-item>
6117
6276
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
6118
6277
  <fo:block xsl:use-attribute-sets="note-name-style">
@@ -6307,6 +6466,13 @@
6307
6466
  </fo:block>
6308
6467
  </xsl:template>
6309
6468
 
6469
+ <!-- SOURCE: ... -->
6470
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6471
+
6472
+ <xsl:call-template name="termsource"/>
6473
+
6474
+ </xsl:template>
6475
+
6310
6476
  <xsl:template match="*[local-name() = 'image']">
6311
6477
  <xsl:variable name="isAdded" select="../@added"/>
6312
6478
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7436,9 +7602,11 @@
7436
7602
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7437
7603
  </xsl:if>
7438
7604
 
7439
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7605
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7440
7606
  </fo:block>
7441
7607
 
7608
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7609
+
7442
7610
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7443
7611
 
7444
7612
  </fo:block-container>
@@ -7470,11 +7638,22 @@
7470
7638
  <!-- add sourcecode highlighting -->
7471
7639
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7472
7640
  <xsl:variable name="class" select="@class"/>
7641
+
7642
+ <!-- Example: <1> -->
7643
+ <xsl:variable name="is_callout">
7644
+ <xsl:if test="parent::*[local-name() = 'dt']">
7645
+ <xsl:variable name="dt_id" select="../@id"/>
7646
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7647
+ </xsl:if>
7648
+ </xsl:variable>
7649
+
7473
7650
  <xsl:choose>
7474
7651
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7475
7652
  <fo:inline>
7476
7653
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7654
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7477
7655
  <xsl:apply-templates/>
7656
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7478
7657
  </fo:inline>
7479
7658
  </xsl:when>
7480
7659
  <xsl:otherwise>
@@ -7898,6 +8077,10 @@
7898
8077
  </fo:block>
7899
8078
  </xsl:template>
7900
8079
 
8080
+ <xsl:template match="*[local-name() = 'div']">
8081
+ <fo:block><xsl:apply-templates/></fo:block>
8082
+ </xsl:template>
8083
+
7901
8084
  <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
8085
  <fo:block xsl:use-attribute-sets="inherit-style">
7903
8086
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8584,13 +8767,8 @@
8584
8767
  </xsl:template>
8585
8768
 
8586
8769
  <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
8770
  <fo:block xsl:use-attribute-sets="deprecates-style">
8593
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8771
+ <xsl:apply-templates/>
8594
8772
  </fo:block>
8595
8773
  </xsl:template>
8596
8774
 
@@ -9817,6 +9995,23 @@
9817
9995
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9818
9996
  <xsl:copy-of select="."/>
9819
9997
  </xsl:template>
9998
+
9999
+ <!-- add @id, redundant for table auto-layout algorithm -->
10000
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
10001
+ <xsl:copy>
10002
+ <xsl:copy-of select="@*"/>
10003
+ <xsl:call-template name="add_id"/>
10004
+ <xsl:apply-templates mode="update_xml_step1"/>
10005
+ </xsl:copy>
10006
+ </xsl:template>
10007
+
10008
+ <xsl:template name="add_id">
10009
+ <xsl:if test="not(@id)">
10010
+ <!-- add @id - first element with @id plus '_element_name' -->
10011
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
10012
+ </xsl:if>
10013
+ </xsl:template>
10014
+
9820
10015
  <!-- =========================================================================== -->
9821
10016
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9822
10017
  <!-- =========================================================================== -->
@@ -49,6 +49,13 @@ module IsoDoc
49
49
  end
50
50
 
51
51
  PART_LABEL = { en: "Part", ja: "その" }.freeze
52
+
53
+ def docid(isoxml, _out)
54
+ id = isoxml.at(ns("//bibdata/docidentifier[@type = 'JIS']"))&.text or
55
+ return
56
+ set(:docnumber, id)
57
+ set(:docnumber_undated, id.sub(/:\d{4}$/, ""))
58
+ end
52
59
  end
53
60
  end
54
61
  end