metanorma-iso 1.3.25 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +6 -3
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Gemfile +1 -0
  6. data/Rakefile +2 -0
  7. data/lib/asciidoctor/iso/base.rb +16 -13
  8. data/lib/asciidoctor/iso/biblio.rng +14 -4
  9. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  10. data/lib/asciidoctor/iso/front.rb +3 -155
  11. data/lib/asciidoctor/iso/front_id.rb +196 -0
  12. data/lib/asciidoctor/iso/isodoc.rng +444 -1
  13. data/lib/asciidoctor/iso/isostandard.rng +10 -1
  14. data/lib/asciidoctor/iso/reqt.rng +23 -0
  15. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +7 -10
  16. data/lib/asciidoctor/iso/validate.rb +1 -5
  17. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  18. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  19. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  20. data/lib/isodoc/iso/base_convert.rb +67 -112
  21. data/lib/isodoc/iso/html/header.html +5 -1
  22. data/lib/isodoc/iso/html/html_iso_titlepage.html +9 -0
  23. data/lib/isodoc/iso/html/htmlstyle.scss +0 -1
  24. data/lib/isodoc/iso/html/isodoc.scss +25 -1
  25. data/lib/isodoc/iso/html/style-human.scss +8 -1
  26. data/lib/isodoc/iso/html/style-iso.scss +8 -1
  27. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  28. data/lib/isodoc/iso/html/word_iso_titlepage.html +4 -4
  29. data/lib/isodoc/iso/html/wordstyle.scss +20 -7
  30. data/lib/isodoc/iso/iso.amendment.xsl +5114 -0
  31. data/lib/isodoc/iso/iso.international-standard.xsl +1258 -530
  32. data/lib/isodoc/iso/metadata.rb +31 -27
  33. data/lib/isodoc/iso/pdf_convert.rb +5 -11
  34. data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
  35. data/lib/isodoc/iso/sections.rb +66 -0
  36. data/lib/isodoc/iso/sts_convert.rb +31 -0
  37. data/lib/isodoc/iso/xref.rb +111 -0
  38. data/lib/metanorma-iso.rb +2 -0
  39. data/lib/metanorma/iso/processor.rb +14 -8
  40. data/lib/metanorma/iso/version.rb +1 -1
  41. data/metanorma-iso.gemspec +6 -2
  42. data/spec/asciidoctor-iso/amd_spec.rb +412 -4
  43. data/spec/asciidoctor-iso/base_spec.rb +18 -16
  44. data/spec/asciidoctor-iso/cleanup_spec.rb +2 -2
  45. data/spec/asciidoctor-iso/macros_spec.rb +33 -17
  46. data/spec/asciidoctor-iso/refs_spec.rb +1 -1
  47. data/spec/asciidoctor-iso/table_spec.rb +1 -1
  48. data/spec/isodoc/amd_spec.rb +652 -0
  49. data/spec/isodoc/blocks_spec.rb +112 -27
  50. data/spec/isodoc/inline_spec.rb +2 -2
  51. data/spec/isodoc/metadata_spec.rb +88 -4
  52. data/spec/isodoc/postproc_spec.rb +9 -9
  53. data/spec/isodoc/ref_spec.rb +6 -6
  54. data/spec/isodoc/section_spec.rb +28 -1
  55. data/spec/isodoc/table_spec.rb +8 -8
  56. data/spec/isodoc/terms_spec.rb +4 -4
  57. data/spec/isodoc/xref_spec.rb +24 -18
  58. data/spec/metanorma/processor_spec.rb +2 -2
  59. metadata +73 -11
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -24,18 +24,15 @@
24
24
  <xsl:variable name="ISOname" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-reference']"/>
25
25
 
26
26
  <!-- Information and documentation — Codes for transcription systems -->
27
- <xsl:variable name="title-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'main']"/>
28
- <xsl:variable name="title-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'main']"/>
29
27
  <xsl:variable name="title-intro" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-intro']"/>
30
28
  <xsl:variable name="title-intro-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-intro']"/>
31
29
  <xsl:variable name="title-main" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-main']"/>
32
30
  <xsl:variable name="title-main-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-main']"/>
33
31
  <xsl:variable name="part" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@part"/>
34
- <xsl:variable name="title-part" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
35
- <xsl:variable name="title-part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
36
-
37
- <xsl:variable name="doctype_uppercased" select="translate(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype,'-',' '), $lower,$upper)"/>
38
32
 
33
+ <xsl:variable name="doctype" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:doctype"/>
34
+ <xsl:variable name="doctype_uppercased" select="java:toUpperCase(java:java.lang.String.new(translate($doctype,'-',' ')))"/>
35
+
39
36
  <xsl:variable name="stage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:stage)"/>
40
37
  <xsl:variable name="substage" select="number(/iso:iso-standard/iso:bibdata/iso:status/iso:substage)"/>
41
38
  <xsl:variable name="stagename" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename)"/>
@@ -62,8 +59,8 @@
62
59
 
63
60
  <xsl:variable name="stage-fullname-uppercased">
64
61
  <xsl:choose>
65
- <xsl:when test="$stagename != ''">
66
- <xsl:value-of select="translate($stagename, $lower, $upper)"/>
62
+ <xsl:when test="$stagename != ''">
63
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
67
64
  </xsl:when>
68
65
  <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
69
66
  <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
@@ -144,10 +141,6 @@
144
141
  </xsl:variable>
145
142
 
146
143
  <xsl:variable name="proof-text">PROOF/ÉPREUVE</xsl:variable>
147
-
148
- <xsl:variable name="title-figure">
149
- <xsl:text>Figure </xsl:text>
150
- </xsl:variable>
151
144
 
152
145
  <!-- Example:
153
146
  <item level="1" id="Foreword" display="true">Foreword</item>
@@ -315,33 +308,7 @@
315
308
 
316
309
  </fo:layout-master-set>
317
310
 
318
- <fo:declarations>
319
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
320
- <pdf:dictionary type="normal" key="ViewerPreferences">
321
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
322
- </pdf:dictionary>
323
- </pdf:catalog>
324
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
325
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
326
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
327
- <!-- Dublin Core properties go here -->
328
- <dc:title><xsl:value-of select="$title-en"/></dc:title>
329
- <dc:creator><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:contributor[iso:role/@type='author']/iso:organization/iso:name"/></dc:creator>
330
- <dc:description>
331
- <xsl:variable name="abstract">
332
- <xsl:copy-of select="/iso:iso-standard/iso:bibliography/iso:references/iso:bibitem/iso:abstract//text()"/>
333
- </xsl:variable>
334
- <xsl:value-of select="normalize-space($abstract)"/>
335
- </dc:description>
336
- <pdf:Keywords/>
337
- </rdf:Description>
338
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
339
- <!-- XMP properties go here -->
340
- <xmp:CreatorTool/>
341
- </rdf:Description>
342
- </rdf:RDF>
343
- </x:xmpmeta>
344
- </fo:declarations>
311
+ <xsl:call-template name="addPDFUAmeta"/>
345
312
 
346
313
  <!-- cover page -->
347
314
  <xsl:choose>
@@ -518,8 +485,10 @@
518
485
  </xsl:if>
519
486
 
520
487
  <xsl:value-of select="$title-main"/>
488
+
489
+ <xsl:call-template name="printTitlePartEn"/>
521
490
 
522
- <xsl:if test="normalize-space($title-part) != ''">
491
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
523
492
  <xsl:if test="$part != ''">
524
493
  <xsl:text> — </xsl:text>
525
494
  <fo:block font-weight="normal" margin-top="6pt">
@@ -528,7 +497,7 @@
528
497
  </fo:block>
529
498
  </xsl:if>
530
499
  <xsl:value-of select="$title-part"/>
531
- </xsl:if>
500
+ </xsl:if> -->
532
501
  </fo:block>
533
502
 
534
503
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -540,16 +509,9 @@
540
509
  </xsl:if>
541
510
 
542
511
  <xsl:value-of select="$title-main-fr"/>
512
+
513
+ <xsl:call-template name="printTitlePartFr"/>
543
514
 
544
- <xsl:if test="normalize-space($title-part-fr) != ''">
545
- <xsl:if test="$part != ''">
546
- <xsl:text> — </xsl:text>
547
- <xsl:text>Partie </xsl:text>
548
- <xsl:value-of select="$part"/>
549
- <xsl:text>:</xsl:text>
550
- </xsl:if>
551
- <xsl:value-of select="$title-part-fr"/>
552
- </xsl:if>
553
515
  </fo:block>
554
516
  </fo:block>
555
517
  <fo:block margin-top="10mm">
@@ -681,7 +643,8 @@
681
643
 
682
644
  <xsl:value-of select="$title-main"/>
683
645
 
684
- <xsl:if test="normalize-space($title-part) != ''">
646
+ <xsl:call-template name="printTitlePartEn"/>
647
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
685
648
  <xsl:if test="$part != ''">
686
649
  <xsl:text> — </xsl:text>
687
650
  <fo:block font-weight="normal" margin-top="6pt">
@@ -690,7 +653,7 @@
690
653
  </fo:block>
691
654
  </xsl:if>
692
655
  <xsl:value-of select="$title-part"/>
693
- </xsl:if>
656
+ </xsl:if> -->
694
657
  </fo:block>
695
658
 
696
659
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -703,15 +666,8 @@
703
666
 
704
667
  <xsl:value-of select="$title-main-fr"/>
705
668
 
706
- <xsl:if test="normalize-space($title-part-fr) != ''">
707
- <xsl:if test="$part != ''">
708
- <xsl:text> — </xsl:text>
709
- <xsl:text>Partie </xsl:text>
710
- <xsl:value-of select="$part"/>
711
- <xsl:text>:</xsl:text>
712
- </xsl:if>
713
- <xsl:value-of select="$title-part-fr"/>
714
- </xsl:if>
669
+ <xsl:call-template name="printTitlePartFr"/>
670
+
715
671
  </fo:block>
716
672
  </fo:block>
717
673
  </fo:block-container>
@@ -801,7 +757,8 @@
801
757
 
802
758
  <xsl:value-of select="$title-main"/>
803
759
 
804
- <xsl:if test="normalize-space($title-part) != ''">
760
+ <xsl:call-template name="printTitlePartEn"/>
761
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
805
762
  <xsl:if test="$part != ''">
806
763
  <xsl:text> — </xsl:text>
807
764
  <fo:block font-weight="normal" margin-top="6pt">
@@ -810,7 +767,7 @@
810
767
  </fo:block>
811
768
  </xsl:if>
812
769
  <xsl:value-of select="$title-part"/>
813
- </xsl:if>
770
+ </xsl:if> -->
814
771
  </fo:block>
815
772
 
816
773
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -823,15 +780,8 @@
823
780
 
824
781
  <xsl:value-of select="$title-main-fr"/>
825
782
 
826
- <xsl:if test="normalize-space($title-part-fr) != ''">
827
- <xsl:if test="$part != ''">
828
- <xsl:text> — </xsl:text>
829
- <xsl:text>Partie </xsl:text>
830
- <xsl:value-of select="$part"/>
831
- <xsl:text>:</xsl:text>
832
- </xsl:if>
833
- <xsl:value-of select="$title-part-fr"/>
834
- </xsl:if>
783
+ <xsl:call-template name="printTitlePartFr"/>
784
+
835
785
  </fo:block>
836
786
  </fo:block>
837
787
  </fo:block-container>
@@ -920,7 +870,8 @@
920
870
 
921
871
  <xsl:value-of select="$title-main"/>
922
872
 
923
- <xsl:if test="normalize-space($title-part) != ''">
873
+ <xsl:call-template name="printTitlePartEn"/>
874
+ <!-- <xsl:if test="normalize-space($title-part) != ''">
924
875
  <xsl:if test="$part != ''">
925
876
  <xsl:text> — </xsl:text>
926
877
  <fo:block font-weight="normal" margin-top="6pt">
@@ -929,7 +880,7 @@
929
880
  </fo:block>
930
881
  </xsl:if>
931
882
  <xsl:value-of select="$title-part"/>
932
- </xsl:if>
883
+ </xsl:if> -->
933
884
  </fo:block>
934
885
 
935
886
  <fo:block font-size="12pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -941,15 +892,17 @@
941
892
 
942
893
  <xsl:value-of select="$title-main-fr"/>
943
894
 
944
- <xsl:if test="normalize-space($title-part-fr) != ''">
895
+ <xsl:variable name="part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
896
+ <xsl:if test="normalize-space($part-fr) != ''">
945
897
  <xsl:if test="$part != ''">
946
898
  <xsl:text> — </xsl:text>
947
899
  <fo:block margin-top="6pt" font-weight="normal">
948
- <xsl:text>Partie </xsl:text><xsl:value-of select="$part"/>
949
- <xsl:text>:</xsl:text>
900
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
901
+ <!-- <xsl:value-of select="$title-part-fr"/><xsl:value-of select="$part"/>
902
+ <xsl:text>:</xsl:text> -->
950
903
  </fo:block>
951
904
  </xsl:if>
952
- <xsl:value-of select="$title-part-fr"/>
905
+ <xsl:value-of select="$part-fr"/>
953
906
  </xsl:if>
954
907
  </fo:block>
955
908
  </fo:block-container>
@@ -989,81 +942,101 @@
989
942
  <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
990
943
  </fo:block>
991
944
  </fo:block>
992
- </fo:block-container>
993
- <fo:block break-after="page"/>
945
+ </fo:block-container>
994
946
  </xsl:if>
995
947
 
