metanorma-iso 2.4.1 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2094,7 +2094,7 @@
2094
2094
  <xsl:template match="iso:indexsect" mode="index">
2095
2095
 
2096
2096
  <fo:page-sequence master-reference="index" force-page-count="no-force">
2097
- <xsl:variable name="header-title">
2097
+ <!-- <xsl:variable name="header-title">
2098
2098
  <xsl:choose>
2099
2099
  <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2100
2100
  <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
@@ -2103,13 +2103,14 @@
2103
2103
  <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2104
2104
  </xsl:otherwise>
2105
2105
  </xsl:choose>
2106
- </xsl:variable>
2106
+ </xsl:variable> -->
2107
2107
  <xsl:call-template name="insertHeaderFooter">
2108
- <xsl:with-param name="header-title" select="$header-title"/>
2108
+ <!-- <xsl:with-param name="header-title" select="$header-title"/> -->
2109
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
2109
2110
  </xsl:call-template>
2110
2111
 
2111
2112
  <fo:flow flow-name="xsl-region-body">
2112
- <fo:block id="{@id}" span="all">
2113
+ <fo:block id="{@id}" text-align="center" span="all">
2113
2114
  <xsl:apply-templates select="iso:title"/>
2114
2115
  </fo:block>
2115
2116
  <fo:block role="Index">
@@ -2120,21 +2121,25 @@
2120
2121
  </xsl:template>
2121
2122
 
2122
2123
  <xsl:template match="iso:xref" priority="2">
2123
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2124
- <xsl:choose>
2125
- <xsl:when test="@pagenumber='true'">
2126
- <fo:inline>
2127
- <xsl:if test="@id">
2128
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2129
- </xsl:if>
2130
- <fo:page-number-citation ref-id="{@target}"/>
2131
- </fo:inline>
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
- <xsl:apply-templates/>
2135
- </xsl:otherwise>
2136
- </xsl:choose>
2137
- </fo:basic-link>
2124
+ <xsl:call-template name="insert_basic_link">
2125
+ <xsl:with-param name="element">
2126
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2127
+ <xsl:choose>
2128
+ <xsl:when test="@pagenumber='true'">
2129
+ <fo:inline>
2130
+ <xsl:if test="@id">
2131
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2132
+ </xsl:if>
2133
+ <fo:page-number-citation ref-id="{@target}"/>
2134
+ </fo:inline>
2135
+ </xsl:when>
2136
+ <xsl:otherwise>
2137
+ <xsl:apply-templates/>
2138
+ </xsl:otherwise>
2139
+ </xsl:choose>
2140
+ </fo:basic-link>
2141
+ </xsl:with-param>
2142
+ </xsl:call-template>
2138
2143
  </xsl:template>
2139
2144
 
2140
2145
  <!-- =================== -->
@@ -2974,11 +2979,17 @@
2974
2979
  <!-- ========================== -->
2975
2980
  <!-- Definition's list styles -->
2976
2981
  <!-- ========================== -->
2982
+
2983
+ <xsl:attribute-set name="dl-block-style">
2984
+
2985
+ </xsl:attribute-set>
2986
+
2977
2987
  <xsl:attribute-set name="dt-row-style">
2978
2988
 
2979
2989
  </xsl:attribute-set>
2980
2990
 
2981
2991
  <xsl:attribute-set name="dt-cell-style">
2992
+
2982
2993
  </xsl:attribute-set>
2983
2994
 
2984
2995
  <xsl:attribute-set name="dt-block-style">
@@ -2996,6 +3007,7 @@
2996
3007
 
2997
3008
  <xsl:attribute-set name="dd-cell-style">
2998
3009
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
3010
+
2999
3011
  </xsl:attribute-set>
3000
3012
 
3001
3013
  <!-- ========================== -->
@@ -3020,6 +3032,7 @@
3020
3032
  </xsl:attribute-set>
3021
3033
 
3022
3034
  <xsl:attribute-set name="xref-style">
3035
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3023
3036
 
3024
3037
  <xsl:attribute name="color">blue</xsl:attribute>
