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.
@@ -1464,11 +1464,17 @@
1464
1464
  <!-- ========================== -->
1465
1465
  <!-- Definition's list styles -->
1466
1466
  <!-- ========================== -->
1467
+
1468
+ <xsl:attribute-set name="dl-block-style">
1469
+
1470
+ </xsl:attribute-set>
1471
+
1467
1472
  <xsl:attribute-set name="dt-row-style">
1468
1473
 
1469
1474
  </xsl:attribute-set>
1470
1475
 
1471
1476
  <xsl:attribute-set name="dt-cell-style">
1477
+
1472
1478
  </xsl:attribute-set>
1473
1479
 
1474
1480
  <xsl:attribute-set name="dt-block-style">
@@ -1486,6 +1492,7 @@
1486
1492
 
1487
1493
  <xsl:attribute-set name="dd-cell-style">
1488
1494
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1495
+
1489
1496
  </xsl:attribute-set>
1490
1497
 
1491
1498
  <!-- ========================== -->
@@ -1501,6 +1508,7 @@
1501
1508
  </xsl:attribute-set>
1502
1509
 
1503
1510
  <xsl:attribute-set name="xref-style">
1511
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1504
1512
 
1505
1513
  </xsl:attribute-set>
1506
1514
 
@@ -1605,6 +1613,10 @@
1605
1613
 
1606
1614
  </xsl:attribute-set>
1607
1615
 
1616
+ <xsl:attribute-set name="figure-source-style">
1617
+
1618
+ </xsl:attribute-set>
1619
+
1608
1620
  <!-- Formula's styles -->
1609
1621
  <xsl:attribute-set name="formula-style">
1610
1622
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2140,7 +2152,7 @@
2140
2152
 
2141
2153
  <xsl:template name="processTables_Contents">
2142
2154
  <tables>
2143
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2155
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2144
2156
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2145
2157
  <xsl:copy-of select="*[local-name() = 'name']"/>
2146
2158
  </table>
@@ -2507,7 +2519,7 @@
2507
2519
  </xsl:attribute>
2508
2520
  </xsl:for-each>
2509
2521
 
2510
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2522
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2511
2523
  <xsl:if test="$isNoteOrFnExist = 'true'">
2512
2524
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2513
2525
  </xsl:if>
@@ -2551,7 +2563,7 @@
2551
2563
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2552
2564
  </xsl:when>
2553
2565
  <xsl:otherwise>
2554
- <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 -->
2566
+ <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 -->
2555
2567
  </xsl:otherwise>
2556
2568
  </xsl:choose>
2557
2569
 
@@ -2652,6 +2664,11 @@
2652
2664
  </xsl:if>
2653
2665
  </xsl:template> <!-- table/name -->
2654
2666
 
2667
+ <!-- SOURCE: ... -->
2668
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2669
+ <xsl:call-template name="termsource"/>
2670
+ </xsl:template>
2671
+
2655
2672
  <xsl:template name="calculate-columns-numbers">
2656
2673
  <xsl:param name="table-row"/>
2657
2674
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3008,7 +3025,7 @@
3008
3025
  </fo:table-header>
3009
3026
  </xsl:template> <!-- thead -->
3010
3027
 
3011
- <!-- template is using for iso, jcgm, bsi only -->
3028
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3012
3029
  <xsl:template name="table-header-title">
3013
3030
  <xsl:param name="cols-count"/>
3014
3031
  <!-- row for title -->
@@ -3051,7 +3068,7 @@
3051
3068
  <xsl:param name="colwidths"/>
3052
3069
  <xsl:param name="colgroup"/>
3053
3070
 
3054
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3071
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3055
3072
 
3056
3073
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3057
3074
 
@@ -3121,6 +3138,7 @@
3121
3138
 
3122
3139
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3123
3140
  <xsl:apply-templates select="../*[local-name()='note']"/>
3141
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3124
3142
 
3125
3143
  <xsl:variable name="isDisplayRowSeparator">
3126
3144
 
@@ -3503,9 +3521,13 @@
3503
3521
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3504
3522
  </xsl:if>
3505
3523
 
