metanorma-itu 2.2.8 → 2.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1644,19 +1644,23 @@
1644
1644
  <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/>
1645
1645
  <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/>
1646
1646
 
1647
- <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1648
- <xsl:choose>
1649
- <xsl:when test="$origin_text != ''">
1650
- <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1651
- </xsl:when>
1652
- <xsl:when test="contains($citeas, '[')">
1653
- <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1654
- </xsl:when>
1655
- <xsl:otherwise>
1656
- <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1657
- </xsl:otherwise>
1658
- </xsl:choose>
1659
- </fo:basic-link>
1647
+ <xsl:call-template name="insert_basic_link">
1648
+ <xsl:with-param name="element">
1649
+ <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1650
+ <xsl:choose>
1651
+ <xsl:when test="$origin_text != ''">
1652
+ <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1653
+ </xsl:when>
1654
+ <xsl:when test="contains($citeas, '[')">
1655
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1656
+ </xsl:when>
1657
+ <xsl:otherwise>
1658
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1659
+ </xsl:otherwise>
1660
+ </xsl:choose>
1661
+ </fo:basic-link>
1662
+ </xsl:with-param>
1663
+ </xsl:call-template>
1660
1664
  </xsl:if>
1661
1665
  <xsl:if test="following-sibling::itu:definition/node()">
1662
1666
  <xsl:text>: </xsl:text>
@@ -2763,11 +2767,17 @@
2763
2767
  <!-- ========================== -->
2764
2768
  <!-- Definition's list styles -->
2765
2769
  <!-- ========================== -->
2770
+
2771
+ <xsl:attribute-set name="dl-block-style">
2772
+
2773
+ </xsl:attribute-set>
2774
+
2766
2775
  <xsl:attribute-set name="dt-row-style">
2767
2776
 
2768
2777
  </xsl:attribute-set>
2769
2778
 
2770
2779
  <xsl:attribute-set name="dt-cell-style">
2780
+
2771
2781
  </xsl:attribute-set>
2772
2782
 
2773
2783
  <xsl:attribute-set name="dt-block-style">
@@ -2787,6 +2797,7 @@
2787
2797
 
2788
2798
  <xsl:attribute-set name="dd-cell-style">
2789
2799
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
2800
+
2790
2801
  </xsl:attribute-set>
2791
2802
 
2792
2803
  <!-- ========================== -->
@@ -2802,6 +2813,7 @@
2802
2813
  </xsl:attribute-set>
2803
2814
 
2804
2815
  <xsl:attribute-set name="xref-style">
2816
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
2805
2817
 
2806
2818
  <xsl:attribute name="color">blue</xsl:attribute>
2807
2819
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -2910,6 +2922,10 @@
2910
2922
 
2911
2923
  </xsl:attribute-set>
2912
2924
 
2925
+ <xsl:attribute-set name="figure-source-style">
2926
+
2927
+ </xsl:attribute-set>
2928
+
2913
2929
  <!-- Formula's styles -->
2914
2930
  <xsl:attribute-set name="formula-style">
2915
2931
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -3457,7 +3473,7 @@
3457
3473
 
3458
3474
  <xsl:template name="processTables_Contents">
3459
3475
  <tables>
3460
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3476
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3461
3477
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3462
3478
  <xsl:copy-of select="*[local-name() = 'name']"/>
3463
3479
  </table>
@@ -3822,7 +3838,7 @@
3822
3838
  </xsl:attribute>
3823
3839
  </xsl:for-each>
3824
3840
 
3825
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3841
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3826
3842
  <xsl:if test="$isNoteOrFnExist = 'true'">
3827
3843
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3828
3844
  </xsl:if>
@@ -3866,7 +3882,7 @@
3866
3882
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3867
3883
  </xsl:when>
3868
3884
  <xsl:otherwise>
3869
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
3885
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
3870
3886
  </xsl:otherwise>
3871
3887
  </xsl:choose>
3872
3888
 
@@ -3970,6 +3986,11 @@
3970
3986
  </xsl:if>
3971
3987
  </xsl:template> <!-- table/name -->
3972
3988
 
3989
+ <!-- SOURCE: ... -->
3990
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3991
+ <xsl:call-template name="termsource"/>
3992
+ </xsl:template>
3993
+
3973
3994
  <xsl:template name="calculate-columns-numbers">
3974
3995
  <xsl:param name="table-row"/>
3975
3996
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -4326,7 +4347,7 @@
4326
4347
  </fo:table-header>
