metanorma-bipm 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,17 +2,9 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <xsl:param name="svg_images"/>
6
- <xsl:variable name="images" select="document($svg_images)"/>
7
- <xsl:param name="basepath"/>
8
-
9
5
  <xsl:param name="initial_page_number"/>
10
6
  <xsl:param name="doc_split_by_language"/>
11
7
 
12
- <!-- <item id="#">N_page</item> -->
13
- <!-- param for second pass -->
14
- <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
15
-
16
8
  <xsl:param name="add_math_as_text">true</xsl:param>
17
9
 
18
10
  <xsl:param name="add_math_as_attachment">true</xsl:param>
@@ -21,11 +13,6 @@
21
13
 
22
14
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
23
15
 
24
- <xsl:variable name="marginLeftRight1" select="31.7"/>
25
- <xsl:variable name="marginLeftRight2" select="40"/>
26
- <xsl:variable name="marginTop" select="25.4"/>
27
- <xsl:variable name="marginBottom" select="22"/>
28
-
29
16
 
30
17
 
31
18
  <!-- DON'T DELETE IT -->
@@ -39,10 +26,6 @@
39
26
 
40
27
  <xsl:variable name="doc_first_language" select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:language[@current = 'true']"/>
41
28
 
42
- <xsl:variable name="lang">
43
- <xsl:call-template name="getLang"/>
44
- </xsl:variable>
45
-
46
29
  <xsl:variable name="root-element" select="local-name(/*)"/>
47
30
 
48
31
  <xsl:variable name="contents">
@@ -866,40 +849,7 @@
866
849
 
867
850
  <xsl:template name="setListItemLabel">
868
851
  <xsl:attribute name="label">
869
- <xsl:choose>
870
- <xsl:when test="local-name(..) = 'ul'">
871
- <xsl:call-template name="setULLabel"/>
872
- </xsl:when>
873
-
874
- <xsl:otherwise> <!-- for ordered lists -->
875
- <xsl:variable name="start_value">
876
- <xsl:choose>
877
- <xsl:when test="normalize-space(../@start) != ''">
878
- <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
879
- </xsl:when>
880
- <xsl:otherwise>0</xsl:otherwise>
881
- </xsl:choose>
882
- </xsl:variable>
883
-
884
- <xsl:variable name="curr_value">
885
- <xsl:number/>
886
- </xsl:variable>
887
-
888
- <xsl:variable name="format">
889
- <xsl:choose>
890
- <xsl:when test="../@type = 'arabic'">1.</xsl:when>
891
- <xsl:when test="../@type = 'alphabet'">a)</xsl:when>
892
- <xsl:when test="../@type = 'alphabet_upper'">A.</xsl:when>
893
- <xsl:when test="../@type = 'roman'">(i)</xsl:when>
894
- <xsl:when test="../@type = 'roman_upper'">I.</xsl:when>
895
- <xsl:otherwise>1.</xsl:otherwise>
896
- </xsl:choose>
897
- </xsl:variable>
898
-
899
- <xsl:number value="$start_value + $curr_value" format="{$format}" lang="en"/>
900
-
901
- </xsl:otherwise>
902
- </xsl:choose>
852
+ <xsl:call-template name="getListItemFormat"/>
903
853
  </xsl:attribute>
904
854
  <xsl:choose>
905
855
  <xsl:when test="local-name(..) = 'ul' and ../ancestor::bipm:ul"/> <!-- &#x2014; dash -->
@@ -2775,12 +2725,12 @@
2775
2725
  </xsl:template>
2776
2726
 
2777
2727
 
2778
- <xsl:template match="bipm:ul | bipm:ol" mode="ul_ol">
2728
+ <xsl:template match="bipm:ul | bipm:ol" mode="list" priority="2">
2779
2729
  <xsl:apply-templates/><!-- for second level -->
2780
2730
  </xsl:template>
2781
2731
 
2782
2732
  <!-- process list item as individual list --> <!-- flat list -->
2783
- <xsl:template match="bipm:li">
2733
+ <xsl:template match="bipm:li" priority="2">
2784
2734
  <fo:block-container margin-left="0mm"> <!-- debug: border="0.5pt solid black" -->
2785
2735
  <xsl:if test="ancestor::bipm:li">
2786
2736
  <xsl:attribute name="margin-left">6.5mm</xsl:attribute><!-- 8 mm -->
@@ -2849,50 +2799,7 @@
2849
2799
 
2850
2800
  </xsl:template>
2851
2801
 