3506
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3507
- <xsl:value-of select="$current_fn_number_text"/>
3508
- </fo:basic-link>
3524
+ <xsl:call-template name="insert_basic_link">
3525
+ <xsl:with-param name="element">
3526
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3527
+ <xsl:value-of select="$current_fn_number_text"/>
3528
+ </fo:basic-link>
3529
+ </xsl:with-param>
3530
+ </xsl:call-template>
3509
3531
  </fo:inline>
3510
3532
  </xsl:variable>
3511
3533
 
@@ -3777,7 +3799,7 @@
3777
3799
  <xsl:variable name="isAdded" select="@added"/>
3778
3800
  <xsl:variable name="isDeleted" select="@deleted"/>
3779
3801
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3780
- <fo:block-container>
3802
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3781
3803
 
3782
3804
  <xsl:call-template name="setBlockSpanAll"/>
3783
3805
 
@@ -3785,6 +3807,18 @@
3785
3807
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3786
3808
  </xsl:if>
3787
3809
 
3810
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3811
+ <!-- set font-size as sourcecode font-size -->
3812
+ <xsl:variable name="sourcecode_attributes">
3813
+ <xsl:call-template name="get_sourcecode_attributes"/>
3814
+ </xsl:variable>
3815
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3816
+ <xsl:attribute name="{local-name()}">
3817
+ <xsl:value-of select="."/>
3818
+ </xsl:attribute>
3819
+ </xsl:for-each>
3820
+ </xsl:if>
3821
+
3788
3822
  <xsl:if test="parent::*[local-name() = 'note']">
3789
3823
  <xsl:attribute name="margin-left">
3790
3824
  <xsl:choose>
@@ -3826,8 +3860,10 @@
3826
3860
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3827
3861
  <xsl:text> </xsl:text>
3828
3862
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3829
- <xsl:text/>
3830
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3863
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3864
+ <xsl:text> </xsl:text>
3865
+ </xsl:if>
3866
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3831
3867
  </fo:block>
3832
3868
 
3833
3869
  </xsl:when> <!-- END: only one component -->
@@ -4218,6 +4254,7 @@
4218
4254
  <xsl:param name="split_keep-within-line"/>
4219
4255
 
4220
4256
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4257
+
4221
4258
  <xsl:call-template name="insert_dt_cell">
4222
4259
  <xsl:with-param name="key_iso" select="$key_iso"/>
4223
4260
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4239,6 +4276,7 @@
4239
4276
  <!-- border is mandatory, to calculate real width -->
4240
4277
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4241
4278
  <xsl:attribute name="text-align">left</xsl:attribute>
4279
+
4242
4280
  </xsl:if>
4243
4281
 
4244
4282
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4312,8 +4350,18 @@
4312
4350
  </xsl:if>
4313
4351
  </xsl:template>
4314
4352
 
4315
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4316
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4353
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4354
+ <xsl:variable name="is_inline_element_after_where">
4355
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4356
+ </xsl:variable>
4357
+ <xsl:choose>
4358
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4359
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4360
+ </xsl:when>
4361
+ <xsl:otherwise>
4362
+ <xsl:apply-templates select="."/>
4363
+ </xsl:otherwise>
4364
+ </xsl:choose>
4317
4365
  </xsl:template>
4318
4366
 
4319
4367
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4681,6 +4729,7 @@
4681
4729
  <fo:inline>
4682
4730
  <xsl:for-each select="$styles/style">
4683
4731
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4732
+
4684
4733
  </xsl:for-each>
4685
4734
  <xsl:apply-templates/>
4686
4735
  </fo:inline>
@@ -5740,6 +5789,79 @@
5740
5789
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5741
5790
  </xsl:template>
5742
5791
 