996
- <fo:block-container font-weight="bold">
997
-
998
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
999
- <fo:inline font-size="16pt" font-weight="bold">Contents</fo:inline>
1000
- <fo:inline keep-together.within-line="always">
1001
- <fo:leader leader-pattern="space"/>
1002
- <fo:inline font-weight="normal" font-size="10pt">Page</fo:inline>
1003
- </fo:inline>
1004
- </fo:block>
1005
-
1006
- <xsl:if test="$debug = 'true'">
1007
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1008
- DEBUG
1009
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
1010
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1011
- </xsl:if>
948
+
949
+ <xsl:choose>
950
+ <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1012
951
 
1013
- <xsl:variable name="margin-left">12</xsl:variable>
1014
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
1015
-
1016
- <fo:block>
1017
- <xsl:if test="@level = 1">
1018
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
1019
- </xsl:if>
1020
- <xsl:if test="@level = 3">
1021
- <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
952
+ <xsl:otherwise>
953
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
954
+ <fo:block break-after="page"/>
955
+ </xsl:if>
956
+ <fo:block-container font-weight="bold">
957
+
958
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
959
+ <xsl:variable name="title-toc">
960
+ <xsl:call-template name="getTitle">
961
+ <xsl:with-param name="name" select="'title-toc'"/>
962
+ </xsl:call-template>
963
+ </xsl:variable>
964
+ <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
965
+ <fo:inline keep-together.within-line="always">
966
+ <fo:leader leader-pattern="space"/>
967
+ <xsl:variable name="title-page">
968
+ <xsl:call-template name="getTitle">
969
+ <xsl:with-param name="name" select="'title-page'"/>
970
+ </xsl:call-template>
971
+ </xsl:variable>
972
+ <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
973
+ </fo:inline>
974
+ </fo:block>
975
+
976
+ <xsl:if test="$debug = 'true'">
977
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
978
+ DEBUG
979
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
980
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1022
981
  </xsl:if>
1023
- <fo:list-block>
1024
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1025
- <xsl:if test="@level &gt;= 2">
1026
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1027
- </xsl:if>
1028
- <xsl:attribute name="provisional-distance-between-starts">
1029
- <xsl:choose>
1030
- <!-- skip 0 section without subsections -->
1031
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1032
- <xsl:when test="@section != '' and not(@display-section = 'false')"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1033
- <xsl:otherwise>0mm</xsl:otherwise>
1034
- </xsl:choose>
1035
- </xsl:attribute>
1036
- <fo:list-item>
1037
- <fo:list-item-label end-indent="label-end()">
1038
- <fo:block>
1039
- <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
1040
- <xsl:value-of select="@section"/>
1041
- </xsl:if>
1042
- </fo:block>
1043
- </fo:list-item-label>
1044
- <fo:list-item-body start-indent="body-start()">
1045
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1046
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1047
- <xsl:if test="@section and @display-section = 'false'">
1048
- <xsl:value-of select="@section"/><xsl:text> </xsl:text>
1049
- </xsl:if>
1050
- <xsl:if test="@addon != ''">
1051
- <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
982
+
983
+ <xsl:variable name="margin-left">12</xsl:variable>
984
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
985
+
986
+ <fo:block>
987
+ <xsl:if test="@level = 1">
988
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
989
+ </xsl:if>
990
+ <xsl:if test="@level = 3">
991
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
992
+ </xsl:if>
993
+ <fo:list-block>
994
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
995
+ <xsl:if test="@level &gt;= 2">
996
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
997
+ </xsl:if>
998
+ <xsl:attribute name="provisional-distance-between-starts">
999
+ <xsl:choose>
1000
+ <!-- skip 0 section without subsections -->
1001
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1002
+ <xsl:when test="@section != '' and not(@display-section = 'false')"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1003
+ <xsl:otherwise>0mm</xsl:otherwise>
1004
+ </xsl:choose>
1005
+ </xsl:attribute>
1006
+ <fo:list-item>
1007
+ <fo:list-item-label end-indent="label-end()">
1008
+ <fo:block>
1009
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
1010
+ <xsl:value-of select="@section"/>
1052
1011
  </xsl:if>
1053
- <xsl:text> </xsl:text><xsl:value-of select="text()"/>
1054
- <fo:inline keep-together.within-line="always">
1055
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1056
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1057
- </fo:inline>
1058
- </fo:basic-link>
1059
- </fo:block>
1060
- </fo:list-item-body>
1061
- </fo:list-item>
1062
- </fo:list-block>
1063
- </fo:block>
1064
-
1065
- </xsl:for-each>
1066
- </fo:block-container>
1012
+ </fo:block>
1013
+ </fo:list-item-label>
1014
+ <fo:list-item-body start-indent="body-start()">
1015
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1016
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1017
+ <xsl:if test="@section and @display-section = 'false'">
1018
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
1019
+ </xsl:if>
1020
+ <xsl:if test="@addon != ''">
1021
+ <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
1022
+ </xsl:if>
1023
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
1024
+ <fo:inline keep-together.within-line="always">
1025
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1026
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1027
+ </fo:inline>
1028
+ </fo:basic-link>
1029
+ </fo:block>
1030
+ </fo:list-item-body>
1031
+ </fo:list-item>
1032
+ </fo:list-block>
1033
+ </fo:block>
1034
+
1035
+ </xsl:for-each>
1036
+ </fo:block-container>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
1039
+
1067
1040
  <!-- Foreword, Introduction -->
1068
1041
  <xsl:apply-templates select="/iso:iso-standard/iso:preface/node()"/>
1069
1042
 
@@ -1088,6 +1061,7 @@
1088
1061
  </fo:block>
1089
1062
  -->
1090
1063
  <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1064
+ <xsl:variable name="part-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
1091
1065
  <fo:block>
1092
1066
  <xsl:if test="normalize-space($title-intro) != ''">
1093
1067
  <xsl:value-of select="$title-intro"/>
@@ -1096,22 +1070,42 @@
1096
1070
 
1097
1071
  <xsl:value-of select="$title-main"/>
1098
1072
 
1099
- <xsl:if test="normalize-space($title-part) != ''">
1073
+ <xsl:if test="normalize-space($part-en) != ''">
1100
1074
  <xsl:if test="$part != ''">
1101
1075
  <xsl:text> — </xsl:text>
1102
1076
  <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1103
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1104
- <xsl:text>:</xsl:text>
1077
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1078
+ <!-- <xsl:value-of select="$title-part-en"/>
1079
+ <xsl:value-of select="$part"/>
1080
+ <xsl:text>:</xsl:text> -->
1105
1081
  </fo:block>
1106
1082
  </xsl:if>
1107
1083
  </xsl:if>
1108
1084
  </fo:block>
1109
1085
  <fo:block>
1110
- <xsl:value-of select="$title-part"/>
1086
+ <xsl:value-of select="$part-en"/>
1111
1087
  </fo:block>
1088
+
1089
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
1090
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1091
+ <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1092
+ <xsl:variable name="title-amendment">
1093
+ <xsl:call-template name="getTitle">
1094
+ <xsl:with-param name="name" select="'title-amendment'"/>
1095
+ </xsl:call-template>
1096
+ </xsl:variable>
1097
+ <xsl:value-of select="$title-amendment"/>
1098
+ <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1099
+ <xsl:if test="normalize-space($amendment-number) != ''">
1100
+ <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1101
+ </xsl:if>
1102
+ <xsl:text>: </xsl:text>
1103
+ <xsl:value-of select="$title-amd"/>
1104
+ </fo:block>
1105
+ </xsl:if>
1106
+
1112
1107
  </fo:block>
1113
1108
 
1114
-
1115
1109
  </fo:block-container>
1116
1110
  <!-- Clause(s) -->
1117
1111
  <fo:block>
@@ -1187,6 +1181,19 @@
1187
1181
  <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1188
1182
  </xsl:choose> -->
1189
1183
  </fo:block>
1184
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1185
+ <fo:block font-size="9pt" margin-bottom="6pt">
1186
+ <xsl:variable name="title-descriptors">
1187
+ <xsl:call-template name="getTitle">
1188
+ <xsl:with-param name="name" select="'title-descriptors'"/>
1189
+ </xsl:call-template>
1190
+ </xsl:variable>
1191
+ <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1192
+ <xsl:call-template name="insertKeywords">
1193
+ <xsl:with-param name="sorting">no</xsl:with-param>
1194
+ </xsl:call-template>
1195
+ </fo:block>
1196
+ </xsl:if>
1190
1197
  <fo:block font-size="9pt">Price based on <fo:page-number-citation ref-id="lastBlock"/> pages</fo:block>
1191
1198
  </fo:block-container>
1192
1199
  </fo:block-container>
@@ -1303,8 +1310,7 @@
1303
1310
  <xsl:template match="iso:figure" mode="contents">
1304
1311
  <item level="" id="{@id}" display="false">
1305
1312
  <xsl:attribute name="section">
1306
- <xsl:call-template name="getFigureNumber"/>
1307
- <!-- <xsl:text>Figure </xsl:text><xsl:number format="A.1-1" level="multiple" count="iso:annex | iso:figure"/> -->
1313
+ <xsl:call-template name="getFigureNumber"/>
1308
1314
  </xsl:attribute>
1309
1315
  </item>
1310
1316
  </xsl:template>
@@ -1314,21 +1320,14 @@
1314
1320
  <xsl:param name="sectionNum"/>
1315
1321
  <xsl:variable name="annex-id" select="ancestor::iso:annex/@id"/>
1316
1322
  <item level="" id="{@id}" display="false" type="table">
1317
- <xsl:attribute name="section">
1318
- <xsl:text>Table </xsl:text>
1319
- <xsl:choose>
1320
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1321
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
1322
- </xsl:when>
1323
- <xsl:when test="ancestor::*[local-name()='annex']">
1324
- <xsl:number format="A-" count="iso:annex"/>
1325
- <xsl:number format="1" level="any" count="iso:table[ancestor::iso:annex[@id = $annex-id]]"/>
1326
- </xsl:when>
1327
- <xsl:otherwise>
1328
- <!-- <xsl:number format="1"/> -->
1329
- <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
1330
- </xsl:otherwise>
1331
- </xsl:choose>
1323
+ <xsl:attribute name="section">
1324
+ <xsl:variable name="title-table">
1325
+ <xsl:call-template name="getTitle">
1326
+ <xsl:with-param name="name" select="'title-table'"/>
1327
+ </xsl:call-template>
1328
+ </xsl:variable>
1329
+ <xsl:value-of select="$title-table"/>
1330
+ <xsl:call-template name="getTableNumber"/>
1332
1331
  </xsl:attribute>
1333
1332
  <xsl:value-of select="iso:name/text()"/>
1334
1333
  </item>
@@ -1337,7 +1336,15 @@
1337
1336
  <xsl:template match="iso:formula" mode="contents">
1338
1337
  <item level="" id="{@id}" display="false">
1339
1338
  <xsl:attribute name="section">
1340
- <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="iso:annex | iso:formula"/><xsl:text>)</xsl:text>
1339
+ <xsl:variable name="title-formula">
1340
+ <xsl:call-template name="getTitle">
1341
+ <xsl:with-param name="name" select="'title-formula'"/>
1342
+ </xsl:call-template>
1343
+ </xsl:variable>
1344
+ <xsl:value-of select="$title-formula"/>
1345
+ <xsl:call-template name="getFormulaNumber">
1346
+ <xsl:with-param name="display" select="not(@unnumbered = 'true')"/>
1347
+ </xsl:call-template>
1341
1348
  </xsl:attribute>
1342
1349
  </item>
1343
1350
  </xsl:template>
@@ -1443,7 +1450,7 @@
1443
1450
  <xsl:param name="sectionNum"/>
1444
1451
  <xsl:param name="sectionNumSkew" select="0"/>
1445
1452
  <fo:block>
1446
- <xsl:variable name="pos"><xsl:number count="iso:sections/iso:clause | iso:sections/iso:terms"/></xsl:variable>
1453
+ <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable> <!-- iso:sections/iso:clause | iso:sections/iso:terms | iso:sections/iso:definitions -->
1447
1454
  <xsl:if test="$pos &gt;= 2">
1448
1455
  <xsl:attribute name="space-before">18pt</xsl:attribute>
1449
1456
  </xsl:if>
@@ -1452,7 +1459,7 @@
1452
1459
  <xsl:choose>
1453
1460
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1454
1461
  <xsl:when test="$sectionNumSkew != 0">
1455
- <xsl:variable name="number"><xsl:number count="iso:sections/iso:clause | iso:sections/iso:terms"/></xsl:variable>
1462
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!--iso:sections/iso:clause | iso:sections/iso:terms | iso:sections/iso:definitions -->
1456
1463
  <xsl:value-of select="$number + $sectionNumSkew"/>
1457
1464
  </xsl:when>
1458
1465
  </xsl:choose>
@@ -1531,6 +1538,11 @@
1531
1538
  </xsl:variable>
1532
1539
 
1533
1540
  <xsl:choose>
1541
+ <xsl:when test="$doctype = 'amendment'">
1542
+ <fo:block id="{$id}" font-size="11pt" font-style="italic" margin-bottom="12pt" keep-with-next="always">
1543
+ <xsl:apply-templates/>
1544
+ </fo:block>
1545
+ </xsl:when>
1534
1546
  <xsl:when test="$parent-name = 'annex'">
1535
1547
  <fo:block id="{$id}" font-size="16pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always">
1536
1548
  <xsl:value-of select="$section"/>
@@ -1724,7 +1736,7 @@
1724
1736
  <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
1725
1737
  </fo:block>
1726
1738
  <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">