2852
- <xsl:template match="bipm:ul2/bipm:note | bipm:ol2/bipm:note" priority="2">
2853
- <fo:list-item>
2854
- <fo:list-item-label><fo:block/></fo:list-item-label>
2855
- <fo:list-item-body>
2856
- <fo:block>
2857
- <xsl:apply-templates select="bipm:name"/>
2858
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
2859
- </fo:block>
2860
- </fo:list-item-body>
2861
- </fo:list-item>
2862
- </xsl:template>
2863
-
2864
- <xsl:template match="bipm:formula/bipm:stem">
2865
- <fo:block margin-top="6pt" margin-bottom="6pt">
2866
- <xsl:choose>
2867
- <xsl:when test="../bipm:name">
2868
- <fo:table table-layout="fixed" width="100%">
2869
- <fo:table-column column-width="95%"/>
2870
- <fo:table-column column-width="5%"/>
2871
- <fo:table-body>
2872
- <fo:table-row>
2873
- <fo:table-cell display-align="center">
2874
- <fo:block text-align="center">
2875
- <xsl:apply-templates/>
2876
- </fo:block>
2877
- </fo:table-cell>
2878
- <fo:table-cell display-align="center">
2879
- <fo:block text-align="right">
2880
- <xsl:apply-templates select="../bipm:name" mode="formula_number"/>
2881
- </fo:block>
2882
- </fo:table-cell>
2883
- </fo:table-row>
2884
- </fo:table-body>
2885
- </fo:table>
2886
- </xsl:when>
2887
- <xsl:otherwise>
2888
- <fo:block text-align="center">
2889
- <xsl:apply-templates/>
2890
- </fo:block>
2891
- </xsl:otherwise>
2892
- </xsl:choose>
2893
- </fo:block>
2894
- </xsl:template>
2895
-
2802
+
2896
2803
  <xsl:template match="bipm:example" priority="2">
2897
2804
  <fo:block margin-top="6pt" margin-bottom="6pt" keep-together.within-column="1">
2898
2805
  <fo:table table-layout="fixed" width="100%">
@@ -2916,15 +2823,14 @@
2916
2823
  </fo:block>
2917
2824
  </xsl:template>
2918
2825
 
2919
- <xsl:template match="bipm:preferred">
2826
+ <xsl:template match="bipm:preferred" priority="2">
2920
2827
  <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
2921
2828
  <xsl:call-template name="setStyle_preferred"/>
2922
2829
  <xsl:if test="ancestor::bipm:term[1]/bipm:name">
2923
2830
  <xsl:variable name="level">
2924
2831
  <xsl:call-template name="getLevelTermName"/>
2925
2832
  </xsl:variable>
2926
- <fo:inline role="H{$level}" font-weight="bold">
2927
- <xsl:attribute name="padding-right">2mm</xsl:attribute>
2833
+ <fo:inline role="H{$level}" font-weight="bold" padding-right="2mm">
2928
2834
  <xsl:apply-templates select="ancestor::bipm:term[1]/bipm:name"/>
2929
2835
  </fo:inline>
2930
2836
  </xsl:if>
@@ -3238,7 +3144,7 @@
3238
3144
  <xsl:if test="$add_math_as_text = 'true'">
3239
3145
  <!-- set unique font-size (fiction) -->
3240
3146
  <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
3241
- <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal">​</fo:inline> <!-- zero width space -->
3147
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
3242
3148
  </xsl:if>
3243
3149
 
3244
3150
  <!-- <fo:wrapper role="artifact"> -->
@@ -3593,21 +3499,7 @@
3593
3499
  </fo:page-sequence>
3594
3500
  </xsl:template>
3595
3501
 
3596
- <xsl:template match="bipm:indexsect/bipm:title" priority="4">
3597
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" role="H1">
3598
- <!-- Index -->
3599
- <xsl:apply-templates/>
3600
- </fo:block>
3601
- </xsl:template>
3602
-
3603
- <xsl:template match="bipm:indexsect/bipm:clause/bipm:title" priority="4">
3604
- <!-- Letter A, B, C, ... -->
3605
- <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
3606
- <xsl:apply-templates/>
3607
- </fo:block>
3608
- </xsl:template>
3609
3502
 
3610
-
3611
3503
  <xsl:template match="*[local-name() = 'stem']/text()">
3612
3504
  <xsl:value-of select="normalize-space()"/>
3613
3505
  </xsl:template>
@@ -3949,11 +3841,21 @@
3949
3841
  </xsl:template>
3950
3842
 
3951
3843
 
3952
- <xsl:variable name="pageWidth_">
3844
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
3845
+ <xsl:call-template name="getLang"/>
3846
+ </xsl:variable><xsl:variable name="pageWidth_">
3953
3847
  210
