metanorma-un 0.10.6 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1398,11 +1398,17 @@
1398
1398
  <!-- ========================== -->
1399
1399
  <!-- Definition's list styles -->
1400
1400
  <!-- ========================== -->
1401
+
1402
+ <xsl:attribute-set name="dl-block-style">
1403
+
1404
+ </xsl:attribute-set>
1405
+
1401
1406
  <xsl:attribute-set name="dt-row-style">
1402
1407
 
1403
1408
  </xsl:attribute-set>
1404
1409
 
1405
1410
  <xsl:attribute-set name="dt-cell-style">
1411
+
1406
1412
  </xsl:attribute-set>
1407
1413
 
1408
1414
  <xsl:attribute-set name="dt-block-style">
@@ -1420,6 +1426,7 @@
1420
1426
 
1421
1427
  <xsl:attribute-set name="dd-cell-style">
1422
1428
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1429
+
1423
1430
  </xsl:attribute-set>
1424
1431
 
1425
1432
  <!-- ========================== -->
@@ -1435,6 +1442,7 @@
1435
1442
  </xsl:attribute-set>
1436
1443
 
1437
1444
  <xsl:attribute-set name="xref-style">
1445
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1438
1446
 
1439
1447
  </xsl:attribute-set>
1440
1448
 
@@ -1536,6 +1544,10 @@
1536
1544
 
1537
1545
  </xsl:attribute-set>
1538
1546
 
1547
+ <xsl:attribute-set name="figure-source-style">
1548
+
1549
+ </xsl:attribute-set>
1550
+
1539
1551
  <!-- Formula's styles -->
1540
1552
  <xsl:attribute-set name="formula-style">
1541
1553
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2070,7 +2082,7 @@
2070
2082
 
2071
2083
  <xsl:template name="processTables_Contents">
2072
2084
  <tables>
2073
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2085
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2074
2086
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2075
2087
  <xsl:copy-of select="*[local-name() = 'name']"/>
2076
2088
  </table>
@@ -2428,7 +2440,7 @@
2428
2440
  </xsl:attribute>
2429
2441
  </xsl:for-each>
2430
2442
 
2431
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2443
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2432
2444
  <xsl:if test="$isNoteOrFnExist = 'true'">
2433
2445
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2434
2446
  </xsl:if>
@@ -2472,7 +2484,7 @@
2472
2484
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2473
2485
  </xsl:when>
2474
2486
  <xsl:otherwise>
2475
- <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 -->
2487
+ <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 -->
2476
2488
  </xsl:otherwise>
2477
2489
  </xsl:choose>
2478
2490
 
@@ -2573,6 +2585,11 @@
2573
2585
  </xsl:if>
2574
2586
  </xsl:template> <!-- table/name -->
2575
2587
 
2588
+ <!-- SOURCE: ... -->
2589
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2590
+ <xsl:call-template name="termsource"/>
2591
+ </xsl:template>
2592
+
2576
2593
  <xsl:template name="calculate-columns-numbers">
2577
2594
  <xsl:param name="table-row"/>
2578
2595
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -2929,7 +2946,7 @@
2929
2946
  </fo:table-header>
2930
2947
  </xsl:template> <!-- thead -->
2931
2948
 
2932
- <!-- template is using for iso, jcgm, bsi only -->
2949
+ <!-- template is using for iec, iso, jcgm, bsi only -->
2933
2950
  <xsl:template name="table-header-title">
2934
2951
  <xsl:param name="cols-count"/>
2935
2952
  <!-- row for title -->
@@ -2972,7 +2989,7 @@
2972
2989
  <xsl:param name="colwidths"/>
2973
2990
  <xsl:param name="colgroup"/>
2974
2991
 
2975
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2992
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
2976
2993
 
2977
2994
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2978
2995
 
@@ -3042,6 +3059,7 @@
3042
3059
 
3043
3060
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3044
3061
  <xsl:apply-templates select="../*[local-name()='note']"/>
3062
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3045
3063
 
3046
3064
  <xsl:variable name="isDisplayRowSeparator">
3047
3065
 
@@ -3408,9 +3426,13 @@
3408
3426
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3409
3427
  </xsl:if>
3410
3428
 