4327
4348
  </xsl:template> <!-- thead -->
4328
4349
 
4329
- <!-- template is using for iso, jcgm, bsi only -->
4350
+ <!-- template is using for iec, iso, jcgm, bsi only -->
4330
4351
  <xsl:template name="table-header-title">
4331
4352
  <xsl:param name="cols-count"/>
4332
4353
  <!-- row for title -->
@@ -4369,7 +4390,7 @@
4369
4390
  <xsl:param name="colwidths"/>
4370
4391
  <xsl:param name="colgroup"/>
4371
4392
 
4372
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
4393
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4373
4394
 
4374
4395
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4375
4396
 
@@ -4458,6 +4479,7 @@
4458
4479
 
4459
4480
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4460
4481
  <xsl:apply-templates select="../*[local-name()='note']"/>
4482
+ <xsl:apply-templates select="../*[local-name()='source']"/>
4461
4483
 
4462
4484
  <xsl:variable name="isDisplayRowSeparator">
4463
4485
 
@@ -4843,9 +4865,13 @@
4843
4865
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4844
4866
  </xsl:if>
4845
4867
 
4846
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4847
- <xsl:value-of select="$current_fn_number_text"/>
4848
- </fo:basic-link>
4868
+ <xsl:call-template name="insert_basic_link">
4869
+ <xsl:with-param name="element">
4870
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4871
+ <xsl:value-of select="$current_fn_number_text"/>
4872
+ </fo:basic-link>
4873
+ </xsl:with-param>
4874
+ </xsl:call-template>
4849
4875
  </fo:inline>
4850
4876
  </xsl:variable>
4851
4877
 
@@ -5127,7 +5153,7 @@
5127
5153
  <xsl:variable name="isAdded" select="@added"/>
5128
5154
  <xsl:variable name="isDeleted" select="@deleted"/>
5129
5155
  <!-- <dl><xsl:copy-of select="."/></dl> -->
5130
- <fo:block-container>
5156
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
5131
5157
 
5132
5158
  <xsl:call-template name="setBlockSpanAll"/>
5133
5159
 
@@ -5135,6 +5161,18 @@
5135
5161
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5136
5162
  </xsl:if>
5137
5163
 
5164
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5165
+ <!-- set font-size as sourcecode font-size -->
5166
+ <xsl:variable name="sourcecode_attributes">
5167
+ <xsl:call-template name="get_sourcecode_attributes"/>
5168
+ </xsl:variable>
5169
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
5170
+ <xsl:attribute name="{local-name()}">
5171
+ <xsl:value-of select="."/>
5172
+ </xsl:attribute>
5173
+ </xsl:for-each>
5174
+ </xsl:if>
5175
+
5138
5176
  <xsl:if test="parent::*[local-name() = 'note']">
5139
5177
  <xsl:attribute name="margin-left">
5140
5178
  <xsl:choose>
@@ -5176,8 +5214,10 @@
5176
5214
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5177
5215
  <xsl:text> </xsl:text>
5178
5216
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5179
- <xsl:text/>
5180
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5217
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5218
+ <xsl:text> </xsl:text>
5219
+ </xsl:if>
5220
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5181
5221
  </fo:block>
5182
5222
 
5183
5223
  </xsl:when> <!-- END: only one component -->
@@ -5574,6 +5614,7 @@
5574
5614
  <xsl:param name="split_keep-within-line"/>
5575
5615
 
5576
5616
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5617
+
5577
5618
  <xsl:call-template name="insert_dt_cell">
5578
5619
  <xsl:with-param name="key_iso" select="$key_iso"/>
5579
5620
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5595,6 +5636,7 @@
5595
5636
  <!-- border is mandatory, to calculate real width -->
5596
5637
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5597
5638
  <xsl:attribute name="text-align">left</xsl:attribute>
5639
+
5598
5640
  </xsl:if>
5599
5641
 
5600
5642
  <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
@@ -5678,8 +5720,18 @@
5678
5720
  </xsl:if>
5679
5721
  </xsl:template>
5680
5722
 
5681
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5682
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5723
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5724
+ <xsl:variable name="is_inline_element_after_where">
5725
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5726
+ </xsl:variable>
5727
+ <xsl:choose>
5728
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5729
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5730
+ </xsl:when>
5731
+ <xsl:otherwise>
5732
+ <xsl:apply-templates select="."/>
5733
+ </xsl:otherwise>
5734
+ </xsl:choose>
5683
5735
  </xsl:template>
5684
5736
 