5792
+ <!-- special case for:
5793
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5794
+ <mstyle displaystyle="true">
5795
+ <msup>
5796
+ <mi color="#00000000">C</mi>
5797
+ <mtext>R</mtext>
5798
+ </msup>
5799
+ <msubsup>
5800
+ <mtext>C</mtext>
5801
+ <mi>n</mi>
5802
+ <mi>k</mi>
5803
+ </msubsup>
5804
+ </mstyle>
5805
+ </math>
5806
+ -->
5807
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5808
+ <xsl:copy>
5809
+ <xsl:copy-of select="@*"/>
5810
+ <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"/>
5811
+ <xsl:if test="string-length($next_mtext) != ''">
5812
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5813
+ </xsl:if>
5814
+ <xsl:apply-templates/>
5815
+ <xsl:value-of select="$next_mtext"/>
5816
+ </xsl:copy>
5817
+ </xsl:template>
5818
+
5819
+ <!-- special case for:
5820
+ <msup>
5821
+ <mtext/>
5822
+ <mn>1</mn>
5823
+ </msup>
5824
+ convert to (add mspace after mtext and enclose them into mrow):
5825
+ <msup>
5826
+ <mrow>
5827
+ <mtext/>
5828
+ <mspace height="1.47ex"/>
5829
+ </mrow>
5830
+ <mn>1</mn>
5831
+ </msup>
5832
+ -->
5833
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5834
+ <mathml:mrow>
5835
+ <xsl:copy-of select="."/>
5836
+ <mathml:mspace height="1.47ex"/>
5837
+ </mathml:mrow>
5838
+ </xsl:template>
5839
+
5840
+ <!-- add space around vertical line -->
5841
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5842
+ <xsl:copy>
5843
+ <xsl:apply-templates select="@*" mode="mathml"/>
5844
+ <xsl:if test="not(@lspace)">
5845
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5846
+ </xsl:if>
5847
+ <xsl:if test="not(@rspace)">
5848
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5849
+ </xsl:if>
5850
+ <xsl:apply-templates mode="mathml"/>
5851
+ </xsl:copy>
5852
+ </xsl:template>
5853
+
5854
+ <!-- decrease fontsize for 'Circled Times' char -->
5855
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5856
+ <xsl:copy>
5857
+ <xsl:apply-templates select="@*" mode="mathml"/>
5858
+ <xsl:if test="not(@fontsize)">
5859
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5860
+ </xsl:if>
5861
+ <xsl:apply-templates mode="mathml"/>
5862
+ </xsl:copy>
5863
+ </xsl:template>
5864
+
5743
5865
  <!-- Examples:
5744
5866
  <stem type="AsciiMath">x = 1</stem>
5745
5867
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5797,19 +5919,23 @@
5797
5919
  <xsl:apply-templates/>
5798
5920
  </xsl:when>
5799
5921
  <xsl:otherwise>
5800
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5801
- <xsl:choose>
5802
- <xsl:when test="normalize-space(.) = ''">
5803
- <xsl:call-template name="add-zero-spaces-link-java">
5804
- <xsl:with-param name="text" select="$target_text"/>
5805
- </xsl:call-template>
5806
- </xsl:when>
5807
- <xsl:otherwise>
5808
- <!-- output text from <link>text</link> -->
5809
- <xsl:apply-templates/>
5810
- </xsl:otherwise>
5811
- </xsl:choose>
5812
- </fo:basic-link>
5922
+ <xsl:call-template name="insert_basic_link">
5923
+ <xsl:with-param name="element">
5924
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5925
+ <xsl:choose>
5926
+ <xsl:when test="normalize-space(.) = ''">
5927
+ <xsl:call-template name="add-zero-spaces-link-java">
5928
+ <xsl:with-param name="text" select="$target_text"/>
5929
+ </xsl:call-template>
5930
+ </xsl:when>
5931
+ <xsl:otherwise>
5932
+ <!-- output text from <link>text</link> -->
5933
+ <xsl:apply-templates/>
5934
+ </xsl:otherwise>
5935
+ </xsl:choose>
5936
+ </fo:basic-link>
5937
+ </xsl:with-param>
5938
+ </xsl:call-template>
5813
5939
  </xsl:otherwise>
5814
5940
  </xsl:choose>
5815
5941
  </fo:inline>
@@ -5872,12 +5998,16 @@
5872
5998
  </xsl:template>
5873
5999
 
5874
6000
  <xsl:template match="*[local-name() = 'xref']">