3411
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3412
- <xsl:value-of select="$current_fn_number_text"/>
3413
- </fo:basic-link>
3429
+ <xsl:call-template name="insert_basic_link">
3430
+ <xsl:with-param name="element">
3431
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3432
+ <xsl:value-of select="$current_fn_number_text"/>
3433
+ </fo:basic-link>
3434
+ </xsl:with-param>
3435
+ </xsl:call-template>
3414
3436
  </fo:inline>
3415
3437
  </xsl:variable>
3416
3438
 
@@ -3682,7 +3704,7 @@
3682
3704
  <xsl:variable name="isAdded" select="@added"/>
3683
3705
  <xsl:variable name="isDeleted" select="@deleted"/>
3684
3706
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3685
- <fo:block-container>
3707
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3686
3708
 
3687
3709
  <xsl:call-template name="setBlockSpanAll"/>
3688
3710
 
@@ -3690,6 +3712,18 @@
3690
3712
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3691
3713
  </xsl:if>
3692
3714
 
3715
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3716
+ <!-- set font-size as sourcecode font-size -->
3717
+ <xsl:variable name="sourcecode_attributes">
3718
+ <xsl:call-template name="get_sourcecode_attributes"/>
3719
+ </xsl:variable>
3720
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3721
+ <xsl:attribute name="{local-name()}">
3722
+ <xsl:value-of select="."/>
3723
+ </xsl:attribute>
3724
+ </xsl:for-each>
3725
+ </xsl:if>
3726
+
3693
3727
  <xsl:if test="parent::*[local-name() = 'note']">
3694
3728
  <xsl:attribute name="margin-left">
3695
3729
  <xsl:choose>
@@ -3731,8 +3765,10 @@
3731
3765
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3732
3766
  <xsl:text> </xsl:text>
3733
3767
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3734
- <xsl:text/>
3735
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3768
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3769
+ <xsl:text> </xsl:text>
3770
+ </xsl:if>
3771
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3736
3772
  </fo:block>
3737
3773
 
3738
3774
  </xsl:when> <!-- END: only one component -->
@@ -4123,6 +4159,7 @@
4123
4159
  <xsl:param name="split_keep-within-line"/>
4124
4160
 
4125
4161
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4162
+
4126
4163
  <xsl:call-template name="insert_dt_cell">
4127
4164
  <xsl:with-param name="key_iso" select="$key_iso"/>
4128
4165
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4144,6 +4181,7 @@
4144
4181
  <!-- border is mandatory, to calculate real width -->
4145
4182
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4146
4183
  <xsl:attribute name="text-align">left</xsl:attribute>
4184
+
4147
4185
  </xsl:if>
4148
4186
 
4149
4187
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4217,8 +4255,18 @@
4217
4255
  </xsl:if>
4218
4256
  </xsl:template>
4219
4257
 
4220
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4221
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4258
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4259
+ <xsl:variable name="is_inline_element_after_where">
4260
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4261
+ </xsl:variable>
4262
+ <xsl:choose>
4263
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4264
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4265
+ </xsl:when>
4266
+ <xsl:otherwise>
4267
+ <xsl:apply-templates select="."/>
4268
+ </xsl:otherwise>
4269
+ </xsl:choose>
4222
4270
  </xsl:template>
4223
4271
 
4224
4272
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4586,6 +4634,7 @@
4586
4634
  <fo:inline>
4587
4635
  <xsl:for-each select="$styles/style">
4588
4636
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4637
+
4589
4638
  </xsl:for-each>
4590
4639
  <xsl:apply-templates/>
4591
4640
  </fo:inline>
@@ -5645,6 +5694,79 @@
5645
5694
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5646
5695
  </xsl:template>
5647
5696
 