1727
- <xsl:value-of select="$title-figure"/>
1739
+ <!-- <xsl:value-of select="$title-figure"/> -->
1728
1740
  <xsl:call-template name="getFigureNumber"/>
1729
1741
  </fo:block>
1730
1742
  </fo:block-container>
@@ -1740,9 +1752,12 @@
1740
1752
  <xsl:call-template name="note"/>
1741
1753
  </xsl:for-each>
1742
1754
  <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
1743
- <xsl:call-template name="getFigureNumber"/>
1755
+ <xsl:variable name="figureNumber">
1756
+ <xsl:call-template name="getFigureNumber"/>
1757
+ </xsl:variable>
1758
+ <xsl:value-of select="$figureNumber"/>
1744
1759
  <xsl:if test="iso:name">
1745
- <xsl:if test="not(local-name(..) = 'figure')">
1760
+ <xsl:if test="not(local-name(..) = 'figure') and normalize-space($figureNumber) != ''">
1746
1761
  <xsl:text> — </xsl:text>
1747
1762
  </xsl:if>
1748
1763
  <xsl:value-of select="iso:name"/>
@@ -1752,7 +1767,13 @@
1752
1767
  </xsl:template>
1753
1768
 
1754
1769
  <xsl:template name="getFigureNumber">
1770
+ <xsl:variable name="title-figure">
1771
+ <xsl:call-template name="getTitle">
1772
+ <xsl:with-param name="name" select="'title-figure'"/>
1773
+ </xsl:call-template>
1774
+ </xsl:variable>
1755
1775
  <xsl:choose>
1776
+ <xsl:when test="$doctype = 'amendment'"/>
1756
1777
  <xsl:when test="ancestor::iso:annex">
1757
1778
  <xsl:choose>
1758
1779
  <xsl:when test="local-name(..) = 'figure'">
@@ -1793,15 +1814,17 @@
1793
1814
 
1794
1815
  <xsl:template match="iso:bibitem">
1795
1816
  <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
1796
- <!-- iso:docidentifier -->
1797
- <xsl:if test="iso:docidentifier">
1798
- <xsl:choose>
1799
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1800
- <xsl:otherwise><fo:inline><xsl:value-of select="iso:docidentifier"/></fo:inline></xsl:otherwise>
1801
- </xsl:choose>
1802
- </xsl:if>
1803
- <xsl:apply-templates select="iso:note"/>
1804
- <xsl:if test="iso:docidentifier">, </xsl:if>
1817
+ <xsl:variable name="docidentifier">
1818
+ <xsl:if test="iso:docidentifier">
1819
+ <xsl:choose>
1820
+ <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
1821
+ <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
1822
+ </xsl:choose>
1823
+ </xsl:if>
1824
+ </xsl:variable>
1825
+ <xsl:value-of select="$docidentifier"/>
1826
+ <xsl:apply-templates select="iso:note"/>
1827
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1805
1828
  <fo:inline font-style="italic">
1806
1829
  <xsl:choose>
1807
1830
  <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
@@ -1822,13 +1845,13 @@
1822
1845
  <xsl:number level="any" count="iso:bibitem/iso:note"/>
1823
1846
  </xsl:variable>
1824
1847
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="30%"> <!--85% vertical-align="super"-->
1825
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1848
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1826
1849
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1827
1850
  </fo:basic-link>
1828
1851
  </fo:inline>
1829
1852
  <fo:footnote-body>
1830
1853
  <fo:block font-size="10pt" margin-bottom="4pt" start-indent="0pt">
1831
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1854
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" alignment-baseline="hanging" padding-right="3mm"><!-- font-size="60%" -->
1832
1855
  <xsl:value-of select="$number"/><xsl:text>)</xsl:text>
1833
1856
  </fo:inline>
1834
1857
  <xsl:apply-templates/>
@@ -1866,7 +1889,7 @@
1866
1889
 
1867
1890
  <xsl:template match="iso:term">
1868
1891
  <xsl:param name="sectionNum"/>
1869
- <fo:block margin-bottom="10pt">
1892
+ <fo:block id="{@id}" margin-bottom="10pt">
1870
1893
  <xsl:apply-templates>
1871
1894
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
1872
1895
  </xsl:apply-templates>
@@ -1877,7 +1900,7 @@
1877
1900
  <xsl:param name="sectionNum"/>
1878
1901
  <fo:block line-height="1.1">
1879
1902
  <fo:block font-weight="bold" keep-with-next="always">
1880
- <fo:inline id="{../@id}">
1903
+ <fo:inline>
1881
1904
  <xsl:variable name="section">
1882
1905
  <xsl:call-template name="getSection">
1883
1906
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -1900,7 +1923,12 @@
1900
1923
  </xsl:template>
1901
1924
 
1902
1925
  <xsl:template match="iso:deprecates">
1903
- <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1926
+ <xsl:variable name="title-deprecated">
1927
+ <xsl:call-template name="getTitle">
1928
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1929
+ </xsl:call-template>
1930
+ </xsl:variable>
1931
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
1904
1932
  </xsl:template>
1905
1933
 
1906
1934
  <xsl:template match="iso:definition[preceding-sibling::iso:domain]">
@@ -1921,7 +1949,14 @@
1921
1949
  <fo:block margin-bottom="8pt"> <!-- keep-with-previous="always" -->
1922
1950
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1923
1951
  <fo:basic-link internal-destination="{iso:origin/@bibitemid}" fox:alt-text="{iso:origin/@citeas}">
1924
- <xsl:text>[SOURCE: </xsl:text>
1952
+ <xsl:text>[</xsl:text>
1953
+ <xsl:variable name="title-source">
1954
+ <xsl:call-template name="getTitle">
1955
+ <xsl:with-param name="name" select="'title-source'"/>
1956
+ </xsl:call-template>
1957
+ </xsl:variable>
1958
+ <xsl:value-of select="$title-source"/>
1959
+ <xsl:text>: </xsl:text>
1925
1960
  <xsl:value-of select="iso:origin/@citeas"/>
1926
1961
 
1927
1962
  <xsl:apply-templates select="iso:origin/iso:localityStack"/>
@@ -1935,19 +1970,23 @@
1935
1970
  </fo:block>
1936
1971
  </xsl:template>
1937
1972
 
1938
- <xsl:template match="iso:modification">
1939
- <xsl:text>, modified — </xsl:text>
1940
- <xsl:apply-templates/>
1941
- </xsl:template>
1973
+
1942
1974
  <xsl:template match="iso:modification/iso:p">
1943
1975
  <fo:inline><xsl:apply-templates/></fo:inline>
1944
1976
  </xsl:template>
1945
1977
 
1946
1978
  <xsl:template match="iso:termnote">
1947
1979
  <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
1948
- <xsl:text>Note </xsl:text>
1949
- <xsl:number/>
1950
- <xsl:text> to entry: </xsl:text>
1980
+ <!-- <xsl:text>Note </xsl:text>
1981
+ <xsl:number />
1982
+ <xsl:text> to entry: </xsl:text> -->
1983
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1984
+ <xsl:variable name="title-note-to-entry">
1985
+ <xsl:call-template name="getTitle">
1986
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1987
+ </xsl:call-template>
1988
+ </xsl:variable>
1989
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1951
1990
  <xsl:apply-templates/>
1952
1991
  </fo:block>
1953
1992
  </xsl:template>
@@ -1961,14 +2000,19 @@
1961
2000
  </xsl:template>
1962
2001
 
1963
2002
  <xsl:template match="iso:domain">
1964
- <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
2003
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline><xsl:text> </xsl:text>
1965
2004
  </xsl:template>
1966
2005
 
1967
2006
 
1968
2007
  <xsl:template match="iso:termexample">
1969
2008
  <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt" text-align="justify">
1970
2009
  <fo:inline padding-right="5mm">
1971
- <xsl:text>EXAMPLE </xsl:text>
2010
+ <xsl:variable name="title-example">
2011
+ <xsl:call-template name="getTitle">
2012
+ <xsl:with-param name="name" select="'title-example'"/>
2013
+ </xsl:call-template>
2014
+ </xsl:variable>
2015
+ <xsl:value-of select="$title-example"/>
1972
2016
  <xsl:if test="count(ancestor::iso:term[1]//iso:termexample) &gt; 1">
1973
2017
  <xsl:number/>
1974
2018
  </xsl:if>
@@ -2009,14 +2053,17 @@
2009
2053
  </fo:list-item-label>
2010
2054
  <fo:list-item-body start-indent="body-start()">
2011
2055
  <fo:block>
2012
- <xsl:if test="iso:docidentifier">
2013
- <xsl:choose>
2014
- <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
2015
- <xsl:otherwise><fo:inline><xsl:value-of select="iso:docidentifier"/></fo:inline></xsl:otherwise>
2016
- </xsl:choose>
2017
- </xsl:if>
2056
+ <xsl:variable name="docidentifier">
2057
+ <xsl:if test="iso:docidentifier">
2058
+ <xsl:choose>
2059
+ <xsl:when test="iso:docidentifier/@type = 'metanorma'"/>
2060
+ <xsl:otherwise><xsl:value-of select="iso:docidentifier"/></xsl:otherwise>
2061
+ </xsl:choose>
2062
+ </xsl:if>
2063
+ </xsl:variable>
2064
+ <xsl:value-of select="$docidentifier"/>
2018
2065
  <xsl:apply-templates select="iso:note"/>
2019
- <xsl:if test="iso:docidentifier">, </xsl:if>
2066
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
2020
2067
  <xsl:choose>
2021
2068
  <xsl:when test="iso:title[@type = 'main' and @language = 'en']">
2022
2069
  <xsl:apply-templates select="iso:title[@type = 'main' and @language = 'en']"/>
@@ -2048,7 +2095,8 @@
2048
2095
  </fo:block>
2049
2096
  <fo:block text-align="right">
2050
2097
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
2051
- <xsl:text>— </xsl:text><xsl:value-of select="iso:author"/>
2098
+ <xsl:apply-templates select="iso:author"/>
2099
+ <!-- <xsl:text>— </xsl:text><xsl:value-of select="iso:author"/> -->
2052
2100
  <xsl:if test="iso:source">
2053
2101
  <xsl:text>, </xsl:text>
2054
2102
  <xsl:apply-templates select="iso:source"/>
@@ -2056,70 +2104,17 @@
2056
2104
  </fo:block>
2057
2105
  </xsl:template>
2058
2106
 
2107
+ <xsl:template match="iso:quote/iso:author">
2108
+ <xsl:text>— </xsl:text><xsl:apply-templates/>
2109
+ </xsl:template>
2110
+
2059
2111
  <xsl:template match="iso:source">
2060
2112
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
2061
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2113
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2062
2114
  <xsl:apply-templates select="iso:localityStack"/>
2063
2115
  </fo:basic-link>
2064
2116
  </xsl:template>
2065
2117
 
2066
- <xsl:template match="iso:appendix">
2067
- <fo:block font-size="12pt" font-weight="bold" margin-top="12pt" margin-bottom="12pt">
2068
- <fo:inline padding-right="5mm">Appendix <xsl:number/></fo:inline>
2069
- <xsl:apply-templates select="iso:title" mode="process"/>
2070
- </fo:block>
2071
- <xsl:apply-templates/>
2072
- </xsl:template>
2073
-
2074
- <xsl:template match="iso:appendix//iso:example">
2075
- <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt">
2076
- <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2077
- <xsl:text>EXAMPLE </xsl:text>
2078
- <xsl:if test="count(ancestor::iso:clause[1]//iso:example) &gt; 1">
2079
- <xsl:number count="iso:example[ancestor::iso:clause[@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
2080
- </xsl:if>
2081
- <xsl:if test="iso:name">
2082
- <xsl:text>— </xsl:text><xsl:apply-templates select="iso:name" mode="process"/>
2083
- </xsl:if>
2084
- </fo:block>
2085
- <xsl:apply-templates/>
2086
- </xsl:template>
2087
-
2088
- <xsl:template match="iso:appendix//iso:example/iso:name"/>
2089
- <xsl:template match="iso:appendix//iso:example/iso:name" mode="process">
2090
- <fo:inline><xsl:apply-templates/></fo:inline>
2091
- </xsl:template>
2092
-
2093
- <!-- <xsl:template match="iso:callout/text()">
2094
- <fo:basic-link internal-destination="{@target}"><fo:inline>&lt;<xsl:apply-templates />&gt;</fo:inline></fo:basic-link>
2095
- </xsl:template> -->
2096
- <xsl:template match="iso:callout">
2097
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
2098
- </xsl:template>
2099
-
2100
- <xsl:template match="iso:annotation">
2101
- <fo:block>
2102
-
2103
- </fo:block>
2104
- <xsl:apply-templates/>
2105
- </xsl:template>
2106
-
2107
- <xsl:template match="iso:annotation/text()"/>
2108
-
2109
- <xsl:template match="iso:annotation/iso:p">
2110
- <xsl:variable name="annotation-id" select="../@id"/>
2111
- <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
2112
- <fo:block id="{$annotation-id}">
2113
- <xsl:value-of select="concat('&lt;', $callout, '&gt; ')"/>
2114
- <xsl:apply-templates/>
2115
- </fo:block>
2116
- </xsl:template>
2117
-
2118
-
2119
- <xsl:template match="iso:appendix/iso:title"/>
2120
- <xsl:template match="iso:appendix/iso:title" mode="process">
2121
- <fo:inline><xsl:apply-templates/></fo:inline>
2122
- </xsl:template>
2123
2118
 
2124
2119
  <xsl:template match="mathml:math" priority="2">
2125
2120
  <fo:inline font-family="Cambria Math">
@@ -2142,8 +2137,15 @@
2142
2137
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
2143
2138
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
2144
2139
  <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
2140
+
2141
+ <xsl:variable name="title-clause">
2142
+ <xsl:call-template name="getTitle">
2143
+ <xsl:with-param name="name" select="'title-clause'"/>
2144
+ </xsl:call-template>
2145
+ </xsl:variable>
2146
+
2145
2147
  <xsl:choose>
2146
- <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1">Clause </xsl:when><!-- and not (ancestor::annex) -->
2148
+ <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
2147
2149
  <xsl:when test="$type = 'li'">
2148
2150
  <xsl:attribute name="color">black</xsl:attribute>
2149
2151
  <xsl:attribute name="text-decoration">none</xsl:attribute>
@@ -2164,18 +2166,6 @@
2164
2166
  <xsl:value-of select="$section"/>
2165
2167
  </fo:basic-link>
2166
2168
  </xsl:template>
2167
-
2168
- <xsl:template match="iso:sourcecode">
2169
- <fo:block font-family="Courier" font-size="9pt" margin-bottom="12pt">
2170
- <xsl:choose>
2171
- <xsl:when test="@lang = 'en'"/>
2172
- <xsl:otherwise>
2173
- <xsl:attribute name="white-space">pre</xsl:attribute>
2174
- </xsl:otherwise>
2175
- </xsl:choose>
2176
- <xsl:apply-templates/>
2177
- </fo:block>
2178
- </xsl:template>
2179
2169
 
2180
2170
  <xsl:template match="iso:example/iso:p">
2181
2171
  <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt">
@@ -2183,8 +2173,13 @@
2183
2173
  <xsl:attribute name="font-size">11pt</xsl:attribute>
2184
2174
  </xsl:if> -->
2185
2175
  <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2186
- <fo:inline padding-right="5mm">
2187
- <xsl:text>EXAMPLE </xsl:text>
2176
+ <fo:inline padding-right="5mm">
2177
+ <xsl:variable name="title-example">
2178
+ <xsl:call-template name="getTitle">
2179
+ <xsl:with-param name="name" select="'title-example'"/>
2180
+ </xsl:call-template>
2181
+ </xsl:variable>
2182
+ <xsl:value-of select="$title-example"/>
2188
2183
  <xsl:if test="count(ancestor::iso:clause[1]//iso:example) &gt; 1">
2189
2184
  <xsl:number count="iso:example[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
2190
2185
  </xsl:if>
@@ -2196,8 +2191,13 @@
2196
2191
  <xsl:template match="iso:note/iso:p" name="note">
2197
2192
  <fo:block font-size="10pt" margin-top="8pt" margin-bottom="12pt" text-align="justify">
2198
2193
  <xsl:variable name="claims_id" select="ancestor::iso:clause[1]/@id"/>
2199
- <fo:inline padding-right="6mm">
2200
- <xsl:text>NOTE </xsl:text>
2194
+ <fo:inline padding-right="6mm">
2195
+ <xsl:variable name="title-note">
2196
+ <xsl:call-template name="getTitle">
2197
+ <xsl:with-param name="name" select="'title-note'"/>
2198
+ </xsl:call-template>
2199
+ </xsl:variable>
2200
+ <xsl:value-of select="$title-note"/>
2201
2201
  <xsl:if test="count(ancestor::iso:clause[1]//iso:note) &gt; 1">
2202
2202
  <xsl:number count="iso:note[ancestor::iso:clause[@id = $claims_id]]" level="any"/>
2203
2203
  </xsl:if>
@@ -2222,7 +2222,7 @@
2222
2222
 
2223
2223
  <xsl:choose>
2224
2224
  <xsl:when test="@citeas and normalize-space(text()) = ''">
2225
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2225
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2226
2226
  </xsl:when>
2227
2227
  <xsl:when test="@bibitemid and normalize-space(text()) = ''">
2228
2228
  <xsl:value-of select="//iso:bibitem[@id = current()/@bibitemid]/iso:docidentifier"/>
@@ -2235,25 +2235,46 @@
2235
2235
  </xsl:template>
2236
2236
 
2237
2237
  <xsl:template match="iso:locality">
2238
+ <xsl:variable name="title-clause">
2239
+ <xsl:call-template name="getTitle">
2240
+ <xsl:with-param name="name" select="'title-clause'"/>
2241
+ </xsl:call-template>
2242
+ </xsl:variable>
2243
+ <xsl:variable name="title-annex">
2244
+ <xsl:call-template name="getTitle">
2245
+ <xsl:with-param name="name" select="'title-annex'"/>
2246
+ </xsl:call-template>
2247
+ </xsl:variable>
2248
+ <xsl:variable name="title-table">
2249
+ <xsl:call-template name="getTitle">
2250
+ <xsl:with-param name="name" select="'title-table'"/>
2251
+ </xsl:call-template>
2252
+ </xsl:variable>
2238
2253
  <xsl:choose>
2239
2254
  <xsl:when test="ancestor::iso:termsource"/>
2240
2255
  <xsl:when test="@type ='clause' and ancestor::iso:eref"/>
2241
- <xsl:when test="@type ='clause'">Clause </xsl:when>
2242
- <xsl:when test="@type ='annex'">Annex </xsl:when>
2243
- <xsl:when test="@type ='table'">Table </xsl:when>
2256
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
2257
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
2258
+ <xsl:when test="@type ='table'"><xsl:value-of select="$title-table"/></xsl:when>
2244
2259
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
2245
2260
  </xsl:choose>
2246
2261
  <xsl:text> </xsl:text><xsl:value-of select="iso:referenceFrom"/>
2247
2262
  </xsl:template>
2248
2263
 
2249
2264
  <xsl:template match="iso:admonition">
2250
- <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
2251
- <xsl:value-of select="translate(@type, $lower, $upper)"/>
2265
+ <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
2266
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
2252
2267
  <xsl:text> — </xsl:text>
2253
2268
  <xsl:apply-templates/>
2254
2269
  </fo:block>
2255
2270
  </xsl:template>
2256
2271
 
2272
+ <xsl:template match="iso:formula">
2273
+ <fo:block id="{@id}">
2274
+ <xsl:apply-templates/>
2275
+ </fo:block>
2276
+ </xsl:template>
2277
+
2257
2278
  <xsl:template match="iso:formula/iso:dt/iso:stem">
2258
2279
  <fo:inline>
2259
2280
  <xsl:apply-templates/>
@@ -2261,7 +2282,7 @@
2261
2282
  </xsl:template>
2262
2283
 
2263
2284
  <xsl:template match="iso:formula/iso:stem">
2264
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
2285
+ <fo:block margin-top="6pt" margin-bottom="12pt">
2265
2286
  <fo:table table-layout="fixed" width="100%">
2266
2287
  <fo:table-column column-width="95%"/>
2267
2288
  <fo:table-column column-width="5%"/>
@@ -2274,14 +2295,9 @@
2274
2295
  </fo:table-cell>
2275
2296
  <fo:table-cell display-align="center">
2276
2297
  <fo:block text-align="right">
2277
- <xsl:choose>
2278
- <xsl:when test="ancestor::iso:annex">
2279
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="iso:annex | iso:formula"/><xsl:text>)</xsl:text>
2280
- </xsl:when>
2281
- <xsl:otherwise> <!-- not(ancestor::iso:annex) -->
2282
- <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="iso:formula"/><xsl:text>)</xsl:text> -->
2283
- </xsl:otherwise>
2284
- </xsl:choose>
2298
+ <xsl:call-template name="getFormulaNumber">
2299
+ <xsl:with-param name="display" select="not(../@unnumbered = 'true')"/>
2300
+ </xsl:call-template>
2285
2301
  </fo:block>
