metanorma-jis 0.0.10 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -459,7 +459,7 @@
459
459
 
460
460
  <fo:flow flow-name="xsl-region-body">
461
461
 
462
- <xsl:if test="position() = 1">
462
+ <!-- <xsl:if test="position() = 1">
463
463
  <fo:table table-layout="fixed" width="100%">
464
464
  <fo:table-column column-width="proportional-column-width(35)"/>
465
465
  <fo:table-column column-width="proportional-column-width(97)"/>
@@ -467,14 +467,14 @@
467
467
  <fo:table-column column-width="proportional-column-width(12)"/>
468
468
  <fo:table-body>
469
469
  <fo:table-row>
470
- <fo:table-cell><fo:block/></fo:table-cell>
470
+ <fo:table-cell><fo:block></fo:block></fo:table-cell>
471
471
  <fo:table-cell font-family="IPAexGothic" font-size="14pt" text-align="center">
472
472
  <fo:block>
473
473
  <xsl:call-template name="getLocalizedString">
474
474
  <xsl:with-param name="key">doctype_dict.<xsl:value-of select="$doctype"/></xsl:with-param>
475
475
  </xsl:call-template>
476
476
  </fo:block>
477
- </fo:table-cell>
477
+ </fo:table-cell>
478
478
  <fo:table-cell text-align="right">
479
479
  <fo:block font-family="Arial" font-size="16pt">
480
480
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($docnumber), '^(JIS)(.*)', '$1')"/>
@@ -489,29 +489,29 @@
489
489
  </fo:inline>
490
490
  </fo:block>
491
491
  </fo:table-cell>
492
-
492
+
493
493
  </fo:table-row>
494
494
  </fo:table-body>
495
495
  </fo:table>
496
-
496
+
497
497
  <fo:block font-family="IPAexGothic" font-size="19pt" text-align="center" margin-top="12mm" margin-bottom="4mm"><xsl:value-of select="$title_ja"/></fo:block>
498
498
  <fo:block font-family="Arial" font-size="13pt" text-align="center" margin-bottom="10mm"><xsl:value-of select="$title_en"/></fo:block>
499
-
500
- </xsl:if>
499
+
500
+ </xsl:if> -->
501
501
 
502
502
  <!-- Annex Commentary first page -->
503
- <xsl:if test="$isCommentary = 'true'">
503
+ <!-- <xsl:if test="$isCommentary = 'true'"> -->
504
504
 
505
505
  <!-- Example: JIS Z 8301:2019 -->
506
- <fo:block font-family="IPAexGothic" font-size="15pt" text-align="center">
506
+ <!-- <fo:block font-family="IPAexGothic" font-size="15pt" text-align="center">
507
507
  <fo:inline font-family="Arial">JIS <xsl:value-of select="$docidentifier_number"/></fo:inline>
508
508
  <fo:inline baseline-shift="10%"><fo:inline font-size="10pt">:</fo:inline>
509
509
  <fo:inline font-family="Times New Roman" font-size="10pt"><xsl:value-of select="$docidentifier_year"/></fo:inline></fo:inline>
510
- </fo:block>
510
+ </fo:block> -->
511
511
 
512
512
  <!-- title -->
513
- <fo:block role="H1" font-family="IPAexGothic" font-size="16pt" text-align="center" margin-top="6mm"><xsl:value-of select="$title_ja"/></fo:block>
514
- </xsl:if>
513
+ <!-- <fo:block role="H1" font-family="IPAexGothic" font-size="16pt" text-align="center" margin-top="6mm"><xsl:value-of select="$title_ja"/></fo:block> -->
514
+ <!-- </xsl:if> -->
515
515
 
516
516
  <xsl:apply-templates select="*" mode="page"/>
517
517
 
@@ -653,16 +653,22 @@
653
653
  <fo:inline baseline-shift="20%"><fo:inline font-size="10pt">:</fo:inline>
654
654
  <fo:inline font-family="Times New Roman" font-size="10pt"><xsl:value-of select="$docidentifier_year"/></fo:inline></fo:inline>
655
655
  </fo:block>
656
- <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>
656
+ <fo:block font-family="Arial" font-size="14pt" margin-top="12mm">
657
+ <fo:inline font-family="IPAexMincho">(</fo:inline>
658
+ <!-- JSA -->
659
+ <xsl:value-of select="/*/jis:bibdata/jis:copyright/jis:owner/jis:organization/jis:abbreviation"/>
660
+ <fo:inline font-family="IPAexMincho">)</fo:inline></fo:block>
657
661
  </fo:block-container>