5685
5737
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -6047,6 +6099,7 @@
6047
6099
  <fo:inline>
6048
6100
  <xsl:for-each select="$styles/style">
6049
6101
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
6102
+
6050
6103
  </xsl:for-each>
6051
6104
  <xsl:apply-templates/>
6052
6105
  </fo:inline>
@@ -7106,6 +7159,79 @@
7106
7159
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7107
7160
  </xsl:template>
7108
7161
 
7162
+ <!-- special case for:
7163
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7164
+ <mstyle displaystyle="true">
7165
+ <msup>
7166
+ <mi color="#00000000">C</mi>
7167
+ <mtext>R</mtext>
7168
+ </msup>
7169
+ <msubsup>
7170
+ <mtext>C</mtext>
7171
+ <mi>n</mi>
7172
+ <mi>k</mi>
7173
+ </msubsup>
7174
+ </mstyle>
7175
+ </math>
7176
+ -->
7177
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7178
+ <xsl:copy>
7179
+ <xsl:copy-of select="@*"/>
7180
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
7181
+ <xsl:if test="string-length($next_mtext) != ''">
7182
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7183
+ </xsl:if>
7184
+ <xsl:apply-templates/>
7185
+ <xsl:value-of select="$next_mtext"/>
7186
+ </xsl:copy>
7187
+ </xsl:template>
7188
+
7189
+ <!-- special case for:
7190
+ <msup>
7191
+ <mtext/>
7192
+ <mn>1</mn>
7193
+ </msup>
7194
+ convert to (add mspace after mtext and enclose them into mrow):
7195
+ <msup>
7196
+ <mrow>
7197
+ <mtext/>
7198
+ <mspace height="1.47ex"/>
7199
+ </mrow>
7200
+ <mn>1</mn>
7201
+ </msup>
7202
+ -->
7203
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7204
+ <mathml:mrow>
7205
+ <xsl:copy-of select="."/>
7206
+ <mathml:mspace height="1.47ex"/>
7207
+ </mathml:mrow>
7208
+ </xsl:template>
7209
+
7210
+ <!-- add space around vertical line -->
7211
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7212
+ <xsl:copy>
7213
+ <xsl:apply-templates select="@*" mode="mathml"/>
7214
+ <xsl:if test="not(@lspace)">
7215
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7216
+ </xsl:if>
7217
+ <xsl:if test="not(@rspace)">
7218
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7219
+ </xsl:if>
7220
+ <xsl:apply-templates mode="mathml"/>
7221
+ </xsl:copy>
7222
+ </xsl:template>
7223
+
7224
+ <!-- decrease fontsize for 'Circled Times' char -->
7225
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7226
+ <xsl:copy>
7227
+ <xsl:apply-templates select="@*" mode="mathml"/>
7228
+ <xsl:if test="not(@fontsize)">
7229
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7230
+ </xsl:if>
7231
+ <xsl:apply-templates mode="mathml"/>
7232
+ </xsl:copy>
7233
+ </xsl:template>
7234
+
7109
7235
  <!-- Examples:
7110
7236
  <stem type="AsciiMath">x = 1</stem>
7111
7237
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7163,19 +7289,23 @@
7163
7289
  <xsl:apply-templates/>
7164
7290
  </xsl:when>
7165
7291
  <xsl:otherwise>
7166
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7167
- <xsl:choose>
7168
- <xsl:when test="normalize-space(.) = ''">
7169
- <xsl:call-template name="add-zero-spaces-link-java">
7170
- <xsl:with-param name="text" select="$target_text"/>
7171
- </xsl:call-template>
7172
- </xsl:when>
7173
- <xsl:otherwise>
7174
- <!-- output text from <link>text</link> -->
7175
- <xsl:apply-templates/>
7176
- </xsl:otherwise>
7177
- </xsl:choose>
7178
- </fo:basic-link>
7292
+ <xsl:call-template name="insert_basic_link">
7293
+ <xsl:with-param name="element">
7294
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7295
+ <xsl:choose>
7296
+ <xsl:when test="normalize-space(.) = ''">
7297
+ <xsl:call-template name="add-zero-spaces-link-java">
7298
+ <xsl:with-param name="text" select="$target_text"/>
7299
+ </xsl:call-template>
7300
+ </xsl:when>
7301
+ <xsl:otherwise>
7302
+ <!-- output text from <link>text</link> -->
7303
+ <xsl:apply-templates/>
7304
+ </xsl:otherwise>
7305
+ </xsl:choose>
7306
+ </fo:basic-link>
7307
+ </xsl:with-param>
7308
+ </xsl:call-template>
7179
7309
  </xsl:otherwise>