3025
3038
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -3136,6 +3149,10 @@
3136
3149
 
3137
3150
  </xsl:attribute-set>
3138
3151
 
3152
+ <xsl:attribute-set name="figure-source-style">
3153
+
3154
+ </xsl:attribute-set>
3155
+
3139
3156
  <!-- Formula's styles -->
3140
3157
  <xsl:attribute-set name="formula-style">
3141
3158
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -3671,7 +3688,7 @@
3671
3688
 
3672
3689
  <xsl:template name="processTables_Contents">
3673
3690
  <tables>
3674
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3691
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3675
3692
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3676
3693
  <xsl:copy-of select="*[local-name() = 'name']"/>
3677
3694
  </table>
@@ -4027,7 +4044,7 @@
4027
4044
  </xsl:attribute>
4028
4045
  </xsl:for-each>
4029
4046
 
4030
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4047
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4031
4048
  <xsl:if test="$isNoteOrFnExist = 'true'">
4032
4049
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4033
4050
  </xsl:if>
@@ -4071,7 +4088,7 @@
4071
4088
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4072
4089
  </xsl:when>
4073
4090
  <xsl:otherwise>
4074
- <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 -->
4091
+ <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 -->
4075
4092
  </xsl:otherwise>
4076
4093
  </xsl:choose>
4077
4094
 
@@ -4194,6 +4211,11 @@
4194
4211
  </xsl:if>
4195
4212
  </xsl:template> <!-- table/name -->
4196
4213
 
4214
+ <!-- SOURCE: ... -->
4215
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4216
+ <xsl:call-template name="termsource"/>
4217
+ </xsl:template>
4218
+
4197
4219
  <xsl:template name="calculate-columns-numbers">
4198
4220
  <xsl:param name="table-row"/>
4199
4221
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -4554,7 +4576,7 @@
4554
4576
  </fo:table-header>
4555
4577
  </xsl:template> <!-- thead -->
4556
4578
 
4557
- <!-- template is using for iso, jcgm, bsi only -->
4579
+ <!-- template is using for iec, iso, jcgm, bsi only -->
4558
4580
  <xsl:template name="table-header-title">
4559
4581
  <xsl:param name="cols-count"/>
4560
4582
  <!-- row for title -->
@@ -4607,7 +4629,7 @@
4607
4629
  <xsl:param name="colwidths"/>
4608
4630
  <xsl:param name="colgroup"/>
4609
4631
 
4610
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
4632
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
4611
4633
 
4612
4634
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4613
4635
 
@@ -4677,6 +4699,7 @@
4677
4699
 
4678
4700
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4679
4701
  <xsl:apply-templates select="../*[local-name()='note']"/>
4702
+ <xsl:apply-templates select="../*[local-name()='source']"/>
4680
4703
 
4681
4704
  <xsl:variable name="isDisplayRowSeparator">
4682
4705
 
@@ -5112,9 +5135,13 @@
5112
5135
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
5113
5136
  </xsl:if>
5114
5137
 
5115
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5116
- <xsl:value-of select="$current_fn_number_text"/>
5117
- </fo:basic-link>
5138
+ <xsl:call-template name="insert_basic_link">
5139
+ <xsl:with-param name="element">
5140
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5141
+ <xsl:value-of select="$current_fn_number_text"/>
5142
+ </fo:basic-link>
5143
+ </xsl:with-param>
5144
+ </xsl:call-template>
5118
5145
  </fo:inline>
5119
5146
  </xsl:variable>
5120
5147
 
@@ -5391,7 +5418,7 @@
5391
5418
  <xsl:variable name="isAdded" select="@added"/>
5392
5419
  <xsl:variable name="isDeleted" select="@deleted"/>
5393
5420
  <!-- <dl><xsl:copy-of select="."/></dl> -->
5394
- <fo:block-container>
5421
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
5395
5422
 
5396
5423
  <xsl:call-template name="setBlockSpanAll"/>
5397
5424
 
@@ -5399,6 +5426,18 @@
5399
5426
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5400
5427
  </xsl:if>