2286
2302
  </fo:table-cell>
2287
2303
  </fo:table-row>
@@ -2380,38 +2396,6 @@
2380
2396
  </fo:static-content>
2381
2397
  </xsl:template>
2382
2398
 
2383
- <xsl:template name="getId">
2384
- <xsl:choose>
2385
- <xsl:when test="../@id">
2386
- <xsl:value-of select="../@id"/>
2387
- </xsl:when>
2388
- <xsl:otherwise>
2389
- <xsl:value-of select="text()"/>
2390
- </xsl:otherwise>
2391
- </xsl:choose>
2392
- </xsl:template>
2393
-
2394
- <xsl:template name="getLevel">
2395
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2396
- <xsl:variable name="level">
2397
- <xsl:choose>
2398
- <xsl:when test="ancestor::iso:preface">
2399
- <xsl:value-of select="$level_total - 2"/>
2400
- </xsl:when>
2401
- <xsl:when test="ancestor::iso:sections">
2402
- <xsl:value-of select="$level_total - 2"/>
2403
- </xsl:when>
2404
- <xsl:when test="ancestor::iso:bibliography">
2405
- <xsl:value-of select="$level_total - 2"/>
2406
- </xsl:when>
2407
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2408
- <xsl:otherwise>
2409
- <xsl:value-of select="$level_total - 1"/>
2410
- </xsl:otherwise>
2411
- </xsl:choose>
2412
- </xsl:variable>
2413
- <xsl:value-of select="$level"/>
2414
- </xsl:template>
2415
2399
 
2416
2400
  <xsl:template name="getSection">
2417
2401
  <xsl:param name="sectionNum"/>
@@ -2431,7 +2415,7 @@
2431
2415
  </xsl:when>
2432
2416
  <xsl:when test="$level &gt;= 2">
2433
2417
  <xsl:variable name="num">
2434
- <xsl:number format=".1" level="multiple" count="iso:clause/iso:clause | iso:clause/iso:terms | iso:terms/iso:term | iso:clause/iso:term | iso:terms/iso:clause | iso:terms/iso:definitions | iso:definitions/iso:clause | iso:clause/iso:definitions"/>
2418
+ <xsl:call-template name="getSubSection"/>
2435
2419
  </xsl:variable>
2436
2420
  <xsl:value-of select="concat($sectionNum, $num)"/>
2437
2421
  </xsl:when>
@@ -2455,7 +2439,12 @@
2455
2439
  <xsl:variable name="annexid" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid)"/>
2456
2440
  <xsl:choose>
2457
2441
  <xsl:when test="$level = 1">
2458
- <xsl:text>Annex </xsl:text>
2442
+ <xsl:variable name="title-annex">
2443
+ <xsl:call-template name="getTitle">
2444
+ <xsl:with-param name="name" select="'title-annex'"/>
2445
+ </xsl:call-template>
2446
+ </xsl:variable>
2447
+ <xsl:value-of select="$title-annex"/>
2459
2448
  <xsl:choose>
2460
2449
  <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
2461
2450
  <xsl:value-of select="$annexid"/>
@@ -2465,8 +2454,7 @@
2465
2454
  </xsl:otherwise>
2466
2455
  </xsl:choose>
2467
2456
  </xsl:when>
2468
- <xsl:otherwise>
2469
- <xsl:variable name="annexid" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:annexid)"/>
2457
+ <xsl:otherwise>
2470
2458
  <xsl:choose>
2471
2459
  <xsl:when test="count(//iso:annex) = 1 and $annexid != ''">
2472
2460
  <xsl:value-of select="$annexid"/><xsl:number format=".1" level="multiple" count="iso:clause"/>
@@ -3181,40 +3169,302 @@
3181
3169
  <xsl:value-of select="$edition"/>
3182
3170
  </xsl:when>
3183
3171
  </xsl:choose>
3184
- <xsl:if test="$edition != ''"><xsl:text> edition</xsl:text></xsl:if>
3172
+ <xsl:variable name="title-edition">
3173
+ <xsl:call-template name="getTitle">
3174
+ <xsl:with-param name="name" select="'title-edition'"/>
3175
+ </xsl:call-template>
3176
+ </xsl:variable>
3177
+ <xsl:if test="$edition != ''"><xsl:text> </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new($title-edition))"/></xsl:if>
3178
+ </xsl:template>
3179
+
3180
+ <xsl:template name="printTitlePartFr">
3181
+ <xsl:variable name="part-fr" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-part']"/>
3182
+ <xsl:if test="normalize-space($part-fr) != ''">
3183
+ <xsl:if test="$part != ''">
3184
+ <xsl:text> — </xsl:text>
3185
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part)"/>
3186
+ <!-- <xsl:value-of select="$title-part-fr"/>
3187
+ <xsl:value-of select="$part"/>
3188
+ <xsl:text>:</xsl:text> -->
3189
+ </xsl:if>
3190
+ <xsl:value-of select="$part-fr"/>
3191
+ </xsl:if>
3192
+ </xsl:template>
3193
+
3194
+ <xsl:template name="printTitlePartEn">
3195
+ <xsl:variable name="part-en" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-part']"/>
3196
+ <xsl:if test="normalize-space($part-en) != ''">
3197
+ <xsl:if test="$part != ''">
3198
+ <xsl:text> — </xsl:text>
3199
+ <fo:block font-weight="normal" margin-top="6pt">
3200
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
3201
+ <!-- <xsl:value-of select="$title-part-en"/>
3202
+ <xsl:value-of select="$part"/>
3203
+ <xsl:text>:</xsl:text> -->
3204
+ </fo:block>
3205
+ </xsl:if>
3206
+ <xsl:value-of select="$part-en"/>
3207
+ </xsl:if>
3208
+ </xsl:template>
3209
+
3210
+ <xsl:template name="getFormulaNumber">
3211
+ <xsl:param name="display" select="'true'"/>
3212
+ <xsl:if test="$display = 'true'">
3213
+ <xsl:choose>
3214
+ <xsl:when test="ancestor::iso:annex">
3215
+ <xsl:number format="(A.1)" level="multiple" count="iso:annex | iso:formula[not(@unnumbered='true')]"/>
3216
+ </xsl:when>
3217
+ <xsl:otherwise> <!-- not(ancestor::iso:annex) -->
3218
+ <xsl:text>(</xsl:text><xsl:number level="any" count="iso:formula[not(@unnumbered='true')]"/><xsl:text>)</xsl:text>
3219
+ </xsl:otherwise>
3220
+ </xsl:choose>
3221
+ </xsl:if>
3185
3222
  </xsl:template>