5697
+ <!-- special case for:
5698
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5699
+ <mstyle displaystyle="true">
5700
+ <msup>
5701
+ <mi color="#00000000">C</mi>
5702
+ <mtext>R</mtext>
5703
+ </msup>
5704
+ <msubsup>
5705
+ <mtext>C</mtext>
5706
+ <mi>n</mi>
5707
+ <mi>k</mi>
5708
+ </msubsup>
5709
+ </mstyle>
5710
+ </math>
5711
+ -->
5712
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5713
+ <xsl:copy>
5714
+ <xsl:copy-of select="@*"/>
5715
+ <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"/>
5716
+ <xsl:if test="string-length($next_mtext) != ''">
5717
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5718
+ </xsl:if>
5719
+ <xsl:apply-templates/>
5720
+ <xsl:value-of select="$next_mtext"/>
5721
+ </xsl:copy>
5722
+ </xsl:template>
5723
+
5724
+ <!-- special case for:
5725
+ <msup>
5726
+ <mtext/>
5727
+ <mn>1</mn>
5728
+ </msup>
5729
+ convert to (add mspace after mtext and enclose them into mrow):
5730
+ <msup>
5731
+ <mrow>
5732
+ <mtext/>
5733
+ <mspace height="1.47ex"/>
5734
+ </mrow>
5735
+ <mn>1</mn>
5736
+ </msup>
5737
+ -->
5738
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5739
+ <mathml:mrow>
5740
+ <xsl:copy-of select="."/>
5741
+ <mathml:mspace height="1.47ex"/>
5742
+ </mathml:mrow>
5743
+ </xsl:template>
5744
+
5745
+ <!-- add space around vertical line -->
5746
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5747
+ <xsl:copy>
5748
+ <xsl:apply-templates select="@*" mode="mathml"/>
5749
+ <xsl:if test="not(@lspace)">
5750
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5751
+ </xsl:if>
5752
+ <xsl:if test="not(@rspace)">
5753
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5754
+ </xsl:if>
5755
+ <xsl:apply-templates mode="mathml"/>
5756
+ </xsl:copy>
5757
+ </xsl:template>
5758
+
5759
+ <!-- decrease fontsize for 'Circled Times' char -->
5760
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5761
+ <xsl:copy>
5762
+ <xsl:apply-templates select="@*" mode="mathml"/>
5763
+ <xsl:if test="not(@fontsize)">
5764
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5765
+ </xsl:if>
5766
+ <xsl:apply-templates mode="mathml"/>
5767
+ </xsl:copy>
5768
+ </xsl:template>
5769
+
5648
5770
  <!-- Examples:
5649
5771
  <stem type="AsciiMath">x = 1</stem>
5650
5772
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5702,19 +5824,23 @@
5702
5824
  <xsl:apply-templates/>
5703
5825
  </xsl:when>
5704
5826
  <xsl:otherwise>
5705
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5706
- <xsl:choose>
5707
- <xsl:when test="normalize-space(.) = ''">
5708
- <xsl:call-template name="add-zero-spaces-link-java">
5709
- <xsl:with-param name="text" select="$target_text"/>
5710
- </xsl:call-template>
5711
- </xsl:when>
5712
- <xsl:otherwise>
5713
- <!-- output text from <link>text</link> -->
5714
- <xsl:apply-templates/>
5715
- </xsl:otherwise>
5716
- </xsl:choose>
5717
- </fo:basic-link>
5827
+ <xsl:call-template name="insert_basic_link">
5828
+ <xsl:with-param name="element">
5829
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5830
+ <xsl:choose>
5831
+ <xsl:when test="normalize-space(.) = ''">
5832
+ <xsl:call-template name="add-zero-spaces-link-java">
5833
+ <xsl:with-param name="text" select="$target_text"/>
5834
+ </xsl:call-template>
5835
+ </xsl:when>
5836
+ <xsl:otherwise>
5837
+ <!-- output text from <link>text</link> -->
5838
+ <xsl:apply-templates/>
5839
+ </xsl:otherwise>
5840
+ </xsl:choose>
5841
+ </fo:basic-link>
5842
+ </xsl:with-param>
5843
+ </xsl:call-template>
5718
5844
  </xsl:otherwise>
5719
5845
  </xsl:choose>
5720
5846
  </fo:inline>
@@ -5777,12 +5903,16 @@
5777
5903
  </xsl:template>
5778
5904
 
5779
5905
  <xsl:template match="*[local-name() = 'xref']">