5401
5428
 
5429
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5430
+ <!-- set font-size as sourcecode font-size -->
5431
+ <xsl:variable name="sourcecode_attributes">
5432
+ <xsl:call-template name="get_sourcecode_attributes"/>
5433
+ </xsl:variable>
5434
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
5435
+ <xsl:attribute name="{local-name()}">
5436
+ <xsl:value-of select="."/>
5437
+ </xsl:attribute>
5438
+ </xsl:for-each>
5439
+ </xsl:if>
5440
+
5402
5441
  <xsl:if test="parent::*[local-name() = 'note']">
5403
5442
  <xsl:attribute name="margin-left">
5404
5443
  <xsl:choose>
@@ -5444,8 +5483,10 @@
5444
5483
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5445
5484
  <xsl:text> </xsl:text>
5446
5485
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5447
- <xsl:text/>
5448
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5486
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5487
+ <xsl:text> </xsl:text>
5488
+ </xsl:if>
5489
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5449
5490
  </fo:block>
5450
5491
 
5451
5492
  </xsl:when> <!-- END: only one component -->
@@ -5850,6 +5891,7 @@
5850
5891
  <xsl:param name="split_keep-within-line"/>
5851
5892
 
5852
5893
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
5894
+
5853
5895
  <xsl:call-template name="insert_dt_cell">
5854
5896
  <xsl:with-param name="key_iso" select="$key_iso"/>
5855
5897
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -5871,6 +5913,7 @@
5871
5913
  <!-- border is mandatory, to calculate real width -->
5872
5914
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
5873
5915
  <xsl:attribute name="text-align">left</xsl:attribute>
5916
+
5874
5917
  </xsl:if>
5875
5918
 
5876
5919
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -5944,8 +5987,18 @@
5944
5987
  </xsl:if>
5945
5988
  </xsl:template>
5946
5989
 
5947
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5948
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5990
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5991
+ <xsl:variable name="is_inline_element_after_where">
5992
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5993
+ </xsl:variable>
5994
+ <xsl:choose>
5995
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5996
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5997
+ </xsl:when>
5998
+ <xsl:otherwise>
5999
+ <xsl:apply-templates select="."/>
6000
+ </xsl:otherwise>
6001
+ </xsl:choose>
5949
6002
  </xsl:template>
5950
6003
 
5951
6004
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -6384,6 +6437,7 @@
6384
6437
  <fo:inline>
6385
6438
  <xsl:for-each select="$styles/style">
6386
6439
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
6440
+
6387
6441
  </xsl:for-each>
6388
6442
  <xsl:apply-templates/>
6389
6443
  </fo:inline>
@@ -7450,6 +7504,79 @@
7450
7504
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7451
7505
  </xsl:template>
7452
7506
 