3186
3223
 
3187
- <xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
3224
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
3188
3225
 
3189
- <xsl:attribute name="color">blue</xsl:attribute>
3190
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3226
+ <title-table lang="en">Table </title-table>
3227
+ <title-table lang="fr">Tableau </title-table>
3228
+
3229
+ <title-table lang="zh">Table </title-table>
3191
3230
 
3192
3231
 
3193
- </xsl:attribute-set><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
3194
- <xsl:value-of select="."/>
3195
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
3196
- <xsl:value-of select="$linebreak"/>
3197
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3198
- <xsl:call-template name="add-zero-spaces"/>
3199
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
3200
-
3201
- <xsl:variable name="simple-table">
3202
- <!-- <xsl:copy> -->
3203
- <xsl:call-template name="getSimpleTable"/>
3204
- <!-- </xsl:copy> -->
3205
- </xsl:variable>
3206
-
3207
- <!-- DEBUG -->
3208
- <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
3209
- <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
3210
3232
 
3211
- <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3233
+ <title-note lang="en">NOTE </title-note>
3234
+ <title-note lang="fr">NOTE </title-note>
3212
3235
 
3213
- <!-- <xsl:if test="$namespace = 'iso'">
3214
- <fo:block space-before="6pt">&#xA0;</fo:block>
3215
- </xsl:if> -->
3236
+ <title-note lang="zh">NOTE </title-note>
3216
3237
 
3217
- <xsl:choose>
3238
+
3239
+
3240
+ <title-figure lang="en">Figure </title-figure>
3241
+ <title-figure lang="fr">Figure </title-figure>
3242
+
3243
+ <title-figure lang="zh">Figure </title-figure>
3244
+
3245
+
3246
+
3247
+ <title-example lang="en">EXAMPLE </title-example>
3248
+ <title-example lang="fr">EXEMPLE </title-example>
3249
+
3250
+ <title-example lang="zh">EXAMPLE </title-example>
3251
+
3252
+
3253
+
3254
+ <title-example-xref lang="en">Example </title-example-xref>
3255
+ <title-example-xref lang="fr">Exemple </title-example-xref>
3256
+
3257
+ <title-section lang="en">Section </title-section>
3258
+ <title-section lang="fr">Section </title-section>
3259
+
3260
+ <title-inequality lang="en">Inequality </title-inequality>
3261
+ <title-inequality lang="fr">Inequality </title-inequality>
3262
+
3263
+ <title-equation lang="en">Equation </title-equation>
3264
+ <title-equation lang="fr">Equation </title-equation>
3265
+
3266
+ <title-annex lang="en">Annex </title-annex>
3267
+ <title-annex lang="fr">Annexe </title-annex>
3268
+
3269
+ <title-annex lang="zh">Annex </title-annex>
3270
+
3271
+
3272
+
3273
+ <title-appendix lang="en">Appendix </title-appendix>
3274
+ <title-appendix lang="fr">Appendix </title-appendix>
3275
+
3276
+ <title-clause lang="en">Clause </title-clause>
3277
+ <title-clause lang="fr">Article </title-clause>
3278
+
3279
+ <title-clause lang="zh">Clause </title-clause>
3280
+
3281
+
3282
+
3283
+ <title-edition lang="en">
3284
+
3285
+ <xsl:text>Edition </xsl:text>
3286
+
3287
+
3288
+ </title-edition>
3289
+
3290
+ <title-formula lang="en">Formula </title-formula>
3291
+ <title-formula lang="fr">Formula </title-formula>
3292
+
3293
+ <title-toc lang="en">
3294
+
3295
+ <xsl:text>Contents</xsl:text>
3296
+
3297
+
3298
+
3299
+ </title-toc>
3300
+ <title-toc lang="fr">Sommaire</title-toc>
3301
+
3302
+ <title-toc lang="zh">Contents</title-toc>
3303
+
3304
+
3305
+
3306
+ <title-page lang="en">Page</title-page>
3307
+ <title-page lang="fr">Page</title-page>
3308
+
3309
+ <title-key lang="en">Key</title-key>
3310
+ <title-key lang="fr">Légende</title-key>
3311
+
3312
+ <title-where lang="en">where</title-where>
3313
+ <title-where lang="fr">où</title-where>
3314
+
3315
+ <title-descriptors lang="en">Descriptors</title-descriptors>
3316
+
3317
+ <title-part lang="en">
3318
+
3319
+ <xsl:text>Part #:</xsl:text>
3320
+
3321
+
3322
+ </title-part>
3323
+ <title-part lang="fr">
3324
+
3325
+ <xsl:text>Partie #:</xsl:text>
3326
+
3327
+
3328
+ </title-part>
3329
+ <title-part lang="zh">第 # 部分:</title-part>
3330
+
3331
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
3332
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
3333
+
3334
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
3335
+
3336
+
3337
+
3338
+ <title-modified lang="en">modified</title-modified>
3339
+ <title-modified lang="fr">modifiée</title-modified>
3340
+
3341
+ <title-modified lang="zh">modified</title-modified>
3342
+
3343
+
3344
+
3345
+ <title-source lang="en">SOURCE</title-source>
3346
+
3347
+ <title-keywords lang="en">Keywords</title-keywords>
3348
+
3349
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
3350
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
3351
+
3352
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
3353
+
3354
+ <title-list-tables lang="en">List of Tables</title-list-tables>
3355
+
3356
+ <title-list-figures lang="en">List of Figures</title-list-figures>
3357
+
3358
+ <title-recommendation lang="en">Recommendation </title-recommendation>
3359
+
3360
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3361
+
3362
+ <title-abstract lang="en">Abstract</title-abstract>
3363
+
3364
+ <title-summary lang="en">Summary</title-summary>
3365
+
3366
+ <title-in lang="en">in </title-in>
3367
+
3368
+ <title-box lang="en">Box </title-box>
3369
+
3370
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3371
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3372
+
3373
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3374
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3375
+
3376
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3377
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3378
+
3379
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3380
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3381
+
3382
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3383
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
3384
+
3385
+ <title-caution lang="en">CAUTION</title-caution>
3386
+ <title-caution lang="zh">注意</title-caution>
3387
+
3388
+ <title-warning lang="en">WARNING</title-warning>
3389
+ <title-warning lang="zh">警告</title-warning>
3390
+
3391
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3392
+ </xsl:variable><xsl:template name="getTitle">
3393
+ <xsl:param name="name"/>
3394
+ <xsl:variable name="lang">
3395
+ <xsl:call-template name="getLang"/>
3396
+ </xsl:variable>
3397
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3398
+ <xsl:choose>
3399
+ <xsl:when test="normalize-space($title_) != ''">
3400
+ <xsl:value-of select="$title_"/>
3401
+ </xsl:when>
3402
+ <xsl:otherwise>
3403
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3404
+ </xsl:otherwise>
3405
+ </xsl:choose>
3406
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
3407
+
3408
+ <xsl:attribute name="color">blue</xsl:attribute>
3409
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3410
+
3411
+
3412
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
3413
+
3414
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
3415
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
3416
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3417
+
3418
+
3419
+
3420
+
3421
+
3422
+
3423
+
3424
+
3425
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
3426
+
3427
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
3428
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3429
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3430
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3431
+
3432
+
3433
+
3434
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
3435
+
3436
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3437
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
3438
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3439
+
3440
+
3441
+
3442
+ </xsl:attribute-set><xsl:template match="text()">
3443
+ <xsl:value-of select="."/>
3444
+ </xsl:template><xsl:template match="*[local-name()='br']">
3445
+ <xsl:value-of select="$linebreak"/>
3446
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3447
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3448
+ <xsl:call-template name="add-zero-spaces-java"/>
3449
+ </xsl:template><xsl:template match="*[local-name()='table']">
3450
+
3451
+ <xsl:variable name="simple-table">
3452
+ <!-- <xsl:copy> -->
3453
+ <xsl:call-template name="getSimpleTable"/>
3454
+ <!-- </xsl:copy> -->
3455
+ </xsl:variable>
3456
+
3457
+ <!-- DEBUG -->
3458
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
3459
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
3460
+
3461
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3462
+
3463
+ <!-- <xsl:if test="$namespace = 'iso'">
3464
+ <fo:block space-before="6pt">&#xA0;</fo:block>
3465
+ </xsl:if> -->
3466
+
3467
+ <xsl:choose>
3218
3468
  <xsl:when test="@unnumbered = 'true'"/>
3219
3469
  <xsl:otherwise>
3220
3470
 
@@ -3230,32 +3480,17 @@
3230
3480
 
3231
3481
 
3232
3482
 
3233
- <xsl:text>Table </xsl:text>
3234
- <xsl:choose>
3235
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3236
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3237
- </xsl:when>
3238
- <xsl:when test="ancestor::*[local-name()='annex']">
3239
-
3240
- <xsl:variable name="annex-id" select="ancestor::iso:annex/@id"/>
3241
- <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1" level="any" count="iso:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::iso:annex[@id = $annex-id]]"/>
3242
-
3243
-
3244
-
3245
-
3246
-
3247
-
3248
-
3249
-
3250
- </xsl:when>
3251
- <xsl:otherwise>
3252
-
3253
-
3254
- <xsl:number format="A." count="*[local-name()='annex']"/>
3255
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
3256
-
3257
- </xsl:otherwise>
3258
- </xsl:choose>
3483
+
3484
+ <xsl:variable name="title-table">
3485
+ <xsl:call-template name="getTitle">
3486
+ <xsl:with-param name="name" select="'title-table'"/>
3487
+ </xsl:call-template>
3488
+ </xsl:variable>
3489
+ <xsl:value-of select="$title-table"/>
3490
+
3491
+ <xsl:call-template name="getTableNumber"/>
3492
+
3493
+
3259
3494
  <xsl:if test="*[local-name()='name']">
3260
3495
 
3261
3496
 
@@ -3329,9 +3564,13 @@
3329
3564
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
3330
3565
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3331
3566
 
3567
+
3332
3568
  <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
3333
3569
 
3334
3570
  <xsl:attribute name="border">1.5pt solid black</xsl:attribute>
3571
+ <xsl:if test="*[local-name()='thead']">
3572
+ <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
3573
+ </xsl:if>
3335
3574
 
3336
3575
 
3337
3576
 
@@ -3347,9 +3586,10 @@
3347
3586
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3348
3587
 
3349
3588
 
3589
+
3350
3590
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3351
3591
  <xsl:choose>
3352
- <xsl:when test=". = 1">
3592
+ <xsl:when test=". = 1 or . = 0">
3353
3593
  <fo:table-column column-width="proportional-column-width(2)"/>
3354
3594
  </xsl:when>
3355
3595
  <xsl:otherwise>
@@ -3357,21 +3597,56 @@
3357
3597
  </xsl:otherwise>
3358
3598
  </xsl:choose>
3359
3599
  </xsl:for-each>
3360
- <xsl:apply-templates/>
3600
+
3601
+ <xsl:choose>
3602
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3603
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3604
+ </xsl:when>
3605
+ <xsl:otherwise>
3606
+ <xsl:apply-templates/>
3607
+ </xsl:otherwise>
3608
+ </xsl:choose>
3609
+
3361
3610
  </fo:table>
3362
3611
 
3363
3612
 
3364
3613
 
3365
3614
  </fo:block-container>
3366
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
3615
+ </xsl:template><xsl:template name="getTableNumber">
3616
+ <xsl:choose>
3617
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
3618
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
3619
+ </xsl:when>
3620
+ <xsl:when test="ancestor::*[local-name()='annex']">
3621
+
3622
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
3623
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
3624
+
3625
+
3626
+
3627
+
3628
+
3629
+
3630
+
3631
+
3632
+ </xsl:when>
3633
+ <xsl:otherwise>
3634
+
3635
+
3636
+ <xsl:number format="A." count="*[local-name()='annex']"/>
3637
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
3638
+
3639
+ </xsl:otherwise>
3640
+ </xsl:choose>
3641
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
3367
3642
  <xsl:apply-templates/>
3368
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
3643
+ </xsl:template><xsl:template name="calculate-columns-numbers">
3369
3644
  <xsl:param name="table-row"/>
3370
3645
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
3371
3646
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
3372
3647
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
3373
3648
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
3374
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
3649
+ </xsl:template><xsl:template name="calculate-column-widths">
3375
3650
  <xsl:param name="table"/>
3376
3651
  <xsl:param name="cols-count"/>
3377
3652
  <xsl:param name="curr-col" select="1"/>
@@ -3380,7 +3655,7 @@
3380
3655
  <xsl:if test="$curr-col &lt;= $cols-count">
3381
3656
  <xsl:variable name="widths">
3382
3657
  <xsl:choose>
3383
- <xsl:when test="not($table)">
3658
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
3384
3659
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
3385
3660
  <xsl:variable name="words">
3386
3661
  <xsl:call-template name="tokenize">
@@ -3419,9 +3694,16 @@
3419
3694
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3420
3695
  </xsl:variable>
3421
3696
  <xsl:variable name="words">