5780
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5781
- <xsl:if test="parent::*[local-name() = 'add']">
5782
- <xsl:call-template name="append_add-style"/>
5783
- </xsl:if>
5784
- <xsl:apply-templates/>
5785
- </fo:basic-link>
5906
+ <xsl:call-template name="insert_basic_link">
5907
+ <xsl:with-param name="element">
5908
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5909
+ <xsl:if test="parent::*[local-name() = 'add']">
5910
+ <xsl:call-template name="append_add-style"/>
5911
+ </xsl:if>
5912
+ <xsl:apply-templates/>
5913
+ </fo:basic-link>
5914
+ </xsl:with-param>
5915
+ </xsl:call-template>
5786
5916
  </xsl:template>
5787
5917
 
5788
5918
  <!-- ====== -->
@@ -6101,6 +6231,13 @@
6101
6231
  </fo:block>
6102
6232
  </xsl:template>
6103
6233
 
6234
+ <!-- SOURCE: ... -->
6235
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6236
+
6237
+ <xsl:call-template name="termsource"/>
6238
+
6239
+ </xsl:template>
6240
+
6104
6241
  <xsl:template match="*[local-name() = 'image']">
6105
6242
  <xsl:variable name="isAdded" select="../@added"/>
6106
6243
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -6174,7 +6311,7 @@
6174
6311
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6175
6312
  </xsl:when>
6176
6313
  <xsl:when test="not(starts-with(@src, 'data:'))">
6177
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6314
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6178
6315
  </xsl:when>
6179
6316
  <xsl:otherwise>
6180
6317
  <xsl:value-of select="@src"/>
@@ -6196,7 +6333,7 @@
6196
6333
  </xsl:when>
6197
6334
  <xsl:when test="not(starts-with(@src, 'data:'))">
6198
6335
  <xsl:variable name="src">
6199
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6336
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6200
6337
  </xsl:variable>
6201
6338
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6202
6339
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6582,15 +6719,19 @@
6582
6719
  <xsl:param name="dest"/>
6583
6720
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6584
6721
  <fo:block font-size="1pt">
6585
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6586
- <fo:inline-container inline-progression-dimension="100%">
6587
- <fo:block-container height="{$height - 1}px" width="100%">
6588
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6589
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6590
- </xsl:if> -->
6591
- <fo:block> </fo:block></fo:block-container>
6592
- </fo:inline-container>
6593
- </fo:basic-link>
6722
+ <xsl:call-template name="insert_basic_link">
6723
+ <xsl:with-param name="element">
6724
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6725
+ <fo:inline-container inline-progression-dimension="100%">
6726
+ <fo:block-container height="{$height - 1}px" width="100%">
6727
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6728
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6729
+ </xsl:if> -->
6730
+ <fo:block> </fo:block></fo:block-container>
6731
+ </fo:inline-container>
6732
+ </fo:basic-link>
6733
+ </xsl:with-param>
6734
+ </xsl:call-template>
6594
6735
  </fo:block>
6595
6736
  </fo:block-container>
6596
6737
  </xsl:template>
@@ -7231,9 +7372,11 @@
7231
7372
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7232
7373
  </xsl:if>
7233
7374
 
7234
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7375
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7235
7376
  </fo:block>
7236
7377
 
7378
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7379
+
7237
7380
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7238
7381
 
7239
7382
  </fo:block-container>
@@ -7265,11 +7408,22 @@
7265
7408
  <!-- add sourcecode highlighting -->
7266
7409
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7267
7410
  <xsl:variable name="class" select="@class"/>
7411
+
7412
+ <!-- Example: <1> -->
7413
+ <xsl:variable name="is_callout">
7414
+ <xsl:if test="parent::*[local-name() = 'dt']">
7415
+ <xsl:variable name="dt_id" select="../@id"/>
7416
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7417
+ </xsl:if>
7418
+ </xsl:variable>
7419
+
7268
7420
  <xsl:choose>
7269
7421
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7270
7422
  <fo:inline>
7271
7423
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7424
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7272
7425
  <xsl:apply-templates/>
7426
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7273
7427
  </fo:inline>
7274
7428
  </xsl:when>
7275
7429
  <xsl:otherwise>
@@ -7693,6 +7847,10 @@
7693
7847
  </fo:block>
7694
7848
  </xsl:template>
7695
7849
 
7850
+ <xsl:template match="*[local-name() = 'div']">
7851
+ <fo:block><xsl:apply-templates/></fo:block>
7852
+ </xsl:template>
7853
+
7696
7854
  <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']">