7507
+ <!-- special case for:
7508
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7509
+ <mstyle displaystyle="true">
7510
+ <msup>
7511
+ <mi color="#00000000">C</mi>
7512
+ <mtext>R</mtext>
7513
+ </msup>
7514
+ <msubsup>
7515
+ <mtext>C</mtext>
7516
+ <mi>n</mi>
7517
+ <mi>k</mi>
7518
+ </msubsup>
7519
+ </mstyle>
7520
+ </math>
7521
+ -->
7522
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7523
+ <xsl:copy>
7524
+ <xsl:copy-of select="@*"/>
7525
+ <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"/>
7526
+ <xsl:if test="string-length($next_mtext) != ''">
7527
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7528
+ </xsl:if>
7529
+ <xsl:apply-templates/>
7530
+ <xsl:value-of select="$next_mtext"/>
7531
+ </xsl:copy>
7532
+ </xsl:template>
7533
+
7534
+ <!-- special case for:
7535
+ <msup>
7536
+ <mtext/>
7537
+ <mn>1</mn>
7538
+ </msup>
7539
+ convert to (add mspace after mtext and enclose them into mrow):
7540
+ <msup>
7541
+ <mrow>
7542
+ <mtext/>
7543
+ <mspace height="1.47ex"/>
7544
+ </mrow>
7545
+ <mn>1</mn>
7546
+ </msup>
7547
+ -->
7548
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7549
+ <mathml:mrow>
7550
+ <xsl:copy-of select="."/>
7551
+ <mathml:mspace height="1.47ex"/>
7552
+ </mathml:mrow>
7553
+ </xsl:template>
7554
+
7555
+ <!-- add space around vertical line -->
7556
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7557
+ <xsl:copy>
7558
+ <xsl:apply-templates select="@*" mode="mathml"/>
7559
+ <xsl:if test="not(@lspace)">
7560
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7561
+ </xsl:if>
7562
+ <xsl:if test="not(@rspace)">
7563
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7564
+ </xsl:if>
7565
+ <xsl:apply-templates mode="mathml"/>
7566
+ </xsl:copy>
7567
+ </xsl:template>
7568
+
7569
+ <!-- decrease fontsize for 'Circled Times' char -->
7570
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7571
+ <xsl:copy>
7572
+ <xsl:apply-templates select="@*" mode="mathml"/>
7573
+ <xsl:if test="not(@fontsize)">
7574
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7575
+ </xsl:if>
7576
+ <xsl:apply-templates mode="mathml"/>
7577
+ </xsl:copy>
7578
+ </xsl:template>
7579
+
7453
7580
  <!-- Examples:
7454
7581
  <stem type="AsciiMath">x = 1</stem>
7455
7582
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7507,19 +7634,23 @@
7507
7634
  <xsl:apply-templates/>
7508
7635
  </xsl:when>
7509
7636
  <xsl:otherwise>
7510
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7511
- <xsl:choose>
7512
- <xsl:when test="normalize-space(.) = ''">
7513
- <xsl:call-template name="add-zero-spaces-link-java">
7514
- <xsl:with-param name="text" select="$target_text"/>
7515
- </xsl:call-template>
7516
- </xsl:when>
7517
- <xsl:otherwise>
7518
- <!-- output text from <link>text</link> -->
7519
- <xsl:apply-templates/>
7520
- </xsl:otherwise>
7521
- </xsl:choose>
7522
- </fo:basic-link>
7637
+ <xsl:call-template name="insert_basic_link">
7638
+ <xsl:with-param name="element">
7639
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7640
+ <xsl:choose>
7641
+ <xsl:when test="normalize-space(.) = ''">
7642
+ <xsl:call-template name="add-zero-spaces-link-java">
7643
+ <xsl:with-param name="text" select="$target_text"/>
7644
+ </xsl:call-template>
7645
+ </xsl:when>
7646
+ <xsl:otherwise>
7647
+ <!-- output text from <link>text</link> -->
7648
+ <xsl:apply-templates/>
7649
+ </xsl:otherwise>
7650
+ </xsl:choose>
7651
+ </fo:basic-link>
7652
+ </xsl:with-param>
7653
+ </xsl:call-template>
7523
7654
  </xsl:otherwise>
7524
7655
  </xsl:choose>
7525
7656
  </fo:inline>
@@ -7582,12 +7713,16 @@
7582
7713
  </xsl:template>
7583
7714
 
7584
7715
  <xsl:template match="*[local-name() = 'xref']">
7585
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7586
- <xsl:if test="parent::*[local-name() = 'add']">
7587
- <xsl:call-template name="append_add-style"/>
7588
- </xsl:if>
7589
- <xsl:apply-templates/>
7590
- </fo:basic-link>
7716
+ <xsl:call-template name="insert_basic_link">
7717
+ <xsl:with-param name="element">
7718
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7719
+ <xsl:if test="parent::*[local-name() = 'add']">
7720
+ <xsl:call-template name="append_add-style"/>
7721
+ </xsl:if>
7722
+ <xsl:apply-templates/>
7723
+ </fo:basic-link>
7724
+ </xsl:with-param>
7725
+ </xsl:call-template>
7591
7726
  </xsl:template>
7592
7727
 
7593
7728
  <!-- ====== -->
@@ -7900,6 +8035,13 @@
7900
8035
  </fo:block>