7180
7310
  </xsl:choose>
7181
7311
  </fo:inline>
@@ -7238,12 +7368,16 @@
7238
7368
  </xsl:template>
7239
7369
 
7240
7370
  <xsl:template match="*[local-name() = 'xref']">
7241
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7242
- <xsl:if test="parent::*[local-name() = 'add']">
7243
- <xsl:call-template name="append_add-style"/>
7244
- </xsl:if>
7245
- <xsl:apply-templates/>
7246
- </fo:basic-link>
7371
+ <xsl:call-template name="insert_basic_link">
7372
+ <xsl:with-param name="element">
7373
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7374
+ <xsl:if test="parent::*[local-name() = 'add']">
7375
+ <xsl:call-template name="append_add-style"/>
7376
+ </xsl:if>
7377
+ <xsl:apply-templates/>
7378
+ </fo:basic-link>
7379
+ </xsl:with-param>
7380
+ </xsl:call-template>
7247
7381
  </xsl:template>
7248
7382
 
7249
7383
  <!-- ====== -->
@@ -7552,6 +7686,13 @@
7552
7686
  </fo:block>
7553
7687
  </xsl:template>
7554
7688
 
7689
+ <!-- SOURCE: ... -->
7690
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
7691
+
7692
+ <xsl:call-template name="termsource"/>
7693
+
7694
+ </xsl:template>
7695
+
7555
7696
  <xsl:template match="*[local-name() = 'image']">
7556
7697
  <xsl:variable name="isAdded" select="../@added"/>
7557
7698
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7625,7 +7766,7 @@
7625
7766
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7626
7767
  </xsl:when>
7627
7768
  <xsl:when test="not(starts-with(@src, 'data:'))">
7628
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7769
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7629
7770
  </xsl:when>
7630
7771
  <xsl:otherwise>
7631
7772
  <xsl:value-of select="@src"/>
@@ -7647,7 +7788,7 @@
7647
7788
  </xsl:when>
7648
7789
  <xsl:when test="not(starts-with(@src, 'data:'))">
7649
7790
  <xsl:variable name="src">
7650
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7791
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7651
7792
  </xsl:variable>
7652
7793
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7653
7794
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8033,15 +8174,19 @@
8033
8174
  <xsl:param name="dest"/>
8034
8175
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8035
8176
  <fo:block font-size="1pt">
8036
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8037
- <fo:inline-container inline-progression-dimension="100%">
8038
- <fo:block-container height="{$height - 1}px" width="100%">
8039
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8040
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8041
- </xsl:if> -->
8042
- <fo:block> </fo:block></fo:block-container>
8043
- </fo:inline-container>
8044
- </fo:basic-link>
8177
+ <xsl:call-template name="insert_basic_link">
8178
+ <xsl:with-param name="element">
8179
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8180
+ <fo:inline-container inline-progression-dimension="100%">
8181
+ <fo:block-container height="{$height - 1}px" width="100%">
8182
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8183
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8184
+ </xsl:if> -->
8185
+ <fo:block> </fo:block></fo:block-container>
8186
+ </fo:inline-container>
8187
+ </fo:basic-link>
8188
+ </xsl:with-param>
8189
+ </xsl:call-template>
8045
8190
  </fo:block>
8046
8191
  </fo:block-container>
8047
8192
  </xsl:template>
@@ -8683,9 +8828,11 @@
8683
8828
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8684
8829
  </xsl:if>
8685
8830
 
8686
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8831
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
8687
8832
  </fo:block>
8688
8833
 
8834
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
8835
+
8689
8836
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
8690
8837
 
8691
8838
  </fo:block-container>
@@ -8717,11 +8864,22 @@
8717
8864
  <!-- add sourcecode highlighting -->
8718
8865
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
8719
8866
  <xsl:variable name="class" select="@class"/>
8867
+
8868
+ <!-- Example: <1> -->
8869
+ <xsl:variable name="is_callout">
8870
+ <xsl:if test="parent::*[local-name() = 'dt']">
8871
+ <xsl:variable name="dt_id" select="../@id"/>
8872
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
8873
+ </xsl:if>
8874
+ </xsl:variable>
8875
+
8720
8876
  <xsl:choose>
8721
8877
  <xsl:when test="$sourcecode_css//class[@name = $class]">
8722
8878
  <fo:inline>