7697
7855
  <fo:block xsl:use-attribute-sets="inherit-style">
7698
7856
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8122,14 +8280,18 @@
8122
8280
  </xsl:template>
8123
8281
 
8124
8282
  <xsl:template match="*[local-name() = 'origin']">
8125
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8126
- <xsl:if test="normalize-space(@citeas) = ''">
8127
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8128
- </xsl:if>
8129
- <fo:inline xsl:use-attribute-sets="origin-style">
8130
- <xsl:apply-templates/>
8131
- </fo:inline>
8132
- </fo:basic-link>
8283
+ <xsl:call-template name="insert_basic_link">
8284
+ <xsl:with-param name="element">
8285
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8286
+ <xsl:if test="normalize-space(@citeas) = ''">
8287
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8288
+ </xsl:if>
8289
+ <fo:inline xsl:use-attribute-sets="origin-style">
8290
+ <xsl:apply-templates/>
8291
+ </fo:inline>
8292
+ </fo:basic-link>
8293
+ </xsl:with-param>
8294
+ </xsl:call-template>
8133
8295
  </xsl:template>
8134
8296
 
8135
8297
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8203,9 +8365,13 @@
8203
8365
  <xsl:if test="../*[local-name() = 'author']">
8204
8366
  <xsl:text>, </xsl:text>
8205
8367
  </xsl:if>
8206
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8207
- <xsl:apply-templates/>
8208
- </fo:basic-link>
8368
+ <xsl:call-template name="insert_basic_link">
8369
+ <xsl:with-param name="element">
8370
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8371
+ <xsl:apply-templates/>
8372
+ </fo:basic-link>
8373
+ </xsl:with-param>
8374
+ </xsl:call-template>
8209
8375
  </xsl:template>
8210
8376
 
8211
8377
  <xsl:template match="*[local-name() = 'author']">
@@ -8254,27 +8420,31 @@
8254
8420
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8255
8421
  <xsl:variable name="text" select="normalize-space()"/>
8256
8422
 
8257
- <fo:basic-link fox:alt-text="{@citeas}">
8258
- <xsl:if test="normalize-space(@citeas) = ''">
8259
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8260
- </xsl:if>
8261
- <xsl:if test="@type = 'inline'">
8423
+ <xsl:call-template name="insert_basic_link">
8424
+ <xsl:with-param name="element">
8425
+ <fo:basic-link fox:alt-text="{@citeas}">
8426
+ <xsl:if test="normalize-space(@citeas) = ''">
8427
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8428
+ </xsl:if>
8429
+ <xsl:if test="@type = 'inline'">
8262
8430
 
8263
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8431
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8264
8432
 
8265
- </xsl:if>
8433
+ </xsl:if>
8266
8434
 
8267
- <xsl:choose>
8268
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8269
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8270
- </xsl:when>
8271
- <xsl:otherwise>
8272
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8273
- </xsl:otherwise>
8274
- </xsl:choose>
8435
+ <xsl:choose>
8436
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8437
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8438
+ </xsl:when>
8439
+ <xsl:otherwise>
8440
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8441
+ </xsl:otherwise>
8442
+ </xsl:choose>
8275
8443
 
8276
- <xsl:apply-templates/>
8277
- </fo:basic-link>
8444
+ <xsl:apply-templates/>
8445
+ </fo:basic-link>
8446
+ </xsl:with-param>
8447
+ </xsl:call-template>
8278
8448
 
8279
8449
  </fo:inline>
8280
8450
  </xsl:when>
@@ -8390,13 +8560,8 @@
8390
8560
  </xsl:template>
8391
8561
 
8392
8562
  <xsl:template match="*[local-name() = 'deprecates']">
8393
- <xsl:variable name="title-deprecated">
8394
- <xsl:call-template name="getLocalizedString">
8395
- <xsl:with-param name="key">deprecated</xsl:with-param>
8396
- </xsl:call-template>
8397
- </xsl:variable>
8398
8563
  <fo:block xsl:use-attribute-sets="deprecates-style">
8399
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8564
+ <xsl:apply-templates/>
8400
8565
  </fo:block>
8401
8566
  </xsl:template>
8402
8567
 