658
662
 
659
663
  <fo:block-container absolute-position="fixed" left="0mm" top="200mm" height="69mm" text-align="center" display-align="after" font-family="IPAexMincho">
660
664
  <!-- Revised on July 22, 2019 -->
661
665
  <fo:block font-size="9pt">令和元年<fo:inline font-family="Times New Roman"> 7 </fo:inline>月<fo:inline font-family="Times New Roman"> 22 </fo:inline>日 改正</fo:block>
662
666
  <!-- Japan Industrial Standards Survey Council deliberations -->
663
- <fo:block font-size="14pt" margin-top="7mm">日本産業標準調査会 審議</fo:block>
667
+ <!-- 日本産業標準調査会 -->
668
+ <fo:block font-size="14pt" margin-top="7mm"><xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'authorizer']/jis:organization/jis:name/jis:variant[@language = 'ja']"/> 審議</fo:block>
664
669
  <!-- (Issued by the Japan Standards Association) -->
665
- <fo:block font-size="9pt" margin-top="6.5mm">(日本規格協会 発行)</fo:block>
670
+ <!-- 日本規格協会 -->
671
+ <fo:block font-size="9pt" margin-top="6.5mm">(<xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'publisher']/jis:organization/jis:name/jis:variant[@language = 'ja']"/> 発行)</fo:block>
666
672
  </fo:block-container>
667
673
  </fo:flow>
668
674
  </fo:page-sequence>
@@ -704,6 +710,129 @@
704
710
  </fo:page-sequence>
705
711
  </xsl:template> <!-- insertInnerCoverPage -->
706
712
 