3697
+ <xsl:variable name="string_with_added_zerospaces">
3698
+ <xsl:call-template name="add-zero-spaces-java">
3699
+ <xsl:with-param name="text" select="$td_text"/>
3700
+ </xsl:call-template>
3701
+ </xsl:variable>
3422
3702
  <xsl:call-template name="tokenize">
3423
3703
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3424
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
3704
+ <!-- 2009 thinspace -->
3705
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3706
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
3425
3707
  </xsl:call-template>
3426
3708
  </xsl:variable>
3427
3709
  <xsl:variable name="max_length">
@@ -3462,17 +3744,46 @@
3462
3744
  <xsl:with-param name="table" select="$table"/>
3463
3745
  </xsl:call-template>
3464
3746
  </xsl:if>
3465
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
3747
+ </xsl:template><xsl:template match="text()" mode="td_text">
3466
3748
  <xsl:variable name="zero-space">​</xsl:variable>
3467
3749
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3468
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
3750
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3751
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3752
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3753
+ <xsl:value-of select="@target"/>
3754
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3755
+ <xsl:param name="cols-count"/>
3469
3756
  <!-- font-weight="bold" -->
3470
- <fo:table-header>
3757
+ <fo:table-header>
3758
+
3759
+ <fo:table-row>
3760
+ <fo:table-cell number-columns-spanned="{$cols-count}"> <!-- border-left="1pt solid white" border-right="1pt solid white" border-top="1pt solid white" -->
3761
+ <fo:block text-align="center" font-size="11pt" font-weight="bold">
3762
+ <!-- (continued) -->
3763
+ <fo:block-container position="absolute" top="-7mm">
3764
+ <fo:block>
3765
+ <fo:retrieve-table-marker retrieve-class-name="table_continued" retrieve-position-within-table="first-starting" retrieve-boundary-within-table="table-fragment"/>
3766
+ </fo:block>
3767
+ </fo:block-container>
3768
+
3769
+ </fo:block>
3770
+ <!-- <fo:block>fn_name_display
3771
+ <xsl:call-template name="fn_name_display"/>
3772
+ </fo:block> -->
3773
+
3774
+ </fo:table-cell>
3775
+ </fo:table-row>
3776
+
3471
3777
  <xsl:apply-templates/>
3472
3778
  </fo:table-header>
3473
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
3779
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3780
+ <fo:table-body>
3781
+ <xsl:apply-templates/>
3782
+ </fo:table-body>
3783
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3474
3784
  <xsl:apply-templates/>
3475
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
3785
+ </xsl:template><xsl:template name="insertTableFooter">
3786
+ <xsl:param name="cols-count"/>
3476
3787
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3477
3788
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
3478
3789
 
@@ -3483,22 +3794,7 @@
3483
3794
  <!-- if there are note(s) or fn(s) then create footer row -->
3484
3795
  <xsl:if test="$isNoteOrFnExist = 'true'">
3485
3796
 
3486
- <xsl:variable name="cols-count">
3487
- <xsl:choose>
3488
- <xsl:when test="../*[local-name()='thead']">
3489
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
3490
- <xsl:call-template name="calculate-columns-numbers">
3491
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3492
- </xsl:call-template>
3493
- </xsl:when>
3494
- <xsl:otherwise>
3495
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
3496
- <xsl:call-template name="calculate-columns-numbers">
3497
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3498
- </xsl:call-template>
3499
- </xsl:otherwise>
3500
- </xsl:choose>
3501
- </xsl:variable>
3797
+
3502
3798
 
3503
3799
  <fo:table-row>
3504
3800
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -3528,11 +3824,30 @@
3528
3824
  </fo:table-footer>
3529
3825
 
3530
3826
  </xsl:if>
3531
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
3827
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3828
+
3829
+ <xsl:variable name="cols-count">
3830
+ <xsl:choose>
3831
+ <xsl:when test="../*[local-name()='thead']">
3832
+ <xsl:call-template name="calculate-columns-numbers">
3833
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
3834
+ </xsl:call-template>
3835
+ </xsl:when>
3836
+ <xsl:otherwise>
3837
+ <xsl:call-template name="calculate-columns-numbers">
3838
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
3839
+ </xsl:call-template>
3840
+ </xsl:otherwise>
3841
+ </xsl:choose>
3842
+ </xsl:variable>
3532
3843
 
3533
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
3844
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
3845
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3846
+ </xsl:apply-templates>
3534
3847
 
3535
- <xsl:call-template name="insertTableFooter"/>
3848
+ <xsl:call-template name="insertTableFooter">
3849
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3850
+ </xsl:call-template>
3536
3851
 
3537
3852
  <fo:table-body>
3538
3853
  <xsl:apply-templates/>
@@ -3540,7 +3855,7 @@
3540
3855
 
3541
3856
  </fo:table-body>
3542
3857
 
3543
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
3858
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3544
3859
  <xsl:variable name="parent-name" select="local-name(..)"/>
3545
3860
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3546
3861
  <fo:table-row min-height="4mm">
@@ -3579,7 +3894,7 @@
3579
3894
 
3580
3895
  <xsl:apply-templates/>
3581
3896
  </fo:table-row>
3582
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
3897
+ </xsl:template><xsl:template match="*[local-name()='th']">
3583
3898
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3584
3899
 
3585
3900
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3604,7 +3919,7 @@
3604
3919
  <xsl:apply-templates/>
3605
3920
  </fo:block>
3606
3921
  </fo:table-cell>
3607
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
3922
+ </xsl:template><xsl:template match="*[local-name()='td']">
3608
3923
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3609
3924
  <!-- and ancestor::*[local-name() = 'thead'] -->
3610
3925
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
@@ -3632,6 +3947,26 @@
3632
3947
  </xsl:attribute>
3633
3948
  </xsl:if>
3634
3949
  <fo:block>
3950
+
3951
+ <xsl:variable name="row_number">
3952
+ <xsl:number format="1" count="*[local-name() = 'tr'] | *[local-name() = 'th']"/>
3953
+ </xsl:variable>
3954
+ <fo:marker marker-class-name="table_continued">
3955
+ <xsl:if test="$row_number &gt; 1">
3956
+ <fo:inline>
3957
+ <xsl:variable name="title-table">
3958
+ <xsl:call-template name="getTitle">
3959
+ <xsl:with-param name="name" select="'title-table'"/>
3960
+ </xsl:call-template>
3961
+ </xsl:variable>
3962
+ <xsl:value-of select="$title-table"/>
3963
+ <xsl:call-template name="getTableNumber"/>
3964
+ <xsl:text> </xsl:text>
3965
+ <fo:inline font-style="italic" font-weight="normal">(continued)</fo:inline>
3966
+ </fo:inline>
3967
+ </xsl:if>
3968
+ </fo:marker>
3969
+
3635
3970
  <xsl:apply-templates/>
3636
3971
  </fo:block>
3637
3972
  <!-- <xsl:choose>
@@ -3647,7 +3982,7 @@
3647
3982
 
3648
3983
 
3649
3984
  </fo:table-cell>
3650
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3985
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3651
3986
 
3652
3987
 
3653
3988
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -3657,9 +3992,17 @@
3657
3992
 
3658
3993
 
3659
3994
 
3995
+
3660
3996
  <fo:inline padding-right="2mm">
3661
3997
 
3662
- <xsl:text>NOTE </xsl:text>
3998
+
3999
+
4000
+ <xsl:variable name="title-note">
4001
+ <xsl:call-template name="getTitle">
4002
+ <xsl:with-param name="name" select="'title-note'"/>
4003
+ </xsl:call-template>
4004
+ </xsl:variable>
4005
+ <xsl:value-of select="$title-note"/>
3663
4006
 
3664
4007
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
3665
4008
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -3673,9 +4016,9 @@
3673
4016
  <xsl:apply-templates mode="process"/>
3674
4017
  </fo:block>
3675
4018
 
3676
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
4019
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3677
4020
  <xsl:apply-templates/>
3678
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
4021
+ </xsl:template><xsl:template name="fn_display">
3679
4022
  <xsl:variable name="references">
3680
4023
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3681
4024
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3695,6 +4038,7 @@
3695
4038
 
3696
4039
 
3697
4040
 
4041
+
3698
4042
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3699
4043
 
3700
4044
 
@@ -3714,7 +4058,7 @@
3714
4058
  </fo:block>
3715
4059
  </xsl:if>
3716
4060
  </xsl:for-each>
3717
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
4061
+ </xsl:template><xsl:template name="fn_name_display">
3718
4062
  <!-- <xsl:variable name="references">
3719
4063
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3720
4064
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3730,7 +4074,7 @@
3730
4074
  <xsl:apply-templates/>
3731
4075
  </fo:block>
3732
4076
  </xsl:for-each>
3733
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
4077
+ </xsl:template><xsl:template name="fn_display_figure">
3734
4078
  <xsl:variable name="key_iso">
3735
4079
  true <!-- and (not(@class) or @class !='pseudocode') -->
3736
4080
  </xsl:variable>
@@ -3741,6 +4085,36 @@
3741
4085
  </fn>
3742
4086
  </xsl:for-each>
3743
4087
  </xsl:variable>
4088
+
4089
+ <!-- current hierarchy is 'figure' element -->
4090
+ <xsl:variable name="following_dl_colwidths">
4091
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4092
+ <xsl:variable name="html-table">
4093
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4094
+ <xsl:element name="{$ns}:table">
4095
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4096
+ <tbody>
4097
+ <xsl:apply-templates mode="dl"/>
4098
+ </tbody>
4099
+ </xsl:for-each>
4100
+ </xsl:element>
4101
+ </xsl:variable>
4102
+
4103
+ <xsl:call-template name="calculate-column-widths">
4104
+ <xsl:with-param name="cols-count" select="2"/>
4105
+ <xsl:with-param name="table" select="$html-table"/>
4106
+ </xsl:call-template>
4107
+
4108
+ </xsl:if>
4109
+ </xsl:variable>
4110
+
4111
+
4112
+ <xsl:variable name="maxlength_dt">
4113
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4114
+ <xsl:call-template name="getMaxLength_dt"/>
4115
+ </xsl:for-each>
4116
+ </xsl:variable>
4117
+
3744
4118
  <xsl:if test="xalan:nodeset($references)//fn">
3745
4119
  <fo:block>
3746
4120
  <fo:table width="95%" table-layout="fixed">
@@ -3748,8 +4122,19 @@
3748
4122
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3749
4123
 
3750
4124
  </xsl:if>
3751
- <fo:table-column column-width="15%"/>
3752
- <fo:table-column column-width="85%"/>
4125
+ <xsl:choose>
4126
+ <!-- if there 'dl', then set same columns width -->
4127
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4128
+ <xsl:call-template name="setColumnWidth_dl">
4129
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4130
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4131
+ </xsl:call-template>
4132
+ </xsl:when>
4133
+ <xsl:otherwise>
4134
+ <fo:table-column column-width="15%"/>
4135
+ <fo:table-column column-width="85%"/>
4136
+ </xsl:otherwise>
4137
+ </xsl:choose>
3753
4138
  <fo:table-body>
3754
4139
  <xsl:for-each select="xalan:nodeset($references)//fn">
3755
4140
  <xsl:variable name="reference" select="@reference"/>
@@ -3781,7 +4166,7 @@
3781
4166
  </fo:block>
3782
4167
  </xsl:if>
3783
4168
 
3784
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
4169
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3785
4170
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3786
4171
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3787
4172
 
@@ -3799,11 +4184,11 @@
3799
4184
  <xsl:value-of select="@reference"/>
3800
4185
  </fo:basic-link>
3801
4186
  </fo:inline>
3802
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
4187
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3803
4188
  <fo:inline>
3804
4189
  <xsl:apply-templates/>
3805
4190
  </fo:inline>
3806
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
4191
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3807
4192
  <xsl:variable name="parent" select="local-name(..)"/>
3808
4193
 
3809
4194
  <xsl:variable name="key_iso">
@@ -3819,8 +4204,13 @@
3819
4204
  <fo:block margin-bottom="12pt" text-align="left">
3820
4205
 
3821
4206
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3822
-
3823
- <xsl:text>where </xsl:text>
4207
+
4208
+ <xsl:variable name="title-where">
4209
+ <xsl:call-template name="getTitle">
4210
+ <xsl:with-param name="name" select="'title-where'"/>
4211
+ </xsl:call-template>
4212
+ </xsl:variable>
4213
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3824
4214
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3825
4215
  <xsl:text/>
3826
4216
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3835,18 +4225,28 @@
3835
4225
 
3836
4226
 
3837
4227
 
3838
- <xsl:text>where</xsl:text>
4228
+ <xsl:variable name="title-where">
4229
+ <xsl:call-template name="getTitle">
4230
+ <xsl:with-param name="name" select="'title-where'"/>
4231
+ </xsl:call-template>
4232
+ </xsl:variable>
4233
+ <xsl:value-of select="$title-where"/>
3839
4234
  </fo:block>
3840
4235
  </xsl:when>
3841
4236
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3842
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
4237
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3843
4238
 
3844
4239
  <xsl:attribute name="font-size">10pt</xsl:attribute>
3845
4240
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3846
4241
 
3847
4242
 
3848
4243
 
3849
- <xsl:text>Key</xsl:text>
4244
+ <xsl:variable name="title-key">
4245
+ <xsl:call-template name="getTitle">
4246
+ <xsl:with-param name="name" select="'title-key'"/>
4247
+ </xsl:call-template>
4248
+ </xsl:variable>
4249
+ <xsl:value-of select="$title-key"/>
3850
4250
  </fo:block>
3851
4251
  </xsl:when>
3852
4252
  </xsl:choose>