3954
3848
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
3955
3849
  297
3956
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
3850
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
3851
+ 31.7
3852
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
3853
+ 40
3854
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
3855
+ 25.4
3856
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
3857
+ 22
3858
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
3957
3859
 
3958
3860
  <title-edition lang="en">
3959
3861
 
@@ -4017,7 +3919,7 @@
4017
3919
  </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
4018
3920
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
4019
3921
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
4020
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
3922
+ </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
4021
3923
  <xsl:param name="name"/>
4022
3924
  <xsl:param name="lang"/>
4023
3925
  <xsl:variable name="lang_">
@@ -4040,7 +3942,7 @@
4040
3942
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
4041
3943
  </xsl:otherwise>
4042
3944
  </xsl:choose>
4043
- </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="root-style">
3945
+ </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:attribute-set name="root-style">
4044
3946
 
4045
3947
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
4046
3948
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
@@ -4209,7 +4111,7 @@
4209
4111
 
4210
4112
 
4211
4113
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
4212
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
4114
+
4213
4115
 
4214
4116
 
4215
4117
 
@@ -4587,7 +4489,8 @@
4587
4489
 
4588
4490
 
4589
4491
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
4590
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
4492
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
4493
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
4591
4494
 
4592
4495
 
4593
4496
 
@@ -4596,9 +4499,9 @@
4596
4499
 
4597
4500
 
4598
4501
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
4502
+ <xsl:attribute name="text-align">right</xsl:attribute>
4599
4503
 
4600
4504
 
4601
-
4602
4505
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
4603
4506
 
4604
4507
 
@@ -4617,6 +4520,9 @@
4617
4520
 
4618
4521
  </xsl:attribute-set><xsl:attribute-set name="term-style">
4619
4522
 
4523
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
4524
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4525
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4620
4526
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
4621
4527
 
4622
4528
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -4647,6 +4553,35 @@
4647
4553
 
4648
4554
 
4649
4555
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
4556
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
4557
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4558
+
4559
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4560
+
4561
+
4562
+
4563
+
4564
+
4565
+
4566
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
4567
+ <xsl:attribute name="text-align">center</xsl:attribute>
4568
+
4569
+
4570
+
4571
+
4572
+
4573
+
4574
+
4575
+
4576
+
4577
+
4578
+
4579
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
4580
+ <xsl:attribute name="text-align">right</xsl:attribute>
4581
+
4582
+
4583
+
4584
+
4650
4585
 
4651
4586
  </xsl:attribute-set><xsl:attribute-set name="image-style">
4652
4587
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -4680,6 +4615,18 @@
4680
4615
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4681
4616
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
4682
4617
 
4618
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
4619
+
4620
+
4621
+
4622
+
4623
+
4624
+
4625
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
4626
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4627
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4628
+
4629
+
4683
4630
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
4684
4631
 
4685
4632
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -4713,6 +4660,33 @@
4713
4660
 
4714
4661
  </xsl:attribute-set><xsl:attribute-set name="list-style">
4715
4662
 
4663
+
4664
+
4665
+
4666
+
4667
+
4668
+
4669
+
4670
+
4671
+
4672
+
4673
+
4674
+
4675
+
4676
+
4677
+
4678
+
4679
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
4680
+
4681
+
4682
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
4683
+
4684
+
4685
+
4686
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
4687
+
4688
+
4689
+
4716
4690
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
4717
4691
  <xsl:attribute name="line-height">135%</xsl:attribute>
4718
4692
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -5006,6 +4980,120 @@
5006
4980
 
5007
4981
 
5008
4982
 