713
+ <xsl:template match="jis:p[@class = 'JapaneseIndustrialStandard']" priority="4">
714
+ <fo:table table-layout="fixed" width="100%">
715
+ <fo:table-column column-width="proportional-column-width(36)"/>
716
+ <fo:table-column column-width="proportional-column-width(92)"/>
717
+ <fo:table-column column-width="proportional-column-width(36)"/>
718
+ <fo:table-body>
719
+ <fo:table-row>
720
+ <fo:table-cell>
721
+ <fo:block> </fo:block>
722
+ </fo:table-cell>
723
+ <fo:table-cell font-family="IPAexGothic" font-size="14pt" text-align="center">
724
+ <fo:block><xsl:apply-templates/></fo:block>
725
+ </fo:table-cell>
726
+ <fo:table-cell padding-left="5mm">
727
+ <fo:block font-family="Arial" font-size="16pt">
728
+ <xsl:apply-templates select="jis:span[@class = 'JIS']">
729
+ <xsl:with-param name="process">true</xsl:with-param>
730
+ </xsl:apply-templates>
731
+ </fo:block>
732
+ </fo:table-cell>
733
+ </fo:table-row>
734
+ </fo:table-body>
735
+ </fo:table>
736
+ </xsl:template>
737
+
738
+ <xsl:template match="jis:p[@class = 'StandardNumber']" priority="4">
739
+ <fo:table table-layout="fixed" width="100%">
740
+ <fo:table-column column-width="proportional-column-width(36)"/>
741
+ <fo:table-column column-width="proportional-column-width(92)"/>
742
+ <fo:table-column column-width="proportional-column-width(36)"/>
743
+ <fo:table-body>
744
+ <fo:table-row>
745
+ <fo:table-cell>
746
+ <fo:block> </fo:block>
747
+ </fo:table-cell>
748
+ <fo:table-cell>
749
+ <fo:block> </fo:block>
750
+ </fo:table-cell>
751
+ <fo:table-cell>
752
+ <fo:block>
753
+ <xsl:apply-templates/>
754
+ </fo:block>
755
+ </fo:table-cell>
756
+ </fo:table-row>
757
+ </fo:table-body>
758
+ </fo:table>
759
+ </xsl:template>
760
+
761
+ <xsl:template match="jis:p[@class = 'StandardNumber']//text()[not(ancestor::jis:span)]" priority="4">
762
+ <fo:inline font-family="Arial" font-size="16pt">
763
+ <xsl:choose>
764
+ <xsl:when test="contains(., ':')">
765
+ <xsl:value-of select="substring-before(., ':')"/>
766
+ <fo:inline baseline-shift="10%" font-size="10pt" font-family="IPAexMincho">:</fo:inline>
767
+ <xsl:value-of select="substring-after(., ':')"/>
768
+ </xsl:when>
769
+ <xsl:otherwise>
770
+ <xsl:value-of select="."/>
771
+ </xsl:otherwise>
772
+ </xsl:choose>
773
+ </fo:inline>
774
+ </xsl:template>
775
+
776
+ <xsl:template match="jis:p[@class = 'StandardNumber']/jis:span[@class = 'EffectiveYear']" priority="4">
777
+ <fo:inline font-size="10pt" baseline-shift="10%">
778
+ <fo:inline font-family="Times New Roman"><xsl:apply-templates/></fo:inline>
779
+ </fo:inline>
780
+ </xsl:template>
781
+
782
+ <xsl:template match="jis:p[@class = 'JapaneseIndustrialStandard']/jis:tab" priority="4"/>
783
+ <!-- <fo:inline role="SKIP" padding-right="0mm">&#x200B;</fo:inline>
784
+ </xsl:template> -->
785
+ <xsl:template match="jis:p[@class = 'JapaneseIndustrialStandard']/jis:span[@class = 'JIS']" priority="4">
786
+ <xsl:param name="process">false</xsl:param>
787
+ <xsl:if test="$process = 'true'">
788
+ <fo:inline font-size="16pt" font-family="Arial"><xsl:apply-templates/></fo:inline>
789
+ </xsl:if>
790
+ </xsl:template>
791
+
792
+ <xsl:template match="jis:p[@class = 'zzSTDTitle1']" priority="4">
793
+ <fo:block font-family="IPAexGothic" font-size="19pt" text-align="center" margin-top="12mm" margin-bottom="4mm">
794
+ <xsl:apply-templates/>
795
+ </fo:block>
796
+ </xsl:template>
797
+
798
+ <xsl:template match="jis:p[@class = 'zzSTDTitle2']" priority="4">
799
+ <fo:block font-family="Arial" font-size="13pt" text-align="center" margin-bottom="10mm">
800
+ <xsl:apply-templates/>
801
+ </fo:block>
802
+ </xsl:template>
803
+
804
+ <!-- for commentary annex -->
805
+ <xsl:template match="jis:p[@class = 'CommentaryStandardNumber']" priority="4">
806
+ <fo:block font-family="IPAexGothic" font-size="15pt" text-align="center">
807
+ <xsl:apply-templates/>
808
+ </fo:block>
809
+ </xsl:template>
810
+
811
+ <xsl:template match="jis:p[@class = 'CommentaryStandardNumber']//text()[not(ancestor::jis:span)]" priority="4">
812
+ <fo:inline font-family="Arial">
813
+ <xsl:choose>
814
+ <xsl:when test="contains(., ':')">
815
+ <xsl:value-of select="substring-before(., ':')"/>
816
+ <fo:inline baseline-shift="10%" font-size="10pt" font-family="IPAexMincho">:</fo:inline>
817
+ <xsl:value-of select="substring-after(., ':')"/>
818
+ </xsl:when>
819
+ <xsl:otherwise>
820
+ <xsl:value-of select="."/>
821
+ </xsl:otherwise>
822
+ </xsl:choose>
823
+ </fo:inline>
824
+ </xsl:template>
825
+
826
+ <xsl:template match="jis:p[@class = 'CommentaryStandardNumber']/jis:span[@class = 'CommentaryEffectiveYear']" priority="4">
827
+ <fo:inline baseline-shift="10%" font-family="Times New Roman" font-size="10pt"><xsl:apply-templates/></fo:inline>
828
+ </xsl:template>
829
+
830
+ <xsl:template match="jis:p[@class = 'CommentaryStandardName']" priority="4">
831
+ <fo:block role="H1" font-family="IPAexGothic" font-size="16pt" text-align="center" margin-top="6mm">
832
+ <xsl:apply-templates/>
833
+ </fo:block>
834
+ </xsl:template>
835
+
707
836
  <!-- ============================= -->
708
837
  <!-- CONTENTS -->
709
838
  <!-- ============================= -->
@@ -842,7 +971,7 @@
842
971
  <xsl:choose>
843
972
  <xsl:when test="@type = 'section-title'">18pt</xsl:when>
844
973
  <xsl:when test="@ancestor = 'foreword' and $level = '1'">14pt</xsl:when>