7901
8036
  </xsl:template>
7902
8037
 
8038
+ <!-- SOURCE: ... -->
8039
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
8040
+
8041
+ <xsl:call-template name="termsource"/>
8042
+
8043
+ </xsl:template>
8044
+
7903
8045
  <xsl:template match="*[local-name() = 'image']">
7904
8046
  <xsl:variable name="isAdded" select="../@added"/>
7905
8047
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -7973,7 +8115,7 @@
7973
8115
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7974
8116
  </xsl:when>
7975
8117
  <xsl:when test="not(starts-with(@src, 'data:'))">
7976
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8118
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7977
8119
  </xsl:when>
7978
8120
  <xsl:otherwise>
7979
8121
  <xsl:value-of select="@src"/>
@@ -7995,7 +8137,7 @@
7995
8137
  </xsl:when>
7996
8138
  <xsl:when test="not(starts-with(@src, 'data:'))">
7997
8139
  <xsl:variable name="src">
7998
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8140
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7999
8141
  </xsl:variable>
8000
8142
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8001
8143
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8381,15 +8523,19 @@
8381
8523
  <xsl:param name="dest"/>
8382
8524
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8383
8525
  <fo:block font-size="1pt">
8384
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8385
- <fo:inline-container inline-progression-dimension="100%">
8386
- <fo:block-container height="{$height - 1}px" width="100%">
8387
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8388
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8389
- </xsl:if> -->
8390
- <fo:block> </fo:block></fo:block-container>
8391
- </fo:inline-container>
8392
- </fo:basic-link>
8526
+ <xsl:call-template name="insert_basic_link">
8527
+ <xsl:with-param name="element">
8528
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8529
+ <fo:inline-container inline-progression-dimension="100%">
8530
+ <fo:block-container height="{$height - 1}px" width="100%">
8531
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8532
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8533
+ </xsl:if> -->
8534
+ <fo:block> </fo:block></fo:block-container>
8535
+ </fo:inline-container>
8536
+ </fo:basic-link>
8537
+ </xsl:with-param>
8538
+ </xsl:call-template>
8393
8539
  </fo:block>
8394
8540
  </fo:block-container>
8395
8541
  </xsl:template>
@@ -9029,9 +9175,11 @@
9029
9175
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
9030
9176
  </xsl:if>
9031
9177
 
9032
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9178
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
9033
9179
  </fo:block>
9034
9180
 
9181
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
9182
+
9035
9183
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
9036
9184
 
9037
9185
  </fo:block-container>
@@ -9063,11 +9211,22 @@
9063
9211
  <!-- add sourcecode highlighting -->
9064
9212
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
9065
9213
  <xsl:variable name="class" select="@class"/>
9214
+
9215
+ <!-- Example: <1> -->
9216
+ <xsl:variable name="is_callout">
9217
+ <xsl:if test="parent::*[local-name() = 'dt']">
9218
+ <xsl:variable name="dt_id" select="../@id"/>
9219
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
9220
+ </xsl:if>
9221
+ </xsl:variable>
9222
+
9066
9223
  <xsl:choose>
9067
9224
  <xsl:when test="$sourcecode_css//class[@name = $class]">
9068
9225
  <fo:inline>
9069
9226
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
9227
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
9070
9228
  <xsl:apply-templates/>
9229
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
9071
9230
  </fo:inline>
9072
9231
  </xsl:when>
9073
9232
  <xsl:otherwise>
@@ -9493,6 +9652,10 @@
9493
9652
  </fo:block>
9494
9653
  </xsl:template>
9495
9654
 
9655
+ <xsl:template match="*[local-name() = 'div']">
9656
+ <fo:block><xsl:apply-templates/></fo:block>
9657
+ </xsl:template>
9658
+
9496
9659
  <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']">
9497
9660
  <fo:block xsl:use-attribute-sets="inherit-style">
9498
9661
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -9923,14 +10086,18 @@
9923
10086
  </xsl:template>
9924
10087
 
9925
10088
  <xsl:template match="*[local-name() = 'origin']">