@@ -3862,26 +4262,11 @@
3862
4262
 
3863
4263
 
3864
4264
 
4265
+
3865
4266
  <fo:block>
3866
4267
 
3867
4268
 
3868
- <!-- create virtual html table for dl/[dt and dd] -->
3869
- <xsl:variable name="html-table">
3870
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3871
- <xsl:element name="{$ns}:table">
3872
- <tbody>
3873
- <xsl:apply-templates mode="dl"/>
3874
- </tbody>
3875
- </xsl:element>
3876
- </xsl:variable>
3877
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3878
- <xsl:variable name="colwidths">
3879
- <xsl:call-template name="calculate-column-widths">
3880
- <xsl:with-param name="cols-count" select="2"/>
3881
- <xsl:with-param name="table" select="$html-table"/>
3882
- </xsl:call-template>
3883
- </xsl:variable>
3884
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4269
+
3885
4270
 
3886
4271
  <fo:table width="95%" table-layout="fixed">
3887
4272
 
@@ -3894,42 +4279,30 @@
3894
4279
 
3895
4280
  </xsl:when>
3896
4281
  </xsl:choose>
3897
- <xsl:choose>
3898
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3899
- <fo:table-column column-width="50%"/>
3900
- <fo:table-column column-width="50%"/>
3901
- </xsl:when>
3902
- <xsl:otherwise>
3903
- <xsl:choose>
3904
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3905
- <fo:table-column column-width="60%"/>
3906
- <fo:table-column column-width="40%"/>
3907
- </xsl:when> -->
3908
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3909
- <fo:table-column column-width="50%"/>
3910
- <fo:table-column column-width="50%"/>
3911
- </xsl:when>
3912
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3913
- <fo:table-column column-width="40%"/>
3914
- <fo:table-column column-width="60%"/>
3915
- </xsl:when>
3916
- <xsl:otherwise>
3917
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3918
- <xsl:choose>
3919
- <xsl:when test=". = 1">
3920
- <fo:table-column column-width="proportional-column-width(2)"/>
3921
- </xsl:when>
3922
- <xsl:otherwise>
3923
- <fo:table-column column-width="proportional-column-width({.})"/>
3924
- </xsl:otherwise>
3925
- </xsl:choose>
3926
- </xsl:for-each>
3927
- </xsl:otherwise>
3928
- </xsl:choose>
3929
- <!-- <fo:table-column column-width="15%"/>
3930
- <fo:table-column column-width="85%"/> -->
3931
- </xsl:otherwise>
3932
- </xsl:choose>
4282
+ <!-- create virtual html table for dl/[dt and dd] -->
4283
+ <xsl:variable name="html-table">
4284
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
4285
+ <xsl:element name="{$ns}:table">
4286
+ <tbody>
4287
+ <xsl:apply-templates mode="dl"/>
4288
+ </tbody>
4289
+ </xsl:element>
4290
+ </xsl:variable>
4291
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
4292
+ <xsl:variable name="colwidths">
4293
+ <xsl:call-template name="calculate-column-widths">
4294
+ <xsl:with-param name="cols-count" select="2"/>
4295
+ <xsl:with-param name="table" select="$html-table"/>
4296
+ </xsl:call-template>
4297
+ </xsl:variable>
4298
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4299
+ <xsl:variable name="maxlength_dt">
4300
+ <xsl:call-template name="getMaxLength_dt"/>
4301
+ </xsl:variable>
4302
+ <xsl:call-template name="setColumnWidth_dl">
4303
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4304
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4305
+ </xsl:call-template>
3933
4306
  <fo:table-body>
3934
4307
  <xsl:apply-templates>
3935
4308
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3939,7 +4312,61 @@
3939
4312
  </fo:block>
3940
4313
  </fo:block>
3941
4314
  </xsl:if>
3942
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
4315
+ </xsl:template><xsl:template name="setColumnWidth_dl">
4316
+ <xsl:param name="colwidths"/>
4317
+ <xsl:param name="maxlength_dt"/>
4318
+ <xsl:choose>
4319
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4320
+ <fo:table-column column-width="50%"/>
4321
+ <fo:table-column column-width="50%"/>
4322
+ </xsl:when>
4323
+ <xsl:otherwise>
4324
+ <xsl:choose>
4325
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4326
+ <fo:table-column column-width="5%"/>
4327
+ <fo:table-column column-width="95%"/>
4328
+ </xsl:when>
4329
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
4330
+ <fo:table-column column-width="10%"/>
4331
+ <fo:table-column column-width="90%"/>
4332
+ </xsl:when>
4333
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4334
+ <fo:table-column column-width="60%"/>
4335
+ <fo:table-column column-width="40%"/>
4336
+ </xsl:when> -->
4337
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
4338
+ <fo:table-column column-width="50%"/>
4339
+ <fo:table-column column-width="50%"/>
4340
+ </xsl:when>
4341
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
4342
+ <fo:table-column column-width="40%"/>
4343
+ <fo:table-column column-width="60%"/>
4344
+ </xsl:when>
4345
+ <xsl:otherwise>
4346
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4347
+ <xsl:choose>
4348
+ <xsl:when test=". = 1 or . = 0">
4349
+ <fo:table-column column-width="proportional-column-width(2)"/>
4350
+ </xsl:when>
4351
+ <xsl:otherwise>
4352
+ <fo:table-column column-width="proportional-column-width({.})"/>
4353
+ </xsl:otherwise>
4354
+ </xsl:choose>
4355
+ </xsl:for-each>
4356
+ </xsl:otherwise>
4357
+ </xsl:choose>
4358
+ <!-- <fo:table-column column-width="15%"/>
4359
+ <fo:table-column column-width="85%"/> -->
4360
+ </xsl:otherwise>
4361
+ </xsl:choose>
4362
+ </xsl:template><xsl:template name="getMaxLength_dt">
4363
+ <xsl:for-each select="*[local-name()='dt']">
4364
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
4365
+ <xsl:if test="position() = 1">
4366
+ <xsl:value-of select="string-length(normalize-space(.))"/>
4367
+ </xsl:if>
4368
+ </xsl:for-each>
4369
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3943
4370
  <xsl:param name="key_iso"/>
3944
4371
 
3945
4372
  <!-- <tr>
@@ -3955,7 +4382,12 @@
3955
4382
  <xsl:if test="normalize-space($key_iso) = 'true'">
3956
4383
  <xsl:attribute name="margin-top">0</xsl:attribute>
3957
4384
  </xsl:if>
3958
- NOTE
4385
+ <xsl:variable name="title-note">
4386
+ <xsl:call-template name="getTitle">
4387
+ <xsl:with-param name="name" select="'title-note'"/>
4388
+ </xsl:call-template>
4389
+ </xsl:variable>
4390
+ <xsl:value-of select="$title-note"/>
3959
4391
  </fo:block>
3960
4392
  </fo:table-cell>
3961
4393
  <fo:table-cell>
@@ -3964,7 +4396,7 @@
3964
4396
  </fo:block>
3965
4397
  </fo:table-cell>
3966
4398
  </fo:table-row>
3967
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
4399
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3968
4400
  <tr>
3969
4401
  <td>
3970
4402
  <xsl:apply-templates/>
@@ -3977,11 +4409,12 @@
3977
4409
  </td>
3978
4410
  </tr>
3979
4411
 
3980
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
4412
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3981
4413
  <xsl:param name="key_iso"/>
3982
4414
 
3983
4415
  <fo:table-row>
3984
4416
  <fo:table-cell>
4417
+
3985
4418
  <fo:block margin-top="6pt">
3986
4419
 
3987
4420
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -3993,8 +4426,15 @@
3993
4426
  </xsl:if>
3994
4427
 
3995
4428
 
3996
- <xsl:apply-templates/>
3997
4429
 
4430
+
4431
+
4432
+ <xsl:apply-templates/>
4433
+ <!-- <xsl:if test="$namespace = 'gb'">
4434
+ <xsl:if test="ancestor::*[local-name()='formula']">
4435
+ <xsl:text>—</xsl:text>
4436
+ </xsl:if>
4437
+ </xsl:if> -->
3998
4438
  </fo:block>
3999
4439
  </fo:table-cell>
4000
4440
  <fo:table-cell>
@@ -4008,37 +4448,37 @@
4008
4448
  </fo:table-cell>
4009
4449
  </fo:table-row>
4010
4450
 
4011
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
4451
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4012
4452
  <xsl:apply-templates/>
4013
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
4453
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
4014
4454
  <xsl:apply-templates/>
4015
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4455
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4016
4456
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4017
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
4457
+ </xsl:template><xsl:template match="*[local-name()='em']">
4018
4458
  <fo:inline font-style="italic">
4019
4459
  <xsl:apply-templates/>
4020
4460
  </fo:inline>
4021
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
4461
+ </xsl:template><xsl:template match="*[local-name()='strong']">
4022
4462
  <fo:inline font-weight="bold">
4023
4463
  <xsl:apply-templates/>
4024
4464
  </fo:inline>
4025
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
4465
+ </xsl:template><xsl:template match="*[local-name()='sup']">
4026
4466
  <fo:inline font-size="80%" vertical-align="super">
4027
4467
  <xsl:apply-templates/>
4028
4468
  </fo:inline>
4029
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
4469
+ </xsl:template><xsl:template match="*[local-name()='sub']">
4030
4470
  <fo:inline font-size="80%" vertical-align="sub">
4031
4471
  <xsl:apply-templates/>
4032
4472
  </fo:inline>
4033
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
4034
- <fo:inline font-family="Courier" font-size="10pt">
4473
+ </xsl:template><xsl:template match="*[local-name()='tt']">
4474
+ <fo:inline font-family="Courier" font-size="10pt">
4035
4475
  <xsl:apply-templates/>
4036
4476
  </fo:inline>
4037
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
4477
+ </xsl:template><xsl:template match="*[local-name()='del']">
4038
4478
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4039
4479
  <xsl:apply-templates/>
4040
4480
  </fo:inline>
4041
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
4481
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4042
4482
  <xsl:variable name="text" select="normalize-space(.)"/>
4043
4483
  <fo:inline font-size="75%">
4044
4484
  <xsl:if test="string-length($text) &gt; 0">
@@ -4047,10 +4487,11 @@
4047
4487
  </xsl:call-template>
4048
4488
  </xsl:if>
4049
4489
  </fo:inline>
4050
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
4490
+ </xsl:template><xsl:template name="recursiveSmallCaps">
4051
4491
  <xsl:param name="text"/>
4052
4492
  <xsl:variable name="char" select="substring($text,1,1)"/>
4053
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4493
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4494
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
4054
4495
  <xsl:choose>
4055
4496
  <xsl:when test="$char=$upperCase">
4056
4497
  <fo:inline font-size="{100 div 0.75}%">
@@ -4066,7 +4507,7 @@
4066
4507
  <xsl:with-param name="text" select="substring($text,2)"/>
4067
4508
  </xsl:call-template>
4068
4509
  </xsl:if>
4069
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
4510
+ </xsl:template><xsl:template name="tokenize">
4070
4511
  <xsl:param name="text"/>
4071
4512
  <xsl:param name="separator" select="' '"/>
4072
4513
  <xsl:choose>
@@ -4114,7 +4555,7 @@
4114
4555
  </xsl:call-template>
4115
4556
  </xsl:otherwise>
4116
4557
  </xsl:choose>
4117
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
4558
+ </xsl:template><xsl:template name="max_length">
4118
4559
  <xsl:param name="words"/>
4119
4560
  <xsl:for-each select="$words//word">
4120
4561
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -4122,7 +4563,11 @@
4122
4563
  <xsl:value-of select="."/>
4123
4564
  </xsl:if>
4124
4565
  </xsl:for-each>
4125
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
4566
+ </xsl:template><xsl:template name="add-zero-spaces-java">
4567
+ <xsl:param name="text" select="."/>
4568
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4569
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4570
+ </xsl:template><xsl:template name="add-zero-spaces">
4126
4571
  <xsl:param name="text" select="."/>
4127
4572
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
4128
4573
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -4175,7 +4620,7 @@
4175
4620
  <xsl:value-of select="$text"/>
4176
4621
  </xsl:otherwise>
4177
4622
  </xsl:choose>
4178
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
4623
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
4179
4624
  <xsl:param name="text" select="."/>
4180
4625
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4181
4626
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -4201,7 +4646,7 @@
4201
4646
  <xsl:value-of select="$text"/>
4202
4647
  </xsl:otherwise>
4203
4648
  </xsl:choose>
4204
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
4649
+ </xsl:template><xsl:template name="getSimpleTable">
4205
4650
  <xsl:variable name="simple-table">
4206
4651
 
4207
4652
  <!-- Step 1. colspan processing -->
@@ -4228,9 +4673,9 @@
4228
4673
  </xsl:choose> -->
4229
4674
  </xsl:variable>
4230
4675
  <xsl:copy-of select="$simple-table"/>
4231
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4676
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4232
4677
  <xsl:apply-templates mode="simple-table-colspan"/>
4233
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
4678
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
4234
4679
  <xsl:choose>
4235
4680
  <xsl:when test="@colspan">
4236
4681
  <xsl:variable name="td">
@@ -4252,16 +4697,16 @@
4252
4697
  </xsl:element>
4253
4698
  </xsl:otherwise>
4254
4699
  </xsl:choose>
4255
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
4700
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
4256
4701
  <xsl:element name="tr">
4257
4702
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4258
4703
  <xsl:apply-templates mode="simple-table-colspan"/>
4259
4704
  </xsl:element>
4260
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
4705
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
4261
4706
  <xsl:copy>