8723
8879
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
8880
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
8724
8881
  <xsl:apply-templates/>
8882
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
8725
8883
  </fo:inline>
8726
8884
  </xsl:when>
8727
8885
  <xsl:otherwise>
@@ -9145,6 +9303,10 @@
9145
9303
  </fo:block>
9146
9304
  </xsl:template>
9147
9305
 
9306
+ <xsl:template match="*[local-name() = 'div']">
9307
+ <fo:block><xsl:apply-templates/></fo:block>
9308
+ </xsl:template>
9309
+
9148
9310
  <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
9149
9311
  <fo:block xsl:use-attribute-sets="inherit-style">
9150
9312
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -9570,14 +9732,18 @@
9570
9732
  </xsl:template>
9571
9733
 
9572
9734
  <xsl:template match="*[local-name() = 'origin']">
9573
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9574
- <xsl:if test="normalize-space(@citeas) = ''">
9575
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9576
- </xsl:if>
9577
- <fo:inline xsl:use-attribute-sets="origin-style">
9578
- <xsl:apply-templates/>
9579
- </fo:inline>
9580
- </fo:basic-link>
9735
+ <xsl:call-template name="insert_basic_link">
9736
+ <xsl:with-param name="element">
9737
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9738
+ <xsl:if test="normalize-space(@citeas) = ''">
9739
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9740
+ </xsl:if>
9741
+ <fo:inline xsl:use-attribute-sets="origin-style">
9742
+ <xsl:apply-templates/>
9743
+ </fo:inline>
9744
+ </fo:basic-link>
9745
+ </xsl:with-param>
9746
+ </xsl:call-template>
9581
9747
  </xsl:template>
9582
9748
 
9583
9749
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -9651,9 +9817,13 @@
9651
9817
  <xsl:if test="../*[local-name() = 'author']">
9652
9818
  <xsl:text>, </xsl:text>
9653
9819
  </xsl:if>
9654
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9655
- <xsl:apply-templates/>
9656
- </fo:basic-link>
9820
+ <xsl:call-template name="insert_basic_link">
9821
+ <xsl:with-param name="element">
9822
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9823
+ <xsl:apply-templates/>
9824
+ </fo:basic-link>
9825
+ </xsl:with-param>
9826
+ </xsl:call-template>
9657
9827
  </xsl:template>
9658
9828
 
9659
9829
  <xsl:template match="*[local-name() = 'author']">
@@ -9702,25 +9872,29 @@
9702
9872
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
9703
9873
  <xsl:variable name="text" select="normalize-space()"/>
9704
9874
 
9705
- <fo:basic-link fox:alt-text="{@citeas}">
9706
- <xsl:if test="normalize-space(@citeas) = ''">
9707
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9708
- </xsl:if>
9709
- <xsl:if test="@type = 'inline'">
9875
+ <xsl:call-template name="insert_basic_link">
9876
+ <xsl:with-param name="element">
9877
+ <fo:basic-link fox:alt-text="{@citeas}">
9878
+ <xsl:if test="normalize-space(@citeas) = ''">
9879
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9880
+ </xsl:if>
9881
+ <xsl:if test="@type = 'inline'">
9710
9882
 
9711
- </xsl:if>
9883
+ </xsl:if>
9712
9884
 
9713
- <xsl:choose>
9714
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9715
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9716
- </xsl:when>
9717
- <xsl:otherwise>
9718
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9719
- </xsl:otherwise>
9720
- </xsl:choose>
9885
+ <xsl:choose>
9886
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9887
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9888
+ </xsl:when>
9889
+ <xsl:otherwise>
9890
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9891
+ </xsl:otherwise>
9892
+ </xsl:choose>
9721
9893
 
9722
- <xsl:apply-templates/>
9723
- </fo:basic-link>
9894
+ <xsl:apply-templates/>
9895
+ </fo:basic-link>
9896
+ </xsl:with-param>
9897
+ </xsl:call-template>
9724
9898
 
9725
9899
  </fo:inline>
9726
9900
  </xsl:when>
@@ -9839,13 +10013,8 @@
9839
10013
  </xsl:template>
9840
10014
 
9841
10015
  <xsl:template match="*[local-name() = 'deprecates']">
9842
- <xsl:variable name="title-deprecated">
9843
- <xsl:call-template name="getLocalizedString">
9844
- <xsl:with-param name="key">deprecated</xsl:with-param>
9845
- </xsl:call-template>
9846
- </xsl:variable>
9847
10016
  <fo:block xsl:use-attribute-sets="deprecates-style">