9926
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9927
- <xsl:if test="normalize-space(@citeas) = ''">
9928
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9929
- </xsl:if>
9930
- <fo:inline xsl:use-attribute-sets="origin-style">
9931
- <xsl:apply-templates/>
9932
- </fo:inline>
9933
- </fo:basic-link>
10089
+ <xsl:call-template name="insert_basic_link">
10090
+ <xsl:with-param name="element">
10091
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10092
+ <xsl:if test="normalize-space(@citeas) = ''">
10093
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10094
+ </xsl:if>
10095
+ <fo:inline xsl:use-attribute-sets="origin-style">
10096
+ <xsl:apply-templates/>
10097
+ </fo:inline>
10098
+ </fo:basic-link>
10099
+ </xsl:with-param>
10100
+ </xsl:call-template>
9934
10101
  </xsl:template>
9935
10102
 
9936
10103
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -10009,9 +10176,13 @@
10009
10176
  <xsl:if test="../*[local-name() = 'author']">
10010
10177
  <xsl:text>, </xsl:text>
10011
10178
  </xsl:if>
10012
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10013
- <xsl:apply-templates/>
10014
- </fo:basic-link>
10179
+ <xsl:call-template name="insert_basic_link">
10180
+ <xsl:with-param name="element">
10181
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10182
+ <xsl:apply-templates/>
10183
+ </fo:basic-link>
10184
+ </xsl:with-param>
10185
+ </xsl:call-template>
10015
10186
  </xsl:template>
10016
10187
 
10017
10188
  <xsl:template match="*[local-name() = 'author']">
@@ -10060,25 +10231,29 @@
10060
10231
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
10061
10232
  <xsl:variable name="text" select="normalize-space()"/>
10062
10233
 
10063
- <fo:basic-link fox:alt-text="{@citeas}">
10064
- <xsl:if test="normalize-space(@citeas) = ''">
10065
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10066
- </xsl:if>
10067
- <xsl:if test="@type = 'inline'">
10234
+ <xsl:call-template name="insert_basic_link">
10235
+ <xsl:with-param name="element">
10236
+ <fo:basic-link fox:alt-text="{@citeas}">
10237
+ <xsl:if test="normalize-space(@citeas) = ''">
10238
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10239
+ </xsl:if>
10240
+ <xsl:if test="@type = 'inline'">
10068
10241
 
10069
- </xsl:if>
10242
+ </xsl:if>
10070
10243
 
10071
- <xsl:choose>
10072
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10073
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10074
- </xsl:when>
10075
- <xsl:otherwise>
10076
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10077
- </xsl:otherwise>
10078
- </xsl:choose>
10244
+ <xsl:choose>
10245
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10246
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10247
+ </xsl:when>
10248
+ <xsl:otherwise>
10249
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10250
+ </xsl:otherwise>
10251
+ </xsl:choose>
10079
10252
 
10080
- <xsl:apply-templates/>
10081
- </fo:basic-link>
10253
+ <xsl:apply-templates/>
10254
+ </fo:basic-link>
10255
+ </xsl:with-param>
10256
+ </xsl:call-template>
10082
10257
 
10083
10258
  </fo:inline>
10084
10259
  </xsl:when>
@@ -10194,13 +10369,8 @@
10194
10369
  </xsl:template>
10195
10370
 
10196
10371
  <xsl:template match="*[local-name() = 'deprecates']">
10197
- <xsl:variable name="title-deprecated">
10198
- <xsl:call-template name="getLocalizedString">
10199
- <xsl:with-param name="key">deprecated</xsl:with-param>
10200
- </xsl:call-template>
10201
- </xsl:variable>
10202
10372
  <fo:block xsl:use-attribute-sets="deprecates-style">
10203
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
10373
+ <xsl:apply-templates/>
10204
10374
  </fo:block>
10205
10375
  </xsl:template>
10206
10376
 
@@ -10323,7 +10493,10 @@
10323
10493
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10324
10494
 
10325
10495
  <xsl:template name="setULLabel">