4262
4707
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
4263
4708
  </xsl:copy>
4264
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
4709
+ </xsl:template><xsl:template name="repeatNode">
4265
4710
  <xsl:param name="count"/>
4266
4711
  <xsl:param name="node"/>
4267
4712
 
@@ -4272,18 +4717,18 @@
4272
4717
  </xsl:call-template>
4273
4718
  <xsl:copy-of select="$node"/>
4274
4719
  </xsl:if>
4275
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
4720
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
4276
4721
  <xsl:copy>
4277
4722
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
4278
4723
  </xsl:copy>
4279
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
4724
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
4280
4725
  <xsl:copy>
4281
4726
  <xsl:copy-of select="tr[1]"/>
4282
4727
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
4283
4728
  <xsl:with-param name="previousRow" select="tr[1]"/>
4284
4729
  </xsl:apply-templates>
4285
4730
  </xsl:copy>
4286
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
4731
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
4287
4732
  <xsl:param name="previousRow"/>
4288
4733
  <xsl:variable name="currentRow" select="."/>
4289
4734
 
@@ -4317,43 +4762,53 @@
4317
4762
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
4318
4763
  <xsl:with-param name="previousRow" select="$newRow"/>
4319
4764
  </xsl:apply-templates>
4320
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
4765
+ </xsl:template><xsl:template name="getLang">
4321
4766
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4322
4767
  <xsl:choose>
4323
4768
  <xsl:when test="$language = 'English'">en</xsl:when>
4324
4769
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4325
4770
  </xsl:choose>
4326
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
4771
+ </xsl:template><xsl:template name="capitalizeWords">
4327
4772
  <xsl:param name="str"/>
4328
4773
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
4329
4774
  <xsl:choose>
4330
4775
  <xsl:when test="contains($str2, ' ')">
4331
4776
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
4332
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4333
- <xsl:value-of select="substring($substr, 2)"/>
4777
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4778
+ <xsl:value-of select="substring($substr, 2)"/> -->
4779
+ <xsl:call-template name="capitalize">
4780
+ <xsl:with-param name="str" select="$substr"/>
4781
+ </xsl:call-template>
4334
4782
  <xsl:text> </xsl:text>
4335
4783
  <xsl:call-template name="capitalizeWords">
4336
4784
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
4337
4785
  </xsl:call-template>
4338
4786
  </xsl:when>
4339
4787
  <xsl:otherwise>
4340
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4341
- <xsl:value-of select="substring($str2, 2)"/>
4788
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4789
+ <xsl:value-of select="substring($str2, 2)"/> -->
4790
+ <xsl:call-template name="capitalize">
4791
+ <xsl:with-param name="str" select="$str2"/>
4792
+ </xsl:call-template>
4342
4793
  </xsl:otherwise>
4343
4794
  </xsl:choose>
4344
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
4795
+ </xsl:template><xsl:template name="capitalize">
4796
+ <xsl:param name="str"/>
4797
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4798
+ <xsl:value-of select="substring($str, 2)"/>
4799
+ </xsl:template><xsl:template match="mathml:math">
4345
4800
  <fo:inline font-family="STIX2Math">
4346
4801
  <fo:instream-foreign-object fox:alt-text="Math">
4347
4802
  <xsl:copy-of select="."/>
4348
4803
  </fo:instream-foreign-object>
4349
4804
  </fo:inline>
4350
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
4805
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
4351
4806
  <xsl:for-each select="*[local-name()='locality']">
4352
4807
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
4353
4808
  <xsl:apply-templates select="."/>
4354
4809
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
4355
4810
  </xsl:for-each>
4356
- </xsl:template><xsl:template xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
4811
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
4357
4812
  <xsl:variable name="target">
4358
4813
  <xsl:choose>
4359
4814
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4383,4 +4838,277 @@
4383
4838
  </xsl:otherwise>
4384
4839
  </xsl:choose>
4385
4840
  </fo:inline>
4841
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4842
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
4843
+ <!-- <xsl:choose>
4844
+ <xsl:when test="@lang = 'en'"></xsl:when>
4845
+ <xsl:otherwise> -->
4846
+ <xsl:attribute name="white-space">pre</xsl:attribute>
4847
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4848
+ <!-- </xsl:otherwise>
4849
+ </xsl:choose> -->
4850
+ <xsl:apply-templates/>
4851
+ </fo:block>
4852
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4853
+ <fo:inline id="{@id}"/>
4854
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4855
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4856
+ <xsl:variable name="title-appendix">
4857
+ <xsl:call-template name="getTitle">
4858
+ <xsl:with-param name="name" select="'title-appendix'"/>
4859
+ </xsl:call-template>
4860
+ </xsl:variable>
4861
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4862
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4863
+ </fo:block>
4864
+ <xsl:apply-templates/>
4865
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4866
+ <fo:inline><xsl:apply-templates/></fo:inline>
4867
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4868
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
4869
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4870
+ <xsl:variable name="title-example">
4871
+ <xsl:call-template name="getTitle">
4872
+ <xsl:with-param name="name" select="'title-example'"/>
4873
+ </xsl:call-template>
4874
+ </xsl:variable>
4875
+ <xsl:value-of select="$title-example"/>
4876
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4877
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
4878
+ </xsl:if>
4879
+ <xsl:if test="*[local-name()='name']">
4880
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
4881
+ </xsl:if>
4882
+ </fo:block>
4883
+ <xsl:apply-templates/>
4884
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4885
+ <fo:inline><xsl:apply-templates/></fo:inline>
4886
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4887
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4888
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4889
+ <xsl:variable name="annotation-id" select="@id"/>
4890
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4891
+ <fo:block id="{$annotation-id}" white-space="nowrap">
4892
+ <fo:inline>
4893
+ <xsl:apply-templates>
4894
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
4895
+ </xsl:apply-templates>
4896
+ </fo:inline>
4897
+ </fo:block>
4898
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4899
+ <xsl:param name="callout"/>
4900
+ <fo:inline id="{@id}">
4901
+ <!-- for first p in annotation, put <x> -->
4902
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4903
+ <xsl:apply-templates/>
4904
+ </fo:inline>
4905
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4906
+ <xsl:variable name="title-modified">
4907
+ <xsl:call-template name="getTitle">
4908
+ <xsl:with-param name="name" select="'title-modified'"/>
4909
+ </xsl:call-template>
4910
+ </xsl:variable>
4911
+ <xsl:choose>
4912
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4913
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4914
+ </xsl:choose>
4915
+ <xsl:apply-templates/>
4916
+ </xsl:template><xsl:template name="convertDate">
4917
+ <xsl:param name="date"/>
4918
+ <xsl:param name="format" select="'short'"/>
4919
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4920
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4921
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4922
+ <xsl:variable name="monthStr">
4923
+ <xsl:choose>
4924
+ <xsl:when test="$month = '01'">January</xsl:when>
4925
+ <xsl:when test="$month = '02'">February</xsl:when>
4926
+ <xsl:when test="$month = '03'">March</xsl:when>
4927
+ <xsl:when test="$month = '04'">April</xsl:when>
4928
+ <xsl:when test="$month = '05'">May</xsl:when>
4929
+ <xsl:when test="$month = '06'">June</xsl:when>
4930
+ <xsl:when test="$month = '07'">July</xsl:when>
4931
+ <xsl:when test="$month = '08'">August</xsl:when>
4932
+ <xsl:when test="$month = '09'">September</xsl:when>
4933
+ <xsl:when test="$month = '10'">October</xsl:when>
4934
+ <xsl:when test="$month = '11'">November</xsl:when>
4935
+ <xsl:when test="$month = '12'">December</xsl:when>
4936
+ </xsl:choose>
4937
+ </xsl:variable>
4938
+ <xsl:variable name="result">
4939
+ <xsl:choose>
4940
+ <xsl:when test="$format = 'short' or $day = ''">
4941
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4942
+ </xsl:when>
4943
+ <xsl:otherwise>
4944
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4945
+ </xsl:otherwise>
4946
+ </xsl:choose>
4947
+ </xsl:variable>
4948
+ <xsl:value-of select="$result"/>
4949
+ </xsl:template><xsl:template name="insertKeywords">
4950
+ <xsl:param name="sorting" select="'true'"/>
4951
+ <xsl:param name="charAtEnd" select="'.'"/>
4952
+ <xsl:param name="charDelim" select="', '"/>
4953
+ <xsl:choose>
4954
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4955
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4956
+ <xsl:sort data-type="text" order="ascending"/>
4957
+ <xsl:call-template name="insertKeyword">
4958
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4959
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4960
+ </xsl:call-template>
4961
+ </xsl:for-each>
4962
+ </xsl:when>
4963
+ <xsl:otherwise>
4964
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4965
+ <xsl:call-template name="insertKeyword">
4966
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4967
+ <xsl:with-param name="charDelim" select="$charDelim"/>
4968
+ </xsl:call-template>
4969
+ </xsl:for-each>
4970
+ </xsl:otherwise>
4971
+ </xsl:choose>
4972
+ </xsl:template><xsl:template name="insertKeyword">
4973
+ <xsl:param name="charAtEnd"/>
4974
+ <xsl:param name="charDelim"/>
4975
+ <xsl:apply-templates/>
4976
+ <xsl:choose>
4977
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4978
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4979
+ </xsl:choose>
4980
+ </xsl:template><xsl:template name="addPDFUAmeta">
4981
+ <fo:declarations>
4982
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4983
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4984
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4985
+ </pdf:dictionary>
4986
+ </pdf:catalog>
4987
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4988
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4989
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4990
+ <!-- Dublin Core properties go here -->
4991
+ <dc:title>
4992
+ <xsl:variable name="title">
4993
+
4994
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4995
+
4996
+
4997
+
4998
+
4999
+ </xsl:variable>
5000
+ <xsl:choose>
5001
+ <xsl:when test="normalize-space($title) != ''">
5002
+ <xsl:value-of select="$title"/>
5003
+ </xsl:when>
5004
+ <xsl:otherwise>
5005
+ <xsl:text> </xsl:text>
5006
+ </xsl:otherwise>
5007
+ </xsl:choose>
5008
+ </dc:title>
5009
+ <dc:creator>
5010
+
5011
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5012
+
5013
+
5014
+ </dc:creator>
5015
+ <dc:description>
5016
+ <xsl:variable name="abstract">
5017
+
5018
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5019
+
5020
+
5021
+
5022
+
5023
+ </xsl:variable>
5024
+ <xsl:value-of select="normalize-space($abstract)"/>
5025
+ </dc:description>
5026
+ <pdf:Keywords>
5027
+ <xsl:call-template name="insertKeywords"/>
5028
+ </pdf:Keywords>
5029
+ </rdf:Description>
5030
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5031
+ <!-- XMP properties go here -->
5032
+ <xmp:CreatorTool/>
5033
+ </rdf:Description>
5034
+ </rdf:RDF>
5035
+ </x:xmpmeta>
5036
+ </fo:declarations>
5037
+ </xsl:template><xsl:template name="getId">
5038
+ <xsl:choose>
5039
+ <xsl:when test="../@id">
5040
+ <xsl:value-of select="../@id"/>
5041
+ </xsl:when>
5042
+ <xsl:otherwise>
5043
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
5044
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
5045
+ </xsl:otherwise>
5046
+ </xsl:choose>
5047
+ </xsl:template><xsl:template name="getLevel">
5048
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
5049
+ <xsl:variable name="level">
5050
+ <xsl:choose>
5051
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
5052
+ <xsl:value-of select="$level_total - 2"/>
5053
+ </xsl:when>
5054
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
5055
+ <xsl:value-of select="$level_total - 2"/>
5056
+ </xsl:when>
5057
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
5058
+ <xsl:value-of select="$level_total - 2"/>
5059
+ </xsl:when>
5060
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
5061
+ <xsl:otherwise>
5062
+ <xsl:value-of select="$level_total - 1"/>
5063
+ </xsl:otherwise>
5064
+ </xsl:choose>
5065
+ </xsl:variable>
5066
+ <xsl:value-of select="$level"/>
5067
+ </xsl:template><xsl:template name="getSubSection">
5068
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
5069
+ </xsl:template><xsl:template name="split">
5070
+ <xsl:param name="pText" select="."/>
5071
+ <xsl:param name="sep" select="','"/>
5072
+ <xsl:if test="string-length($pText) &gt;0">
5073
+ <item>
5074
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
5075
+ </item>
5076
+ <xsl:call-template name="split">
5077
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
5078
+ <xsl:with-param name="sep" select="$sep"/>
5079
+ </xsl:call-template>
5080
+ </xsl:if>
5081
+ </xsl:template><xsl:template name="getDocumentId">
5082
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
5083
+ </xsl:template><xsl:template name="namespaceCheck">
5084
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
5085
+ <xsl:variable name="XSLNS">
5086
+
5087
+ <xsl:value-of select="document('')//*/namespace::iso"/>
5088
+
5089
+
5090
+
5091
+
5092
+
5093
+
5094
+
5095
+
5096
+
5097
+
5098
+
5099
+
5100
+ </xsl:variable>
5101
+ <xsl:if test="$documentNS != $XSLNS">
5102
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
5103
+ </xsl:if>
5104
+ </xsl:template><xsl:template name="getLanguage">
5105
+ <xsl:param name="lang"/>
5106
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
5107
+ <xsl:choose>
5108
+ <xsl:when test="$language = 'en'">English</xsl:when>
5109
+ <xsl:when test="$language = 'fr'">French</xsl:when>
5110
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
5111
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
5112
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5113
+ </xsl:choose>
4386
5114
  </xsl:template></xsl:stylesheet>