5875
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5876
- <xsl:if test="parent::*[local-name() = 'add']">
5877
- <xsl:call-template name="append_add-style"/>
5878
- </xsl:if>
5879
- <xsl:apply-templates/>
5880
- </fo:basic-link>
6001
+ <xsl:call-template name="insert_basic_link">
6002
+ <xsl:with-param name="element">
6003
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6004
+ <xsl:if test="parent::*[local-name() = 'add']">
6005
+ <xsl:call-template name="append_add-style"/>
6006
+ </xsl:if>
6007
+ <xsl:apply-templates/>
6008
+ </fo:basic-link>
6009
+ </xsl:with-param>
6010
+ </xsl:call-template>
5881
6011
  </xsl:template>
5882
6012
 
5883
6013
  <!-- ====== -->
@@ -6200,6 +6330,13 @@
6200
6330
  </fo:block>
6201
6331
  </xsl:template>
6202
6332
 
6333
+ <!-- SOURCE: ... -->
6334
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6335
+
6336
+ <xsl:call-template name="termsource"/>
6337
+
6338
+ </xsl:template>
6339
+
6203
6340
  <xsl:template match="*[local-name() = 'image']">
6204
6341
  <xsl:variable name="isAdded" select="../@added"/>
6205
6342
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -6278,7 +6415,7 @@
6278
6415
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6279
6416
  </xsl:when>
6280
6417
  <xsl:when test="not(starts-with(@src, 'data:'))">
6281
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6418
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6282
6419
  </xsl:when>
6283
6420
  <xsl:otherwise>
6284
6421
  <xsl:value-of select="@src"/>
@@ -6300,7 +6437,7 @@
6300
6437
  </xsl:when>
6301
6438
  <xsl:when test="not(starts-with(@src, 'data:'))">
6302
6439
  <xsl:variable name="src">
6303
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6440
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6304
6441
  </xsl:variable>
6305
6442
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6306
6443
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6686,15 +6823,19 @@
6686
6823
  <xsl:param name="dest"/>
6687
6824
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6688
6825
  <fo:block font-size="1pt">
6689
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6690
- <fo:inline-container inline-progression-dimension="100%">
6691
- <fo:block-container height="{$height - 1}px" width="100%">
6692
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6693
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6694
- </xsl:if> -->
6695
- <fo:block> </fo:block></fo:block-container>
6696
- </fo:inline-container>
6697
- </fo:basic-link>
6826
+ <xsl:call-template name="insert_basic_link">
6827
+ <xsl:with-param name="element">
6828
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6829
+ <fo:inline-container inline-progression-dimension="100%">
6830
+ <fo:block-container height="{$height - 1}px" width="100%">
6831
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6832
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6833
+ </xsl:if> -->
6834
+ <fo:block> </fo:block></fo:block-container>
6835
+ </fo:inline-container>
6836
+ </fo:basic-link>
6837
+ </xsl:with-param>
6838
+ </xsl:call-template>
6698
6839
  </fo:block>
6699
6840
  </fo:block-container>
6700
6841
  </xsl:template>
@@ -7335,9 +7476,11 @@
7335
7476
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7336
7477
  </xsl:if>
7337
7478
 
7338
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7479
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7339
7480
  </fo:block>
7340
7481
 
7482
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7483
+
7341
7484
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7342
7485
 
7343
7486
  </fo:block-container>
@@ -7369,11 +7512,22 @@
7369
7512
  <!-- add sourcecode highlighting -->
7370
7513
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7371
7514
  <xsl:variable name="class" select="@class"/>
7515
+
7516
+ <!-- Example: <1> -->
7517
+ <xsl:variable name="is_callout">
7518
+ <xsl:if test="parent::*[local-name() = 'dt']">
7519
+ <xsl:variable name="dt_id" select="../@id"/>
7520
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7521
+ </xsl:if>
7522
+ </xsl:variable>
7523
+
7372
7524
  <xsl:choose>
7373
7525
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7374
7526
  <fo:inline>
7375
7527
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7528
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7376
7529
  <xsl:apply-templates/>
7530
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7377
7531
  </fo:inline>
7378
7532
  </xsl:when>
7379
7533
  <xsl:otherwise>
@@ -7797,6 +7951,10 @@
7797
7951
  </fo:block>
7798
7952
  </xsl:template>
7799
7953
 
7954
+ <xsl:template match="*[local-name() = 'div']">
7955
+ <fo:block><xsl:apply-templates/></fo:block>
7956
+ </xsl:template>
7957
+
7800
7958
  <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']">