4983
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
4984
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4985
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
4986
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4987
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
4988
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4989
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
4990
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4991
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
4992
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4993
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
4994
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4995
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
4996
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
4997
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
4998
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
4999
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
5000
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5001
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
5002
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5003
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
5004
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
5005
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
5006
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5007
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
5008
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5009
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
5010
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5011
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
5012
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5013
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
5014
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5015
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
5016
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5017
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
5018
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5019
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
5020
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5021
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
5022
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5023
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
5024
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5025
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
5026
+ <xsl:attribute name="color">#032f62</xsl:attribute>
5027
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
5028
+ <xsl:attribute name="color">#032f62</xsl:attribute>
5029
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
5030
+ <xsl:attribute name="color">#032f62</xsl:attribute>
5031
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
5032
+ <xsl:attribute name="color">#e36209</xsl:attribute>
5033
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
5034
+ <xsl:attribute name="color">#e36209</xsl:attribute>
5035
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
5036
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
5037
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
5038
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
5039
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
5040
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
5041
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
5042
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5043
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
5044
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5045
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
5046
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5047
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
5048
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5049
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
5050
+ <xsl:attribute name="color">#24292e</xsl:attribute>
5051
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
5052
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
5053
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5054
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
5055
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
5056
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
5057
+ <xsl:attribute name="color">#24292e</xsl:attribute>
5058
+ <xsl:attribute name="font-style">italic</xsl:attribute>
5059
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
5060
+ <xsl:attribute name="color">#24292e</xsl:attribute>
5061
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5062
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
5063
+ <xsl:attribute name="color">#22863a</xsl:attribute>
5064
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
5065
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
5066
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
5067
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
5068
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
5069
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
5070
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
5071
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
5072
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
5073
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
5074
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
5075
+ <xsl:attribute name="role">H1</xsl:attribute>
5076
+
5077
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
5078
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5079
+ <xsl:attribute name="margin-bottom">84pt</xsl:attribute>
5080
+ <xsl:attribute name="margin-left">-18mm</xsl:attribute>
5081
+
5082
+
5083
+
5084
+
5085
+
5086
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
5087
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
5088
+
5089
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5090
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5091
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
5092
+
5093
+
5094
+
5095
+
5096
+
5009
5097
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
5010
5098
  <xsl:for-each select="/*/*[local-name()='preface']/*">
5011
5099
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -5102,9 +5190,12 @@
5102
5190
 
5103
5191
 
5104
5192
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
5193
+ <xsl:param name="margin"/>
5105
5194
 
5106
5195
  <!-- process in the template 'paragraph' -->
5107
- <xsl:call-template name="paragraph"/>
5196
+ <xsl:call-template name="paragraph">
5197
+ <xsl:with-param name="margin" select="$margin"/>
5198
+ </xsl:call-template>
5108
5199
 
5109
5200
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
5110
5201
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -5116,9 +5207,12 @@
5116
5207
  <xsl:call-template name="title"/>
5117
5208
 
5118
5209
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
5210
+ <xsl:param name="margin"/>
5119
5211
 
5120
5212
  <!-- process in the template 'paragraph' -->
5121
- <xsl:call-template name="paragraph"/>
5213
+ <xsl:call-template name="paragraph">
5214
+ <xsl:with-param name="margin" select="$margin"/>
5215
+ </xsl:call-template>
5122
5216
 
5123
5217
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
5124
5218
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -5480,8 +5574,7 @@
5480
5574
  </xsl:call-template>
5481
5575
  </xsl:if>
5482
5576
  </xsl:template><xsl:template match="text()" mode="td_text">
5483
- <xsl:variable name="zero-space">​</xsl:variable>
5484
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
5577
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
5485
5578
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
5486
5579
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
5487
5580
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -6521,20 +6614,44 @@
6521
6614
  <fo:inline text-decoration="underline">
6522
6615
  <xsl:apply-templates/>
6523
6616
  </fo:inline>
6524
- </xsl:template><xsl:template match="*[local-name()='add']">
6617
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
6525
6618
  <xsl:param name="skip">true</xsl:param>
6619
+ <xsl:param name="block">false</xsl:param>
6620
+ <xsl:param name="type"/>
6621
+ <xsl:param name="text-align"/>
6526
6622
  <xsl:choose>
6527
6623
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
6528
6624
  <xsl:choose>
6529
- <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab'])) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
6625
+ <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
6530
6626
  <xsl:otherwise>
6531
- <fo:inline>
6627
+ <xsl:variable name="tag">
6532
6628
  <xsl:call-template name="insertTag">
6533
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
6629
+ <xsl:with-param name="type">
6630
+ <xsl:choose>
6631
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
6632
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
6633
+ </xsl:choose>
6634
+ </xsl:with-param>
6534
6635
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
6535
6636
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
6536
6637
  </xsl:call-template>
6537
- </fo:inline>
6638
+ </xsl:variable>
6639
+ <xsl:choose>
6640
+ <xsl:when test="$block = 'false'">
6641
+ <fo:inline>
6642
+ <xsl:copy-of select="$tag"/>
6643
+ </fo:inline>
6644
+ </xsl:when>
6645
+ <xsl:otherwise>
6646
+ <fo:block> <!-- for around figures -->
6647
+ <xsl:if test="$text-align != ''">
6648
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
6649
+ </xsl:if>
6650
+ <xsl:copy-of select="$tag"/>
6651
+ </fo:block>
6652
+ </xsl:otherwise>
6653
+ </xsl:choose>
6654
+
6538
6655
  </xsl:otherwise>