845
- <xsl:when test="@ancestor = 'annex' and $level = '1' and preceding-sibling::*[1][local-name() = 'annex' and @commentary = 'true']">16pt</xsl:when>
974
+ <xsl:when test="@ancestor = 'annex' and $level = '1' and preceding-sibling::*[local-name() = 'annex'][1][@commentary = 'true']">16pt</xsl:when>
846
975
  <xsl:when test="@ancestor = 'annex' and $level = '1'">14pt</xsl:when>
847
976
  <!-- <xsl:when test="@ancestor = 'foreword' and $level &gt;= '2'">12pt</xsl:when>
848
977
  <xsl:when test=". = 'Executive summary'">18pt</xsl:when>
@@ -879,7 +1008,7 @@
879
1008
  <xsl:variable name="margin-top">
880
1009
  <xsl:choose>
881
1010
  <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
882
- <xsl:when test="@ancestor = 'annex' and $level = '1' and preceding-sibling::*[1][local-name() = 'annex' and @commentary = 'true']">1mm</xsl:when>
1011
+ <xsl:when test="@ancestor = 'annex' and $level = '1' and preceding-sibling::*[local-name() = 'annex'][1][@commentary = 'true']">1mm</xsl:when>
883
1012
  <xsl:when test="$level = 1">6.5mm</xsl:when>
884
1013
  <xsl:when test="@ancestor = 'foreword' and $level = 2">0mm</xsl:when>
885
1014
  <xsl:when test="@ancestor = 'annex' and $level = 2">4.5mm</xsl:when>
@@ -900,7 +1029,7 @@
900
1029
  <xsl:variable name="margin-bottom">
901
1030
  <xsl:choose>
902
1031
  <xsl:when test="@ancestor = 'foreword' and $level = 1">9mm</xsl:when>
903
- <xsl:when test="@ancestor = 'annex' and $level = '1' and preceding-sibling::*[1][local-name() = 'annex' and @commentary = 'true']">7mm</xsl:when>
1032
+ <xsl:when test="@ancestor = 'annex' and $level = '1' and preceding-sibling::*[local-name() = 'annex'][1][@commentary = 'true']">7mm</xsl:when>
904
1033
  <xsl:when test="$level = 1 and following-sibling::jis:clause">8pt</xsl:when>
905
1034
  <xsl:when test="$level = 1">12pt</xsl:when>
906
1035
  <xsl:when test="$level = 2 and following-sibling::jis:clause">8pt</xsl:when>
@@ -1167,7 +1296,7 @@
1167
1296
  </xsl:if>
1168
1297
  </xsl:template>
1169
1298
 
1170
- <xsl:template match="*[local-name() = 'span'][@class = 'surname' or @class = 'givenname']" mode="update_xml_step1" priority="2">
1299
+ <xsl:template match="*[local-name() = 'span'][@class = 'surname' or @class = 'givenname' or @class = 'JIS' or @class = 'EffectiveYear' or @class = 'CommentaryEffectiveYear']" mode="update_xml_step1" priority="2">
1171
1300
  <xsl:copy>
1172
1301
  <xsl:apply-templates select="@* | node()" mode="update_xml_step1"/>
1173
1302
  </xsl:copy>
@@ -1370,7 +1499,10 @@
1370
1499
 
1371
1500
  <xsl:template match="*[local-name() = 'font_en'][normalize-space() != '']">
1372
1501
  <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
1373
- <fo:inline font-family="Times New Roman">
1502
+ <fo:inline>
1503
+ <xsl:if test="not(ancestor::jis:p[@class = 'zzSTDTitle2']) and not(ancestor::jis:span[@class = 'JIS'])">
1504
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1505
+ </xsl:if>
1374
1506
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
1375
1507
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1376
1508
  </xsl:if>
@@ -1786,11 +1918,26 @@
1786
1918
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
1787
1919
  </xsl:if>
1788
1920
 
1789
- <xsl:value-of select="."/>
1921
+ <xsl:variable name="font_family" select="."/>
1790
1922
 