@@ -8524,7 +8689,10 @@
8524
8689
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8525
8690
 
8526
8691
  <xsl:template name="setULLabel">
8527
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8692
+ <xsl:variable name="list_level__">
8693
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8694
+ </xsl:variable>
8695
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8528
8696
  <xsl:variable name="list_level">
8529
8697
  <xsl:choose>
8530
8698
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8657,9 +8825,11 @@
8657
8825
  </fo:block-container>
8658
8826
  </xsl:when>
8659
8827
  <xsl:otherwise>
8660
- <fo:block>
8661
- <xsl:apply-templates select="." mode="list"/>
8662
- </fo:block>
8828
+
8829
+ <fo:block>
8830
+ <xsl:apply-templates select="." mode="list"/>
8831
+ </fo:block>
8832
+
8663
8833
  </xsl:otherwise>
8664
8834
  </xsl:choose>
8665
8835
  </xsl:template>
@@ -9326,24 +9496,32 @@
9326
9496
  <xsl:for-each select="*[local-name() = 'tab']">
9327
9497
  <xsl:variable name="current_id" select="generate-id()"/>
9328
9498
  <fo:table-cell>
9329
- <fo:block>
9330
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9331
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9332
- <xsl:choose>
9333
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9334
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9335
- </xsl:choose>
9336
- </xsl:for-each>
9337
- </fo:basic-link>
9499
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9500
+ <xsl:call-template name="insert_basic_link">
9501
+ <xsl:with-param name="element">
9502
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9503
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9504
+ <xsl:choose>
9505
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9506
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9507
+ </xsl:choose>
9508
+ </xsl:for-each>
9509
+ </fo:basic-link>
9510
+ </xsl:with-param>
9511
+ </xsl:call-template>
9338
9512
  </fo:block>
9339
9513
  </fo:table-cell>
9340
9514
  </xsl:for-each>
9341
9515
  <!-- last column - for page numbers -->
9342
9516
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9343
9517
  <fo:block>
9344
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9345
- <fo:page-number-citation ref-id="{$target}"/>
9346
- </fo:basic-link>
9518
+ <xsl:call-template name="insert_basic_link">
9519
+ <xsl:with-param name="element">
9520
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9521
+ <fo:page-number-citation ref-id="{$target}"/>
9522
+ </fo:basic-link>
9523
+ </xsl:with-param>
9524
+ </xsl:call-template>
9347
9525
  </fo:block>
9348
9526
  </fo:table-cell>
9349
9527
  </xsl:template>
@@ -9385,6 +9563,27 @@
9385
9563
  <!-- End Table of Contents (ToC) processing -->
9386
9564
  <!-- =================== -->
9387
9565
 
9566
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9567
+ <xsl:template name="insert_basic_link">
9568
+ <xsl:param name="element"/>
9569
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9570
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9571
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9572
+ <xsl:choose>
9573
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9574
+ <xsl:copy-of select="$element_node"/>
9575
+ </xsl:when>
9576
+ <xsl:otherwise>
9577
+ <fo:inline>
9578
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9579
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9580
+ </xsl:for-each>
9581
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9582
+ </fo:inline>
9583
+ </xsl:otherwise>
9584
+ </xsl:choose>
9585
+ </xsl:template>
9586
+
9388
9587
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9389
9588
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9390
9589
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9611,6 +9810,23 @@
9611
9810
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9612
9811
  <xsl:copy-of select="."/>
9613
9812
  </xsl:template>
9813
+
9814
+ <!-- add @id, redundant for table auto-layout algorithm -->
9815
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9816
+ <xsl:copy>
9817
+ <xsl:copy-of select="@*"/>
9818
+ <xsl:call-template name="add_id"/>
9819
+ <xsl:apply-templates mode="update_xml_step1"/>
9820
+ </xsl:copy>
9821
+ </xsl:template>
9822
+
9823
+ <xsl:template name="add_id">
9824
+ <xsl:if test="not(@id)">
9825
+ <!-- add @id - first element with @id plus '_element_name' -->
9826
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9827
+ </xsl:if>
9828
+ </xsl:template>
9829
+
9614
9830
  <!-- =========================================================================== -->
9615
9831
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9616
9832
  <!-- =========================================================================== -->