6539
6656
  </xsl:choose>
6540
6657
  </xsl:when>
@@ -6893,17 +7010,21 @@
6893
7010
  </xsl:apply-templates>
6894
7011
  </xsl:template><xsl:template name="getLang">
6895
7012
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6896
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6897
7013
  <xsl:variable name="language">
6898
7014
  <xsl:choose>
6899
7015
  <xsl:when test="$language_current != ''">
6900
7016
  <xsl:value-of select="$language_current"/>
6901
7017
  </xsl:when>
6902
- <xsl:when test="$language_current_2 != ''">
6903
- <xsl:value-of select="$language_current_2"/>
6904
- </xsl:when>
6905
7018
  <xsl:otherwise>
6906
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7019
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
7020
+ <xsl:choose>
7021
+ <xsl:when test="$language_current_2 != ''">
7022
+ <xsl:value-of select="$language_current_2"/>
7023
+ </xsl:when>
7024
+ <xsl:otherwise>
7025
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7026
+ </xsl:otherwise>
7027
+ </xsl:choose>
6907
7028
  </xsl:otherwise>
6908
7029
  </xsl:choose>
6909
7030
  </xsl:variable>
@@ -7146,8 +7267,8 @@
7146
7267
 
7147
7268
  </xsl:if>
7148
7269
  <fo:block-container margin-left="0mm">
7149
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
7150
- <xsl:apply-templates/>
7270
+ <fo:block id="{@id}">
7271
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
7151
7272
  </fo:block>
7152
7273
  </fo:block-container>
7153
7274
  </fo:block-container>
@@ -7159,10 +7280,43 @@
7159
7280
  <fo:inline>
7160
7281
  <xsl:apply-templates/>
7161
7282
  </fo:inline>
7162
- </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']" mode="formula_number"> <!-- show by demand -->
7283
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
7163
7284
  <xsl:if test="normalize-space() != ''">
7164
7285
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
7165
7286
  </xsl:if>
7287
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
7288
+ <fo:block xsl:use-attribute-sets="formula-style">
7289
+
7290
+
7291
+
7292
+ <fo:table table-layout="fixed" width="100%">
7293
+ <fo:table-column column-width="95%"/>
7294
+ <fo:table-column column-width="5%"/>
7295
+ <fo:table-body>
7296
+ <fo:table-row>
7297
+ <fo:table-cell display-align="center">
7298
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7299
+
7300
+
7301
+
7302
+ <xsl:apply-templates/>
7303
+ </fo:block>
7304
+ </fo:table-cell>
7305
+ <fo:table-cell display-align="center">
7306
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
7307
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
7308
+ </fo:block>
7309
+ </fo:table-cell>
7310
+ </fo:table-row>
7311
+ </fo:table-body>
7312
+ </fo:table>
7313
+ </fo:block>
7314
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
7315
+ <fo:block xsl:use-attribute-sets="formula-style">
7316
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
7317
+ <xsl:apply-templates/>
7318
+ </fo:block>
7319
+ </fo:block>
7166
7320
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
7167
7321
 
7168
7322
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -8142,12 +8296,140 @@
8142
8296
  </fo:block-container>
8143
8297
  </fo:block-container>
8144
8298
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
8145
- <xsl:variable name="text">
8299
+ <xsl:choose>
8300
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
8301
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
8302
+ <xsl:choose>
8303
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
8304
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
8305
+ </xsl:when>
8306
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
8307
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
8308
+ </xsl:otherwise>
8309
+ </xsl:choose>
8310
+ </xsl:when>
8311
+ <xsl:otherwise>
8312
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
8313
+ </xsl:otherwise>
8314
+ </xsl:choose>
8315
+
8316
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
8317
+ <xsl:variable name="text_step1">
8146
8318
  <xsl:call-template name="add-zero-spaces-equal"/>
8147
8319
  </xsl:variable>