1791
- <xsl:if test="$additional_fonts != ''">
1792
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1793
- </xsl:if>
1923
+ <xsl:choose>
1924
+ <xsl:when test="$additional_fonts = ''">
1925
+ <xsl:value-of select="$font_family"/>
1926
+ </xsl:when>
1927
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
1928
+ <xsl:choose>
1929
+ <xsl:when test="contains($font_family, ',')">
1930
+ <xsl:value-of select="substring-before($font_family, ',')"/>
1931
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1932
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
1933
+ </xsl:when>
1934
+ <xsl:otherwise>
1935
+ <xsl:value-of select="$font_family"/>
1936
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1937
+ </xsl:otherwise>
1938
+ </xsl:choose>
1939
+ </xsl:otherwise>
1940
+ </xsl:choose>
1794
1941
  </xsl:attribute>
1795
1942
  </xsl:when>
1796
1943
  <xsl:otherwise>
@@ -2018,6 +2165,7 @@
2018
2165
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
2019
2166
 
2020
2167
  <xsl:attribute name="font-size">9pt</xsl:attribute>
2168
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2021
2169
 
2022
2170
  </xsl:attribute-set> <!-- table-container-style -->
2023
2171
 
@@ -2181,6 +2329,10 @@
2181
2329
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2182
2330
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2183
2331
 
2332
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
2333
+ <xsl:attribute name="margin-bottom">1pt</xsl:attribute>
2334
+ <xsl:attribute name="margin-left"><xsl:value-of select="$text_indent"/></xsl:attribute>
2335
+
2184
2336
  </xsl:attribute-set><!-- table-note-style -->
2185
2337
 
2186
2338
  <xsl:template name="refine_table-note-style">
@@ -2191,7 +2343,7 @@
2191
2343
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2192
2344
 
2193
2345
  <xsl:attribute name="font-size">inherit</xsl:attribute>
2194
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2346
+ <xsl:attribute name="margin-bottom">1pt</xsl:attribute>
2195
2347
 
2196
2348
  </xsl:attribute-set> <!-- table-fn-style -->
2197
2349
 
@@ -2203,7 +2355,7 @@
2203
2355
  <xsl:attribute name="font-size">67%</xsl:attribute>
2204
2356
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2205
2357
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2206
- <xsl:attribute name="padding-right">3mm</xsl:attribute>
2358
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
2207
2359
 
2208
2360
  </xsl:attribute-set> <!-- table-fn-number-style -->
2209
2361
 
@@ -3993,11 +4145,7 @@
3993
4145
 
3994
4146
  <!-- except gb and bsi -->
3995
4147
 
3996
- <xsl:apply-templates select="../*[local-name()='p']"/>
3997
- <xsl:apply-templates select="../*[local-name()='dl']"/>
3998
- <xsl:apply-templates select="../*[local-name()='note']"/>
3999
- <xsl:apply-templates select="../*[local-name()='example']"/>
4000
- <xsl:apply-templates select="../*[local-name()='source']"/>
4148
+ <xsl:apply-templates select="../*[local-name()='p' or local-name()='dl' or local-name()='note' or local-name()='example' or local-name()='source']"/>
4001
4149
 
4002
4150
  <xsl:variable name="isDisplayRowSeparator">
4003
4151
 
@@ -4268,21 +4416,21 @@
4268
4416
 
4269
4417
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4270
4418
 
4271
- <fo:block xsl:use-attribute-sets="table-note-style">
4272
-
4273
- <xsl:call-template name="refine_table-note-style"/>
4274
-
4275
- <!-- Table's note/example name (NOTE, for example) -->
4276
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
4277
-
4278
- <xsl:call-template name="refine_table-note-name-style"/>
4279
-
4280
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4281
-
4282
- </fo:inline>
4283
-
4284
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4285
- </fo:block>
4419
+ <fo:list-block id="{@id}" xsl:use-attribute-sets="table-note-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
4420
+ <fo:list-item>
4421
+ <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
4422
+ <fo:block>
4423
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
4424
+ </fo:block>
4425
+ </fo:list-item-label>
4426
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">
4427
+ <fo:block>
4428
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4429
+ </fo:block>
4430
+ </fo:list-item-body>
4431
+ </fo:list-item>
4432
+ </fo:list-block>
4433
+ <!-- jis -->
4286
4434
 
4287
4435
  </xsl:template> <!-- table/note -->
4288
4436
 
@@ -4485,7 +4633,7 @@
4485
4633
  <xsl:variable name="reference" select="@reference"/>
4486
4634
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4487
4635
 
4488
- <fo:list-block id="{@id}" xsl:use-attribute-sets="table-fn-style" provisional-distance-between-starts="{12 + $text_indent}mm">
4636
+ <fo:list-block id="{@id}" xsl:use-attribute-sets="table-fn-style" provisional-distance-between-starts="{9 + $text_indent}mm"> <!-- 12 -->
4489
4637
  <fo:list-item>