7801
7959
  <fo:block xsl:use-attribute-sets="inherit-style">
7802
7960
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8226,14 +8384,18 @@
8226
8384
  </xsl:template>
8227
8385
 
8228
8386
  <xsl:template match="*[local-name() = 'origin']">
8229
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8230
- <xsl:if test="normalize-space(@citeas) = ''">
8231
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8232
- </xsl:if>
8233
- <fo:inline xsl:use-attribute-sets="origin-style">
8234
- <xsl:apply-templates/>
8235
- </fo:inline>
8236
- </fo:basic-link>
8387
+ <xsl:call-template name="insert_basic_link">
8388
+ <xsl:with-param name="element">
8389
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8390
+ <xsl:if test="normalize-space(@citeas) = ''">
8391
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8392
+ </xsl:if>
8393
+ <fo:inline xsl:use-attribute-sets="origin-style">
8394
+ <xsl:apply-templates/>
8395
+ </fo:inline>
8396
+ </fo:basic-link>
8397
+ </xsl:with-param>
8398
+ </xsl:call-template>
8237
8399
  </xsl:template>
8238
8400
 
8239
8401
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8307,9 +8469,13 @@
8307
8469
  <xsl:if test="../*[local-name() = 'author']">
8308
8470
  <xsl:text>, </xsl:text>
8309
8471
  </xsl:if>
8310
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8311
- <xsl:apply-templates/>
8312
- </fo:basic-link>
8472
+ <xsl:call-template name="insert_basic_link">
8473
+ <xsl:with-param name="element">
8474
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8475
+ <xsl:apply-templates/>
8476
+ </fo:basic-link>
8477
+ </xsl:with-param>
8478
+ </xsl:call-template>
8313
8479
  </xsl:template>
8314
8480
 
8315
8481
  <xsl:template match="*[local-name() = 'author']">
@@ -8358,25 +8524,29 @@
8358
8524
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8359
8525
  <xsl:variable name="text" select="normalize-space()"/>
8360
8526
 
8361
- <fo:basic-link fox:alt-text="{@citeas}">
8362
- <xsl:if test="normalize-space(@citeas) = ''">
8363
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8364
- </xsl:if>
8365
- <xsl:if test="@type = 'inline'">
8527
+ <xsl:call-template name="insert_basic_link">
8528
+ <xsl:with-param name="element">
8529
+ <fo:basic-link fox:alt-text="{@citeas}">
8530
+ <xsl:if test="normalize-space(@citeas) = ''">
8531
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8532
+ </xsl:if>
8533
+ <xsl:if test="@type = 'inline'">
8366
8534
 
8367
- </xsl:if>
8535
+ </xsl:if>
8368
8536
 
8369
- <xsl:choose>
8370
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8371
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8372
- </xsl:when>
8373
- <xsl:otherwise>
8374
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8375
- </xsl:otherwise>
8376
- </xsl:choose>
8537
+ <xsl:choose>
8538
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8539
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8540
+ </xsl:when>
8541
+ <xsl:otherwise>
8542
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8543
+ </xsl:otherwise>
8544
+ </xsl:choose>
8377
8545
 
8378
- <xsl:apply-templates/>
8379
- </fo:basic-link>
8546
+ <xsl:apply-templates/>
8547
+ </fo:basic-link>
8548
+ </xsl:with-param>
8549
+ </xsl:call-template>
8380
8550
 
8381
8551
  </fo:inline>
8382
8552
  </xsl:when>
@@ -8492,13 +8662,8 @@
8492
8662
  </xsl:template>
8493
8663
 
8494
8664
  <xsl:template match="*[local-name() = 'deprecates']">
8495
- <xsl:variable name="title-deprecated">
8496
- <xsl:call-template name="getLocalizedString">
8497
- <xsl:with-param name="key">deprecated</xsl:with-param>
8498
- </xsl:call-template>
8499
- </xsl:variable>
8500
8665
  <fo:block xsl:use-attribute-sets="deprecates-style">
8501
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8666
+ <xsl:apply-templates/>
8502
8667
  </fo:block>
8503
8668
  </xsl:template>
8504
8669
 