8148
- <xsl:call-template name="add-zero-spaces-java">
8149
- <xsl:with-param name="text" select="$text"/>
8150
- </xsl:call-template>
8320
+ <xsl:variable name="text_step2">
8321
+ <xsl:call-template name="add-zero-spaces-java">
8322
+ <xsl:with-param name="text" select="$text_step1"/>
8323
+ </xsl:call-template>
8324
+ </xsl:variable>
8325
+ <xsl:value-of select="$text_step2"/>
8326
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
8327
+ <xsl:apply-templates mode="syntax_highlight"/>
8328
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
8329
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
8330
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
8331
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
8332
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
8333
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
8334
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
8335
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
8336
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
8337
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
8338
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
8339
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
8340
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
8341
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
8342
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
8343
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
8344
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
8345
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
8346
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
8347
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
8348
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
8349
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
8350
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
8351
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
8352
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
8353
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
8354
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
8355
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
8356
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
8357
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
8358
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
8359
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
8360
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
8361
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
8362
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
8363
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
8364
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
8365
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
8366
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
8367
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
8368
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
8369
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
8370
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
8371
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
8372
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
8373
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
8374
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
8375
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
8376
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
8377
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
8378
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
8379
+ <fo:inline>
8380
+ <xsl:variable name="classes_">
8381
+ <xsl:call-template name="split">
8382
+ <xsl:with-param name="pText" select="@class"/>
8383
+ <xsl:with-param name="sep" select="' '"/>
8384
+ </xsl:call-template>
8385
+ <!-- a few classes together (_and_ suffix) -->
8386
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
8387
+ <item>hljs-char_and_escape_</item>
8388
+ </xsl:if>
8389
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
8390
+ <item>hljs-title_and_class_</item>
8391
+ </xsl:if>
8392
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
8393
+ <item>hljs-title_and_class__and_inherited__</item>
8394
+ </xsl:if>
8395
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
8396
+ <item>hljs-title_and_function_</item>
8397
+ </xsl:if>
8398
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
8399
+ <item>hljs-variable_and_language_</item>
8400
+ </xsl:if>
8401
+ <!-- with parent classes (_ suffix) -->
8402
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
8403
+ <item>hljs-meta_hljs-keyword</item>
8404
+ </xsl:if>
8405
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
8406
+ <item>hljs-meta_hljs-string</item>
8407
+ </xsl:if>
8408
+ </xsl:variable>
8409
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
8410
+
8411
+ <xsl:for-each select="$classes/item">
8412
+ <xsl:variable name="class_name" select="."/>
8413
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
8414
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
8415
+ </xsl:for-each>
8416
+ </xsl:for-each>
8417
+
8418
+ <!-- <xsl:variable name="class_name">
8419
+ <xsl:choose>
8420
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
8421
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
8422
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
8423
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
8424
+ </xsl:choose>
8425
+ </xsl:variable>
8426
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
8427
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
8428
+ </xsl:for-each> -->
8429
+
8430
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
8431
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
8432
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
8151
8433
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
8152
8434
  <xsl:if test="normalize-space() != ''">
8153
8435
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -8518,11 +8800,14 @@
8518
8800
 
8519
8801
 
8520
8802
  <fo:block-container margin-left="0mm">
8521
-
8522
- <fo:block xsl:use-attribute-sets="quote-style">
8803
+ <fo:block-container xsl:use-attribute-sets="quote-style">
8523
8804
 
8524
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
8525
- </fo:block>
8805
+ <fo:block-container margin-left="0mm" margin-right="0mm">
8806
+ <fo:block role="BlockQuote">
8807
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
8808
+ </fo:block>
8809
+ </fo:block-container>
8810
+ </fo:block-container>
8526
8811
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
8527
8812
  <fo:block xsl:use-attribute-sets="quote-source-style">
8528
8813
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -8676,6 +8961,31 @@
8676
8961
  <xsl:with-param name="count" select="$count - 1"/>
8677
8962
  </xsl:call-template>
8678
8963
  </xsl:if>
8964
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
8965
+ <xsl:variable name="level">
8966
+ <xsl:call-template name="getLevel"/>
8967
+ </xsl:variable>
8968
+ <xsl:variable name="font-size">
8969
+ inherit
8970
+ </xsl:variable>
8971
+ <xsl:variable name="levelTerm">
8972
+ <xsl:call-template name="getLevelTermName"/>
8973
+ </xsl:variable>
8974
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
8975
+
8976
+
8977
+
8978
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
8979
+ <fo:block xsl:use-attribute-sets="term-name-style">
8980
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
8981
+ </fo:block>
8982
+ </xsl:if>
8983
+
8984
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
8985
+ <xsl:call-template name="setStyle_preferred"/>
8986
+ <xsl:apply-templates/>
8987
+ </fo:block>
8988
+ </fo:block>
8679
8989
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
8680
8990
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
8681
8991
  <xsl:text> </xsl:text>
@@ -8761,26 +9071,10 @@
8761
9071
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
8762
9072
  </xsl:template><xsl:variable name="ul_labels_">
8763
9073
 