4490
4638
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
4491
4639
  <fo:block>
@@ -4501,7 +4649,7 @@
4501
4649
  </fo:inline>
4502
4650
  </fo:block>
4503
4651
  </fo:list-item-label>
4504
- <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">&gt;
4652
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="table-fn-body-style">
4505
4653
  <fo:block>
4506
4654
  <xsl:copy-of select="./node()"/>
4507
4655
  </fo:block>
@@ -5363,6 +5511,9 @@
5363
5511
  <!-- END Definition List -->
5364
5512
  <!-- ===================== -->
5365
5513
 
5514
+ <!-- default: ignore title in sections/p -->
5515
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
5516
+
5366
5517
  <!-- ========================= -->
5367
5518
  <!-- Rich text formatting -->
5368
5519
  <!-- ========================= -->
@@ -7408,8 +7559,12 @@
7408
7559
  <xsl:variable name="isAdded" select="../@added"/>
7409
7560
  <xsl:variable name="isDeleted" select="../@deleted"/>
7410
7561
  <xsl:choose>
7411
- <xsl:when test="ancestor::*[local-name() = 'title']">
7562
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7412
7563
  <fo:inline padding-left="1mm" padding-right="1mm">
7564
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7565
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
7566
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
7567
+ </xsl:if>
7413
7568
  <xsl:variable name="src">
7414
7569
  <xsl:call-template name="image_src"/>
7415
7570
  </xsl:variable>
@@ -7442,25 +7597,45 @@
7442
7597
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7443
7598
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7444
7599
 
7445
- <xsl:variable name="img_src">
7446
- <xsl:choose>
7447
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7448
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7449
- </xsl:choose>
7450
- </xsl:variable>
7600
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7601
+ <xsl:attribute name="width">
7602
+ <xsl:value-of select="@width"/>
7603
+ </xsl:attribute>
7604
+ </xsl:if>
7451
7605
 
7452
- <xsl:variable name="image_width_effective">
7606
+ <xsl:if test="@height != '' and @height != 'auto'">
7607
+ <xsl:attribute name="height">
7608
+ <xsl:value-of select="@height"/>
7609
+ </xsl:attribute>
7610
+ </xsl:if>
7453
7611
 
7454
- <xsl:value-of select="$width_effective"/>
7612
+ <xsl:choose>
7613
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
7614
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
7615
+ </xsl:when>
7616
+ <xsl:otherwise>
7455
7617
 
7456
- </xsl:variable>
7618
+ <xsl:variable name="img_src">
7619
+ <xsl:choose>
7620
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7621
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7622
+ </xsl:choose>
7623
+ </xsl:variable>
7457
7624
 
7458
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7459
- <xsl:if test="number($scale) &lt; 100">
7625
+ <xsl:variable name="image_width_effective">
7460
7626
 
7461
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7627
+ <xsl:value-of select="$width_effective"/>
7462
7628
 
7463
- </xsl:if>
7629
+ </xsl:variable>
7630
+
7631
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7632
+ <xsl:if test="number($scale) &lt; 100">
7633
+
7634
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7635
+
7636
+ </xsl:if>
7637
+ </xsl:otherwise>
7638
+ </xsl:choose>
7464
7639
 
7465
7640
  </xsl:if>
7466
7641
 
@@ -11122,7 +11297,7 @@
11122
11297
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
11123
11298
  <xsl:apply-templates mode="update_xml_step1"/>
11124
11299
  </xsl:template>
11125
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11300
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11126
11301
  <xsl:copy>
11127
11302
  <xsl:copy-of select="@*"/>
11128
11303
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -135,7 +135,7 @@ module IsoDoc
135
135
  end
136
136
 
137
137
  def annex1(elem)
138
- elem["commentary"] == "true" and return
138
+ elem["commentary"] == "true" and return commentary(elem)
139
139
  lbl = @xrefs.anchor(elem["id"], :label)
140
140
  if t = elem.at(ns("./title"))
141
141
  t.children = "<strong>#{to_xml(t.children)}</strong>"
@@ -157,21 +157,19 @@ module IsoDoc
157
157
  end
158
158
  end
159
159
 