@@ -8628,7 +8793,10 @@
8628
8793
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8629
8794
 
8630
8795
  <xsl:template name="setULLabel">
8631
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8796
+ <xsl:variable name="list_level__">
8797
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8798
+ </xsl:variable>
8799
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8632
8800
  <xsl:variable name="list_level">
8633
8801
  <xsl:choose>
8634
8802
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8761,9 +8929,11 @@
8761
8929
  </fo:block-container>
8762
8930
  </xsl:when>
8763
8931
  <xsl:otherwise>
8764
- <fo:block>
8765
- <xsl:apply-templates select="." mode="list"/>
8766
- </fo:block>
8932
+
8933
+ <fo:block>
8934
+ <xsl:apply-templates select="." mode="list"/>
8935
+ </fo:block>
8936
+
8767
8937
  </xsl:otherwise>
8768
8938
  </xsl:choose>
8769
8939
  </xsl:template>
@@ -9430,24 +9600,32 @@
9430
9600
  <xsl:for-each select="*[local-name() = 'tab']">
9431
9601
  <xsl:variable name="current_id" select="generate-id()"/>
9432
9602
  <fo:table-cell>
9433
- <fo:block>
9434
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9435
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9436
- <xsl:choose>
9437
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9438
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9439
- </xsl:choose>
9440
- </xsl:for-each>
9441
- </fo:basic-link>
9603
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9604
+ <xsl:call-template name="insert_basic_link">
9605
+ <xsl:with-param name="element">
9606
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9607
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9608
+ <xsl:choose>
9609
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9610
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9611
+ </xsl:choose>
9612
+ </xsl:for-each>
9613
+ </fo:basic-link>
9614
+ </xsl:with-param>
9615
+ </xsl:call-template>
9442
9616
  </fo:block>
9443
9617
  </fo:table-cell>
9444
9618
  </xsl:for-each>
9445
9619
  <!-- last column - for page numbers -->
9446
9620
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9447
9621
  <fo:block>
9448
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9449
- <fo:page-number-citation ref-id="{$target}"/>
9450
- </fo:basic-link>
9622
+ <xsl:call-template name="insert_basic_link">
9623
+ <xsl:with-param name="element">
9624
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9625
+ <fo:page-number-citation ref-id="{$target}"/>
9626
+ </fo:basic-link>
9627
+ </xsl:with-param>
9628
+ </xsl:call-template>
9451
9629
  </fo:block>
9452
9630
  </fo:table-cell>
9453
9631
  </xsl:template>
@@ -9489,6 +9667,27 @@
9489
9667
  <!-- End Table of Contents (ToC) processing -->
9490
9668
  <!-- =================== -->
9491
9669
 
9670
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9671
+ <xsl:template name="insert_basic_link">
9672
+ <xsl:param name="element"/>
9673
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9674
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9675
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9676
+ <xsl:choose>
9677
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9678
+ <xsl:copy-of select="$element_node"/>
9679
+ </xsl:when>
9680
+ <xsl:otherwise>
9681
+ <fo:inline>
9682
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9683
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9684
+ </xsl:for-each>
9685
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9686
+ </fo:inline>
9687
+ </xsl:otherwise>
9688
+ </xsl:choose>
9689
+ </xsl:template>
9690
+
9492
9691
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9493
9692
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9494
9693
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9716,6 +9915,23 @@
9716
9915
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9717
9916
  <xsl:copy-of select="."/>
9718
9917
  </xsl:template>
9918
+
9919
+ <!-- add @id, redundant for table auto-layout algorithm -->
9920
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
9921
+ <xsl:copy>
9922
+ <xsl:copy-of select="@*"/>
9923
+ <xsl:call-template name="add_id"/>
9924
+ <xsl:apply-templates mode="update_xml_step1"/>
9925
+ </xsl:copy>
9926
+ </xsl:template>
9927
+
9928
+ <xsl:template name="add_id">
9929
+ <xsl:if test="not(@id)">
9930
+ <!-- add @id - first element with @id plus '_element_name' -->
9931
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
9932
+ </xsl:if>
9933
+ </xsl:template>
9934
+
9719
9935
  <!-- =========================================================================== -->
9720
9936
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9721
9937
  <!-- =========================================================================== -->