8764
- <label level="1" font-size="15pt">•</label>
8765
- <label level="2">−</label><!-- &#x2212; - minus sign. &#x2014; - en dash -->
8766
- <label level="3" font-size="75%">o</label> <!-- white circle -->
8767
-
8768
-
8769
-
8770
-
8771
-
8772
-
8773
-
8774
-
8775
-
8776
-
8777
-
8778
-
8779
-
8780
-
8781
-
8782
-
8783
-
9074
+ <label level="1" font-size="15pt">•</label>
9075
+ <label level="2">−</label><!-- &#x2212; - minus sign. &#x2014; - en dash -->
9076
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
9077
+
8784
9078
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
8785
9079
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8786
9080
  <xsl:variable name="list_level">
@@ -8806,6 +9100,91 @@
8806
9100
  </xsl:template><xsl:template match="label" mode="ul_labels">
8807
9101
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
8808
9102
  <xsl:value-of select="."/>
9103
+ </xsl:template><xsl:template name="getListItemFormat">
9104
+ <!-- Example: for BSI <?list-type loweralpha?> -->
9105
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
9106
+ <xsl:choose>
9107
+ <xsl:when test="local-name(..) = 'ul'">
9108
+ <xsl:choose>
9109
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
9110
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
9111
+ </xsl:choose>
9112
+ </xsl:when>
9113
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
9114
+
9115
+ <!-- Example: for BSI <?list-start 2?> -->
9116
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
9117
+
9118
+ <xsl:variable name="start_value">
9119
+ <xsl:choose>
9120
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
9121
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
9122
+ </xsl:when>
9123
+ <xsl:when test="normalize-space(../@start) != ''">
9124
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
9125
+ </xsl:when>
9126
+ <xsl:otherwise>0</xsl:otherwise>
9127
+ </xsl:choose>
9128
+ </xsl:variable>
9129
+
9130
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
9131
+
9132
+ <xsl:variable name="type">
9133
+ <xsl:choose>
9134
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
9135
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
9136
+
9137
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
9138
+
9139
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
9140
+ <xsl:variable name="list_level">
9141
+ <xsl:choose>
9142
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
9143
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
9144
+ </xsl:choose>
9145
+ </xsl:variable>
9146
+
9147
+ <xsl:choose>
9148
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
9149
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
9150
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
9151
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
9152
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
9153
+ <xsl:otherwise> <!-- level 1 -->
9154
+ <xsl:choose>
9155
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
9156
+ <xsl:otherwise>alphabet</xsl:otherwise>
9157
+ </xsl:choose>
9158
+ </xsl:otherwise>
9159
+ </xsl:choose>
9160
+
9161
+ </xsl:otherwise>
9162
+ </xsl:choose>
9163
+ </xsl:variable>
9164
+
9165
+ <xsl:variable name="format">
9166
+ <xsl:choose>
9167
+ <xsl:when test="$type = 'arabic'">
9168
+ 1.
9169
+ </xsl:when>
9170
+ <xsl:when test="$type = 'alphabet'">
9171
+ a)
9172
+ </xsl:when>
9173
+ <xsl:when test="$type = 'alphabet_upper'">
9174
+ A.
9175
+ </xsl:when>
9176
+ <xsl:when test="$type = 'roman'">
9177
+ (i)
9178
+ </xsl:when>
9179
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
9180
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
9181
+ </xsl:choose>
9182
+ </xsl:variable>
9183
+
9184
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
9185
+
9186
+ </xsl:otherwise>
9187
+ </xsl:choose>
8809
9188
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
8810
9189
  <xsl:choose>
8811
9190
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -8823,18 +9202,66 @@
8823
9202
 
8824
9203
  <fo:block-container margin-left="0mm">
8825
9204
  <fo:block>
8826
- <xsl:apply-templates select="." mode="ul_ol"/>
9205
+ <xsl:apply-templates select="." mode="list"/>
8827
9206
  </fo:block>
8828
9207
  </fo:block-container>
8829
9208
  </fo:block-container>
8830
9209
  </xsl:when>
8831
9210
  <xsl:otherwise>
8832
9211
  <fo:block>
8833
- <xsl:apply-templates select="." mode="ul_ol"/>
9212
+ <xsl:apply-templates select="." mode="list"/>
8834
9213
  </fo:block>
8835
9214
  </xsl:otherwise>
8836
9215
  </xsl:choose>