160
- def display_order(docxml)
161
- i = 0
162
- i = display_order_xpath(docxml, "//preface/*", i)
163
- i = display_order_at(docxml, "//sections/introduction", i)
164
- i = display_order_at(docxml, "//clause[@type = 'scope']", i)
165
- i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
166
- i = display_order_at(docxml, "//sections/terms | " \
167
- "//sections/clause[descendant::terms]", i)
168
- i = display_order_at(docxml, "//sections/definitions", i)
169
- i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
170
- i = display_order_xpath(docxml, "//annex[not(@commentary = 'true')]", i)
171
- i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
172
- i = display_order_xpath(docxml, "//annex[@commentary = 'true']", i)
173
- i = display_order_xpath(docxml, "//indexsect", i)
174
- display_order_xpath(docxml, "//colophon/*", i)
160
+ def commentary(elem)
161
+ t = elem.elements.first
162
+ commentary_title_hdr(t)
163
+ middle_title_main(t, "CommentaryStandardName")
164
+ end
165
+
166
+ def commentary_title_hdr(elem)
167
+ ret = <<~COMMENTARY
168
+ <p class="CommentaryStandardNumber">JIS #{@meta.get[:docnumber_undated]}
169
+ COMMENTARY
170
+ yr = @meta.get[:docyear] and
171
+ ret += ": <span class='CommentaryEffectiveYear'>#{yr}</span>"
172
+ elem.previous = ret
175
173
  end
176
174
 
177
175
  def tablesource(elem)
@@ -202,6 +200,60 @@ module IsoDoc
202
200
  dest.children.first.next = source
203
201
  end
204
202
 
203
+ def middle_title(docxml)
204
+ s = docxml.at(ns("//sections")) or return
205
+ elem = s.children.first
206
+ middle_title_hdr(elem)
207
+ middle_title_main(elem, "zzSTDTitle1")
208
+ middle_subtitle_main(elem)
209
+ # middle_title_amd(s.children.first)
210
+ end
211
+
212
+ def middle_title_hdr(out)
213
+ ret = "<p class='JapaneseIndustrialStandard'>#{@i18n.jis}"
214
+ @meta.get[:unpublished] and ret += @i18n.l10n("(#{@i18n.draft_label})")
215
+ ret += ("<tab/>" * 7)
216
+ ret += "<span class='JIS'>JIS</span></p>"
217
+ ret += "<p class='StandardNumber'><tab/>#{@meta.get[:docnumber_undated]}"
218
+ if yr = @meta.get[:docyear]
219
+ ret += ": <span class='EffectiveYear'>#{yr}</span>"
220
+ end
221
+ ret += "</p><p class='IDT'/>"
222
+ out.previous = ret
223
+ end
224
+
225
+ def middle_title_main(out, style)
226
+ t = @meta.get[:doctitlemain]
227
+ (t && !t.empty?) or return
228
+ ret = "<p class='#{style}'>#{@meta.get[:doctitleintro]}"
229
+ ret += " &#x2014; " if @meta.get[:doctitleintro] && t
230
+ ret += t
231
+ ret += " &#x2014; " if t && @meta.get[:doctitlepart]
232
+ ret += "</p>"
233
+ if a = @meta.get[:doctitlepart]
234
+ ret += "<p class='zzSTDTitle1'>"
235
+ b = @meta.get[:doctitlepartlabel] and ret += "#{b}: "
236
+ ret += "<br/><strong>#{a}</strong></p>"
237
+ end
238
+ out.previous = ret
239
+ end
240
+
241
+ def middle_subtitle_main(out)
242
+ t = @meta.get[:docsubtitlemain]
243
+ (t && !t.empty?) or return
244
+ ret = "<p class='zzSTDTitle2'>#{@meta.get[:docsubtitleintro]}"
245
+ ret += " &#x2014; " if @meta.get[:docsubtitleintro] && t
246
+ ret += @meta.get[:docsubtitlemain]
247
+ ret += " &#x2014; " if t && @meta.get[:docsubtitlepart]
248
+ ret += "</p>"
249
+ if a = @meta.get[:docsubtitlepart]
250
+ ret += "<p class='zzSTDTitle2'>"
251
+ b = @meta.get[:docsubtitlepartlabel] and ret += "#{b}: "
252
+ ret += "<br/><strong>#{a}</strong></p>"
253
+ end
254
+ out.previous = ret
255
+ end
256
+
205
257
  include Init
206
258
  end
207
259
  end