9848
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
10017
+ <xsl:apply-templates/>
9849
10018
  </fo:block>
9850
10019
  </xsl:template>
9851
10020
 
@@ -9976,7 +10145,10 @@
9976
10145
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
9977
10146
 
9978
10147
  <xsl:template name="setULLabel">
9979
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10148
+ <xsl:variable name="list_level__">
10149
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10150
+ </xsl:variable>
10151
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
9980
10152
  <xsl:variable name="list_level">
9981
10153
  <xsl:choose>
9982
10154
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10109,9 +10281,11 @@
10109
10281
  </fo:block-container>
10110
10282
  </xsl:when>
10111
10283
  <xsl:otherwise>
10112
- <fo:block>
10113
- <xsl:apply-templates select="." mode="list"/>
10114
- </fo:block>
10284
+
10285
+ <fo:block>
10286
+ <xsl:apply-templates select="." mode="list"/>
10287
+ </fo:block>
10288
+
10115
10289
  </xsl:otherwise>
10116
10290
  </xsl:choose>
10117
10291
  </xsl:template>
@@ -10823,24 +10997,32 @@
10823
10997
  <xsl:for-each select="*[local-name() = 'tab']">
10824
10998
  <xsl:variable name="current_id" select="generate-id()"/>
10825
10999
  <fo:table-cell>
10826
- <fo:block>
10827
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10828
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10829
- <xsl:choose>
10830
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10831
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10832
- </xsl:choose>
10833
- </xsl:for-each>
10834
- </fo:basic-link>
11000
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11001
+ <xsl:call-template name="insert_basic_link">
11002
+ <xsl:with-param name="element">
11003
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11004
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11005
+ <xsl:choose>
11006
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11007
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11008
+ </xsl:choose>
11009
+ </xsl:for-each>
11010
+ </fo:basic-link>
11011
+ </xsl:with-param>
11012
+ </xsl:call-template>
10835
11013
  </fo:block>
10836
11014
  </fo:table-cell>
10837
11015
  </xsl:for-each>
10838
11016
  <!-- last column - for page numbers -->
10839
11017
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
10840
11018
  <fo:block>
10841
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10842
- <fo:page-number-citation ref-id="{$target}"/>
10843
- </fo:basic-link>
11019
+ <xsl:call-template name="insert_basic_link">
11020
+ <xsl:with-param name="element">
11021
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11022
+ <fo:page-number-citation ref-id="{$target}"/>
11023
+ </fo:basic-link>
11024
+ </xsl:with-param>
11025
+ </xsl:call-template>
10844
11026
  </fo:block>
10845
11027
  </fo:table-cell>
10846
11028
  </xsl:template>
@@ -10882,6 +11064,27 @@
10882
11064
  <!-- End Table of Contents (ToC) processing -->
10883
11065
  <!-- =================== -->
10884
11066
 
11067
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11068
+ <xsl:template name="insert_basic_link">
11069
+ <xsl:param name="element"/>
11070
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11071
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11072
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11073
+ <xsl:choose>
11074
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11075
+ <xsl:copy-of select="$element_node"/>
11076
+ </xsl:when>
11077
+ <xsl:otherwise>
11078
+ <fo:inline>
11079
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11080
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11081
+ </xsl:for-each>
11082
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11083
+ </fo:inline>
11084
+ </xsl:otherwise>
11085
+ </xsl:choose>
11086
+ </xsl:template>
11087
+
10885
11088
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10886
11089
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
10887
11090
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -11104,6 +11307,23 @@
11104
11307
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
11105
11308
  <xsl:copy-of select="."/>
11106
11309
  </xsl:template>
11310
+
11311
+ <!-- add @id, redundant for table auto-layout algorithm -->
11312
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11313
+ <xsl:copy>
11314
+ <xsl:copy-of select="@*"/>
11315
+ <xsl:call-template name="add_id"/>
11316
+ <xsl:apply-templates mode="update_xml_step1"/>
11317
+ </xsl:copy>
11318
+ </xsl:template>
11319
+
11320
+ <xsl:template name="add_id">
11321
+ <xsl:if test="not(@id)">
11322
+ <!-- add @id - first element with @id plus '_element_name' -->
11323
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
11324
+ </xsl:if>
11325
+ </xsl:template>
11326
+
11107
11327
  <!-- =========================================================================== -->
11108
11328
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11109
11329
  <!-- =========================================================================== -->