10326
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10496
+ <xsl:variable name="list_level__">
10497
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10498
+ </xsl:variable>
10499
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10327
10500
  <xsl:variable name="list_level">
10328
10501
  <xsl:choose>
10329
10502
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10456,9 +10629,11 @@
10456
10629
  </fo:block-container>
10457
10630
  </xsl:when>
10458
10631
  <xsl:otherwise>
10459
- <fo:block>
10460
- <xsl:apply-templates select="." mode="list"/>
10461
- </fo:block>
10632
+
10633
+ <fo:block>
10634
+ <xsl:apply-templates select="." mode="list"/>
10635
+ </fo:block>
10636
+
10462
10637
  </xsl:otherwise>
10463
10638
  </xsl:choose>
10464
10639
  </xsl:template>
@@ -11146,24 +11321,32 @@
11146
11321
  <xsl:for-each select="*[local-name() = 'tab']">
11147
11322
  <xsl:variable name="current_id" select="generate-id()"/>
11148
11323
  <fo:table-cell>
11149
- <fo:block>
11150
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11151
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11152
- <xsl:choose>
11153
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11154
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11155
- </xsl:choose>
11156
- </xsl:for-each>
11157
- </fo:basic-link>
11324
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11325
+ <xsl:call-template name="insert_basic_link">
11326
+ <xsl:with-param name="element">
11327
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11328
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11329
+ <xsl:choose>
11330
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11331
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11332
+ </xsl:choose>
11333
+ </xsl:for-each>
11334
+ </fo:basic-link>
11335
+ </xsl:with-param>
11336
+ </xsl:call-template>
11158
11337
  </fo:block>
11159
11338
  </fo:table-cell>
11160
11339
  </xsl:for-each>
11161
11340
  <!-- last column - for page numbers -->
11162
11341
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
11163
11342
  <fo:block>
11164
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11165
- <fo:page-number-citation ref-id="{$target}"/>
11166
- </fo:basic-link>
11343
+ <xsl:call-template name="insert_basic_link">
11344
+ <xsl:with-param name="element">
11345
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11346
+ <fo:page-number-citation ref-id="{$target}"/>
11347
+ </fo:basic-link>
11348
+ </xsl:with-param>
11349
+ </xsl:call-template>
11167
11350
  </fo:block>
11168
11351
  </fo:table-cell>
11169
11352
  </xsl:template>
@@ -11205,6 +11388,27 @@
11205
11388
  <!-- End Table of Contents (ToC) processing -->
11206
11389
  <!-- =================== -->
11207
11390
 
11391
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11392
+ <xsl:template name="insert_basic_link">
11393
+ <xsl:param name="element"/>
11394
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11395
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11396
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11397
+ <xsl:choose>
11398
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11399
+ <xsl:copy-of select="$element_node"/>
11400
+ </xsl:when>
11401
+ <xsl:otherwise>
11402
+ <fo:inline>
11403
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11404
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11405
+ </xsl:for-each>
11406
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11407
+ </fo:inline>
11408
+ </xsl:otherwise>
11409
+ </xsl:choose>
11410
+ </xsl:template>
11411
+
11208
11412
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
11209
11413
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
11210
11414
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -11430,6 +11634,23 @@
11430
11634
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
11431
11635
  <xsl:copy-of select="."/>
11432
11636
  </xsl:template>
11637
+
11638
+ <!-- add @id, redundant for table auto-layout algorithm -->
11639
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11640
+ <xsl:copy>
11641
+ <xsl:copy-of select="@*"/>
11642
+ <xsl:call-template name="add_id"/>
11643
+ <xsl:apply-templates mode="update_xml_step1"/>
11644
+ </xsl:copy>
11645
+ </xsl:template>
11646
+
11647
+ <xsl:template name="add_id">
11648
+ <xsl:if test="not(@id)">
11649
+ <!-- add @id - first element with @id plus '_element_name' -->
11650
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
11651
+ </xsl:if>
11652
+ </xsl:template>
11653
+
11433
11654
  <!-- =========================================================================== -->
11434
11655
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
11435
11656
  <!-- =========================================================================== -->