8837
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
9216
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
9217
+ <fo:list-block xsl:use-attribute-sets="list-style">
9218
+
9219
+
9220
+
9221
+
9222
+
9223
+
9224
+
9225
+
9226
+
9227
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
9228
+ </fo:list-block>
9229
+ <!-- <xsl:for-each select="./iho:note">
9230
+ <xsl:call-template name="note"/>
9231
+ </xsl:for-each> -->
9232
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
9233
+ </xsl:template><xsl:template match="*[local-name()='li']">
9234
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
9235
+ <xsl:copy-of select="@id"/>
9236
+
9237
+
9238
+
9239
+ <fo:list-item-label end-indent="label-end()">
9240
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
9241
+
9242
+
9243
+
9244
+ <xsl:call-template name="getListItemFormat"/>
9245
+ </fo:block>
9246
+ </fo:list-item-label>
9247
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
9248
+ <fo:block>
9249
+
9250
+
9251
+
9252
+
9253
+
9254
+ <xsl:apply-templates/>
9255
+
9256
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
9257
+
9258
+ <xsl:for-each select="./bsi:note">
9259
+ <xsl:call-template name="note"/>
9260
+ </xsl:for-each> -->
9261
+ </fo:block>
9262
+ </fo:list-item-body>
9263
+ </fo:list-item>
9264
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
8838
9265
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
8839
9266
  <bookmark><xsl:value-of select="@id"/></bookmark>
8840
9267
  </xsl:for-each>
@@ -8856,7 +9283,7 @@
8856
9283
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8857
9284
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
8858
9285
  <xsl:if test="@to">
8859
- <xsl:value-of select="$dash"/>
9286
+ <xsl:value-of select="$en_dash"/>
8860
9287
  <xsl:copy>
8861
9288
  <xsl:copy-of select="@*"/>
8862
9289
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -8881,7 +9308,7 @@
8881
9308
  <xsl:param name="target"/>
8882
9309
  <!-- <node></node> -->
8883
9310
  <xsl:choose>
8884
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
9311
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
8885
9312
  <!-- skip text (i.e. remove it) and process next element -->
8886
9313
  <!-- [removed_<xsl:value-of select="."/>] -->
8887
9314
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -8965,12 +9392,22 @@
8965
9392
  </xsl:variable>
8966
9393
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
8967
9394
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9395
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
9396
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
9397
+ <!-- Index -->
9398
+ <xsl:apply-templates/>
9399
+ </fo:block>
9400
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
9401
+ <!-- Letter A, B, C, ... -->
9402
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
9403
+ <xsl:apply-templates/>
9404
+ </fo:block>
8968
9405
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
8969
9406
  <xsl:apply-templates/>
8970
9407
  <fo:block>
8971
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
8972
- <fo:block> </fo:block>
8973
- </xsl:if>
9408
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
9409
+ <fo:block> </fo:block>
9410
+ </xsl:if>
8974
9411
  </fo:block>
8975
9412
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
8976
9413
  <xsl:apply-templates/>
@@ -8980,6 +9417,9 @@
8980
9417
 
8981
9418
  <xsl:apply-templates/>
8982
9419
  </fo:block>
9420
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
9421
+ <!-- to split by '_' and other chars -->
9422
+ <xsl:call-template name="add-zero-spaces-java"/>
8983
9423
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
8984
9424
  <fo:inline id="{@id}" font-size="1pt"/>
8985
9425
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -9327,7 +9767,7 @@
9327
9767
  </fo:table-body>
9328
9768
  </fo:table>
9329
9769
  </fo:block>
9330
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
9770
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
9331
9771
  <fo:table-row min-height="5mm">
9332
9772
  <xsl:apply-templates/>
9333
9773
  </fo:table-row>
@@ -9560,9 +10000,6 @@
9560
10000
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
9561
10001
  </xsl:choose>
9562
10002
  </xsl:template><xsl:template name="addPDFUAmeta">
9563
- <xsl:variable name="lang">
9564
- <xsl:call-template name="getLang"/>
9565
- </xsl:variable>
9566
10003
  <pdf:catalog>
9567
10004
  <pdf:dictionary type="normal" key="ViewerPreferences">
9568
10005
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -9790,10 +10227,12 @@
9790
10227
  <xsl:param name="key"/>
9791
10228
  <xsl:param name="formatted">false</xsl:param>
9792
10229
  <xsl:param name="lang"/>
10230
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
9793
10231
 
9794
10232
  <xsl:variable name="curr_lang">
9795
10233
  <xsl:choose>
9796
10234
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
10235
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
9797
10236
  <xsl:otherwise>
9798
10237
  <xsl:call-template name="getLang"/>
9799
10238
  </xsl:otherwise>
@@ -9828,6 +10267,7 @@
9828
10267
  </xsl:otherwise>
9829
10268
  </xsl:choose>
9830
10269
  </xsl:when>
10270
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
9831
10271
  <xsl:otherwise>
9832
10272
  <xsl:variable name="key_">
9833
10273
  <xsl:call-template name="capitalize">