metanorma-ieee 1.0.8 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -4389,11 +4389,17 @@
4389
4389
  <!-- ========================== -->
4390
4390
  <!-- Definition's list styles -->
4391
4391
  <!-- ========================== -->
4392
+
4393
+ <xsl:attribute-set name="dl-block-style">
4394
+
4395
+ </xsl:attribute-set>
4396
+
4392
4397
  <xsl:attribute-set name="dt-row-style">
4393
4398
 
4394
4399
  </xsl:attribute-set>
4395
4400
 
4396
4401
  <xsl:attribute-set name="dt-cell-style">
4402
+
4397
4403
  </xsl:attribute-set>
4398
4404
 
4399
4405
  <xsl:attribute-set name="dt-block-style">
@@ -4415,6 +4421,7 @@
4415
4421
 
4416
4422
  <xsl:attribute-set name="dd-cell-style">
4417
4423
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
4424
+
4418
4425
  </xsl:attribute-set>
4419
4426
 
4420
4427
  <!-- ========================== -->
@@ -4430,6 +4437,7 @@
4430
4437
  </xsl:attribute-set>
4431
4438
 
4432
4439
  <xsl:attribute-set name="xref-style">
4440
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4433
4441
 
4434
4442
  <xsl:attribute name="color">blue</xsl:attribute>
4435
4443
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -4541,6 +4549,10 @@
4541
4549
 
4542
4550
  </xsl:attribute-set>
4543
4551
 
4552
+ <xsl:attribute-set name="figure-source-style">
4553
+
4554
+ </xsl:attribute-set>
4555
+
4544
4556
  <!-- Formula's styles -->
4545
4557
  <xsl:attribute-set name="formula-style">
4546
4558
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -5074,7 +5086,7 @@
5074
5086
 
5075
5087
  <xsl:template name="processTables_Contents">
5076
5088
  <tables>
5077
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
5089
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
5078
5090
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
5079
5091
  <xsl:copy-of select="*[local-name() = 'name']"/>
5080
5092
  </table>
@@ -5439,7 +5451,7 @@
5439
5451
  </xsl:attribute>
5440
5452
  </xsl:for-each>
5441
5453
 
5442
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
5454
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5443
5455
  <xsl:if test="$isNoteOrFnExist = 'true'">
5444
5456
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5445
5457
  </xsl:if>
@@ -5483,7 +5495,7 @@
5483
5495
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5484
5496
  </xsl:when>
5485
5497
  <xsl:otherwise>
5486
- <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 -->
5498
+ <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 -->
5487
5499
  </xsl:otherwise>
5488
5500
  </xsl:choose>
5489
5501
 
@@ -5564,6 +5576,11 @@
5564
5576
  </xsl:if>
5565
5577
  </xsl:template> <!-- table/name -->
5566
5578
 
5579
+ <!-- SOURCE: ... -->
5580
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
5581
+ <xsl:call-template name="termsource"/>
5582
+ </xsl:template>
5583
+
5567
5584
  <xsl:template name="calculate-columns-numbers">
5568
5585
  <xsl:param name="table-row"/>
5569
5586
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -5924,7 +5941,7 @@
5924
5941
  </fo:table-header>
5925
5942
  </xsl:template> <!-- thead -->
5926
5943
 
5927
- <!-- template is using for iso, jcgm, bsi only -->
5944
+ <!-- template is using for iec, iso, jcgm, bsi only -->
5928
5945
  <xsl:template name="table-header-title">
5929
5946
  <xsl:param name="cols-count"/>
5930
5947
  <!-- row for title -->
@@ -5974,7 +5991,7 @@
5974
5991
  <xsl:param name="colwidths"/>
5975
5992
  <xsl:param name="colgroup"/>
5976
5993
 
5977
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
5994
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
5978
5995
 
5979
5996
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
5980
5997
 
@@ -6044,6 +6061,7 @@
6044
6061
 
6045
6062
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6046
6063
  <xsl:apply-templates select="../*[local-name()='note']"/>
6064
+ <xsl:apply-templates select="../*[local-name()='source']"/>
6047
6065
 
6048
6066
  <xsl:variable name="isDisplayRowSeparator">
6049
6067
 
@@ -6462,9 +6480,13 @@
6462
6480
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6463
6481
  </xsl:if>
6464
6482
 
6465
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6466
- <xsl:value-of select="$current_fn_number_text"/>
6467
- </fo:basic-link>
6483
+ <xsl:call-template name="insert_basic_link">
6484
+ <xsl:with-param name="element">
6485
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6486
+ <xsl:value-of select="$current_fn_number_text"/>
6487
+ </fo:basic-link>
6488
+ </xsl:with-param>
6489
+ </xsl:call-template>
6468
6490
  </fo:inline>
6469
6491
  </xsl:variable>
6470
6492
 
@@ -6745,7 +6767,7 @@
6745
6767
  <xsl:variable name="isAdded" select="@added"/>
6746
6768
  <xsl:variable name="isDeleted" select="@deleted"/>
6747
6769
  <!-- <dl><xsl:copy-of select="."/></dl> -->
6748
- <fo:block-container>
6770
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
6749
6771
 
6750
6772
  <xsl:call-template name="setBlockSpanAll"/>
6751
6773
 
@@ -6753,6 +6775,18 @@
6753
6775
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
6754
6776
  </xsl:if>
6755
6777
 
6778
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
6779
+ <!-- set font-size as sourcecode font-size -->
6780
+ <xsl:variable name="sourcecode_attributes">
6781
+ <xsl:call-template name="get_sourcecode_attributes"/>
6782
+ </xsl:variable>
6783
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
6784
+ <xsl:attribute name="{local-name()}">
6785
+ <xsl:value-of select="."/>
6786
+ </xsl:attribute>
6787
+ </xsl:for-each>
6788
+ </xsl:if>
6789
+
6756
6790
  <xsl:if test="parent::*[local-name() = 'note']">
6757
6791
  <xsl:attribute name="margin-left">
6758
6792
  <xsl:choose>
@@ -6794,8 +6828,10 @@
6794
6828
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6795
6829
  <xsl:text> </xsl:text>
6796
6830
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6797
- <xsl:text/>
6798
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
6831
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
6832
+ <xsl:text> </xsl:text>
6833
+ </xsl:if>
6834
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
6799
6835
  </fo:block>
6800
6836
 
6801
6837
  </xsl:when> <!-- END: only one component -->
@@ -7186,6 +7222,7 @@
7186
7222
  <xsl:param name="split_keep-within-line"/>
7187
7223
 
7188
7224
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
7225
+
7189
7226
  <xsl:call-template name="insert_dt_cell">
7190
7227
  <xsl:with-param name="key_iso" select="$key_iso"/>
7191
7228
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -7207,6 +7244,7 @@
7207
7244
  <!-- border is mandatory, to calculate real width -->
7208
7245
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
7209
7246
  <xsl:attribute name="text-align">left</xsl:attribute>
7247
+
7210
7248
  </xsl:if>
7211
7249
 
7212
7250
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -7280,8 +7318,18 @@
7280
7318
  </xsl:if>
7281
7319
  </xsl:template>
7282
7320
 
7283
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
7284
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7321
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
7322
+ <xsl:variable name="is_inline_element_after_where">
7323
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
7324
+ </xsl:variable>
7325
+ <xsl:choose>
7326
+ <xsl:when test="$is_inline_element_after_where = 'true'">
7327
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7328
+ </xsl:when>
7329
+ <xsl:otherwise>
7330
+ <xsl:apply-templates select="."/>
7331
+ </xsl:otherwise>
7332
+ </xsl:choose>
7285
7333
  </xsl:template>
7286
7334
 
7287
7335
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -7649,6 +7697,7 @@
7649
7697
  <fo:inline>
7650
7698
  <xsl:for-each select="$styles/style">
7651
7699
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
7700
+
7652
7701
  </xsl:for-each>
7653
7702
  <xsl:apply-templates/>
7654
7703
  </fo:inline>
@@ -8710,6 +8759,79 @@
8710
8759
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8711
8760
  </xsl:template>
8712
8761
 
8762
+ <!-- special case for:
8763
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
8764
+ <mstyle displaystyle="true">
8765
+ <msup>
8766
+ <mi color="#00000000">C</mi>
8767
+ <mtext>R</mtext>
8768
+ </msup>
8769
+ <msubsup>
8770
+ <mtext>C</mtext>
8771
+ <mi>n</mi>
8772
+ <mi>k</mi>
8773
+ </msubsup>
8774
+ </mstyle>
8775
+ </math>
8776
+ -->
8777
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
8778
+ <xsl:copy>
8779
+ <xsl:copy-of select="@*"/>
8780
+ <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"/>
8781
+ <xsl:if test="string-length($next_mtext) != ''">
8782
+ <xsl:attribute name="color">#00000000</xsl:attribute>
8783
+ </xsl:if>
8784
+ <xsl:apply-templates/>
8785
+ <xsl:value-of select="$next_mtext"/>
8786
+ </xsl:copy>
8787
+ </xsl:template>
8788
+
8789
+ <!-- special case for:
8790
+ <msup>
8791
+ <mtext/>
8792
+ <mn>1</mn>
8793
+ </msup>
8794
+ convert to (add mspace after mtext and enclose them into mrow):
8795
+ <msup>
8796
+ <mrow>
8797
+ <mtext/>
8798
+ <mspace height="1.47ex"/>
8799
+ </mrow>
8800
+ <mn>1</mn>
8801
+ </msup>
8802
+ -->
8803
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
8804
+ <mathml:mrow>
8805
+ <xsl:copy-of select="."/>
8806
+ <mathml:mspace height="1.47ex"/>
8807
+ </mathml:mrow>
8808
+ </xsl:template>
8809
+
8810
+ <!-- add space around vertical line -->
8811
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
8812
+ <xsl:copy>
8813
+ <xsl:apply-templates select="@*" mode="mathml"/>
8814
+ <xsl:if test="not(@lspace)">
8815
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
8816
+ </xsl:if>
8817
+ <xsl:if test="not(@rspace)">
8818
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
8819
+ </xsl:if>
8820
+ <xsl:apply-templates mode="mathml"/>
8821
+ </xsl:copy>
8822
+ </xsl:template>
8823
+
8824
+ <!-- decrease fontsize for 'Circled Times' char -->
8825
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
8826
+ <xsl:copy>
8827
+ <xsl:apply-templates select="@*" mode="mathml"/>
8828
+ <xsl:if test="not(@fontsize)">
8829
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
8830
+ </xsl:if>
8831
+ <xsl:apply-templates mode="mathml"/>
8832
+ </xsl:copy>
8833
+ </xsl:template>
8834
+
8713
8835
  <!-- Examples:
8714
8836
  <stem type="AsciiMath">x = 1</stem>
8715
8837
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8779,19 +8901,23 @@
8779
8901
  <xsl:apply-templates/>
8780
8902
  </xsl:when>
8781
8903
  <xsl:otherwise>
8782
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8783
- <xsl:choose>
8784
- <xsl:when test="normalize-space(.) = ''">
8785
- <xsl:call-template name="add-zero-spaces-link-java">
8786
- <xsl:with-param name="text" select="$target_text"/>
8787
- </xsl:call-template>
8788
- </xsl:when>
8789
- <xsl:otherwise>
8790
- <!-- output text from <link>text</link> -->
8791
- <xsl:apply-templates/>
8792
- </xsl:otherwise>
8793
- </xsl:choose>
8794
- </fo:basic-link>
8904
+ <xsl:call-template name="insert_basic_link">
8905
+ <xsl:with-param name="element">
8906
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8907
+ <xsl:choose>
8908
+ <xsl:when test="normalize-space(.) = ''">
8909
+ <xsl:call-template name="add-zero-spaces-link-java">
8910
+ <xsl:with-param name="text" select="$target_text"/>
8911
+ </xsl:call-template>
8912
+ </xsl:when>
8913
+ <xsl:otherwise>
8914
+ <!-- output text from <link>text</link> -->
8915
+ <xsl:apply-templates/>
8916
+ </xsl:otherwise>
8917
+ </xsl:choose>
8918
+ </fo:basic-link>
8919
+ </xsl:with-param>
8920
+ </xsl:call-template>
8795
8921
  </xsl:otherwise>
8796
8922
  </xsl:choose>
8797
8923
  </fo:inline>
@@ -8854,12 +8980,16 @@
8854
8980
  </xsl:template>
8855
8981
 
8856
8982
  <xsl:template match="*[local-name() = 'xref']">
8857
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8858
- <xsl:if test="parent::*[local-name() = 'add']">
8859
- <xsl:call-template name="append_add-style"/>
8860
- </xsl:if>
8861
- <xsl:apply-templates/>
8862
- </fo:basic-link>
8983
+ <xsl:call-template name="insert_basic_link">
8984
+ <xsl:with-param name="element">
8985
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8986
+ <xsl:if test="parent::*[local-name() = 'add']">
8987
+ <xsl:call-template name="append_add-style"/>
8988
+ </xsl:if>
8989
+ <xsl:apply-templates/>
8990
+ </fo:basic-link>
8991
+ </xsl:with-param>
8992
+ </xsl:call-template>
8863
8993
  </xsl:template>
8864
8994
 
8865
8995
  <!-- ====== -->
@@ -9166,6 +9296,13 @@
9166
9296
  </fo:block>
9167
9297
  </xsl:template>
9168
9298
 
9299
+ <!-- SOURCE: ... -->
9300
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
9301
+
9302
+ <xsl:call-template name="termsource"/>
9303
+
9304
+ </xsl:template>
9305
+
9169
9306
  <xsl:template match="*[local-name() = 'image']">
9170
9307
  <xsl:variable name="isAdded" select="../@added"/>
9171
9308
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -9239,7 +9376,7 @@
9239
9376
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
9240
9377
  </xsl:when>
9241
9378
  <xsl:when test="not(starts-with(@src, 'data:'))">
9242
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9379
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9243
9380
  </xsl:when>
9244
9381
  <xsl:otherwise>
9245
9382
  <xsl:value-of select="@src"/>
@@ -9261,7 +9398,7 @@
9261
9398
  </xsl:when>
9262
9399
  <xsl:when test="not(starts-with(@src, 'data:'))">
9263
9400
  <xsl:variable name="src">
9264
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9401
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9265
9402
  </xsl:variable>
9266
9403
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9267
9404
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -9647,15 +9784,19 @@
9647
9784
  <xsl:param name="dest"/>
9648
9785
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
9649
9786
  <fo:block font-size="1pt">
9650
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9651
- <fo:inline-container inline-progression-dimension="100%">
9652
- <fo:block-container height="{$height - 1}px" width="100%">
9653
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
9654
- <xsl:attribute name="background-color">magenta</xsl:attribute>
9655
- </xsl:if> -->
9656
- <fo:block> </fo:block></fo:block-container>
9657
- </fo:inline-container>
9658
- </fo:basic-link>
9787
+ <xsl:call-template name="insert_basic_link">
9788
+ <xsl:with-param name="element">
9789
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9790
+ <fo:inline-container inline-progression-dimension="100%">
9791
+ <fo:block-container height="{$height - 1}px" width="100%">
9792
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
9793
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
9794
+ </xsl:if> -->
9795
+ <fo:block> </fo:block></fo:block-container>
9796
+ </fo:inline-container>
9797
+ </fo:basic-link>
9798
+ </xsl:with-param>
9799
+ </xsl:call-template>
9659
9800
  </fo:block>
9660
9801
  </fo:block-container>
9661
9802
  </xsl:template>
@@ -10300,9 +10441,11 @@
10300
10441
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10301
10442
  </xsl:if>
10302
10443
 
10303
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10444
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
10304
10445
  </fo:block>
10305
10446
 
10447
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
10448
+
10306
10449
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
10307
10450
 
10308
10451
  </fo:block-container>
@@ -10334,11 +10477,22 @@
10334
10477
  <!-- add sourcecode highlighting -->
10335
10478
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
10336
10479
  <xsl:variable name="class" select="@class"/>
10480
+
10481
+ <!-- Example: <1> -->
10482
+ <xsl:variable name="is_callout">
10483
+ <xsl:if test="parent::*[local-name() = 'dt']">
10484
+ <xsl:variable name="dt_id" select="../@id"/>
10485
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
10486
+ </xsl:if>
10487
+ </xsl:variable>
10488
+
10337
10489
  <xsl:choose>
10338
10490
  <xsl:when test="$sourcecode_css//class[@name = $class]">
10339
10491
  <fo:inline>
10340
10492
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
10493
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
10341
10494
  <xsl:apply-templates/>
10495
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
10342
10496
  </fo:inline>
10343
10497
  </xsl:when>
10344
10498
  <xsl:otherwise>
@@ -10762,6 +10916,10 @@
10762
10916
  </fo:block>
10763
10917
  </xsl:template>
10764
10918
 
10919
+ <xsl:template match="*[local-name() = 'div']">
10920
+ <fo:block><xsl:apply-templates/></fo:block>
10921
+ </xsl:template>
10922
+
10765
10923
  <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']">
10766
10924
  <fo:block xsl:use-attribute-sets="inherit-style">
10767
10925
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -11195,14 +11353,18 @@
11195
11353
  </xsl:template>
11196
11354
 
11197
11355
  <xsl:template match="*[local-name() = 'origin']">
11198
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11199
- <xsl:if test="normalize-space(@citeas) = ''">
11200
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11201
- </xsl:if>
11202
- <fo:inline xsl:use-attribute-sets="origin-style">
11203
- <xsl:apply-templates/>
11204
- </fo:inline>
11205
- </fo:basic-link>
11356
+ <xsl:call-template name="insert_basic_link">
11357
+ <xsl:with-param name="element">
11358
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11359
+ <xsl:if test="normalize-space(@citeas) = ''">
11360
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11361
+ </xsl:if>
11362
+ <fo:inline xsl:use-attribute-sets="origin-style">
11363
+ <xsl:apply-templates/>
11364
+ </fo:inline>
11365
+ </fo:basic-link>
11366
+ </xsl:with-param>
11367
+ </xsl:call-template>
11206
11368
  </xsl:template>
11207
11369
 
11208
11370
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -11276,9 +11438,13 @@
11276
11438
  <xsl:if test="../*[local-name() = 'author']">
11277
11439
  <xsl:text>, </xsl:text>
11278
11440
  </xsl:if>
11279
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11280
- <xsl:apply-templates/>
11281
- </fo:basic-link>
11441
+ <xsl:call-template name="insert_basic_link">
11442
+ <xsl:with-param name="element">
11443
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11444
+ <xsl:apply-templates/>
11445
+ </fo:basic-link>
11446
+ </xsl:with-param>
11447
+ </xsl:call-template>
11282
11448
  </xsl:template>
11283
11449
 
11284
11450
  <xsl:template match="*[local-name() = 'author']">
@@ -11332,25 +11498,29 @@
11332
11498
  <xsl:attribute name="text-decoration">none</xsl:attribute>
11333
11499
  </xsl:if>
11334
11500
 
11335
- <fo:basic-link fox:alt-text="{@citeas}">
11336
- <xsl:if test="normalize-space(@citeas) = ''">
11337
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11338
- </xsl:if>
11339
- <xsl:if test="@type = 'inline'">
11501
+ <xsl:call-template name="insert_basic_link">
11502
+ <xsl:with-param name="element">
11503
+ <fo:basic-link fox:alt-text="{@citeas}">
11504
+ <xsl:if test="normalize-space(@citeas) = ''">
11505
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11506
+ </xsl:if>
11507
+ <xsl:if test="@type = 'inline'">
11340
11508
 
11341
- </xsl:if>
11509
+ </xsl:if>
11342
11510
 
11343
- <xsl:choose>
11344
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11345
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11346
- </xsl:when>
11347
- <xsl:otherwise>
11348
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11349
- </xsl:otherwise>
11350
- </xsl:choose>
11511
+ <xsl:choose>
11512
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11513
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11514
+ </xsl:when>
11515
+ <xsl:otherwise>
11516
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11517
+ </xsl:otherwise>
11518
+ </xsl:choose>
11351
11519
 
11352
- <xsl:apply-templates/>
11353
- </fo:basic-link>
11520
+ <xsl:apply-templates/>
11521
+ </fo:basic-link>
11522
+ </xsl:with-param>
11523
+ </xsl:call-template>
11354
11524
 
11355
11525
  </fo:inline>
11356
11526
  </xsl:when>
@@ -11464,13 +11634,8 @@
11464
11634
  </xsl:template>
11465
11635
 
11466
11636
  <xsl:template match="*[local-name() = 'deprecates']">
11467
- <xsl:variable name="title-deprecated">
11468
- <xsl:call-template name="getLocalizedString">
11469
- <xsl:with-param name="key">deprecated</xsl:with-param>
11470
- </xsl:call-template>
11471
- </xsl:variable>
11472
11637
  <fo:block xsl:use-attribute-sets="deprecates-style">
11473
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
11638
+ <xsl:apply-templates/>
11474
11639
  </fo:block>
11475
11640
  </xsl:template>
11476
11641
 
@@ -11598,7 +11763,10 @@
11598
11763
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
11599
11764
 
11600
11765
  <xsl:template name="setULLabel">
11601
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
11766
+ <xsl:variable name="list_level__">
11767
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
11768
+ </xsl:variable>
11769
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
11602
11770
  <xsl:variable name="list_level">
11603
11771
  <xsl:choose>
11604
11772
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -11731,9 +11899,11 @@
11731
11899
  </fo:block-container>
11732
11900
  </xsl:when>
11733
11901
  <xsl:otherwise>
11734
- <fo:block>
11735
- <xsl:apply-templates select="." mode="list"/>
11736
- </fo:block>
11902
+
11903
+ <fo:block>
11904
+ <xsl:apply-templates select="." mode="list"/>
11905
+ </fo:block>
11906
+
11737
11907
  </xsl:otherwise>
11738
11908
  </xsl:choose>
11739
11909
  </xsl:template>
@@ -12433,24 +12603,32 @@
12433
12603
  <xsl:for-each select="*[local-name() = 'tab']">
12434
12604
  <xsl:variable name="current_id" select="generate-id()"/>
12435
12605
  <fo:table-cell>
12436
- <fo:block>
12437
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12438
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12439
- <xsl:choose>
12440
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12441
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12442
- </xsl:choose>
12443
- </xsl:for-each>
12444
- </fo:basic-link>
12606
+ <fo:block line-height-shift-adjustment="disregard-shifts">
12607
+ <xsl:call-template name="insert_basic_link">
12608
+ <xsl:with-param name="element">
12609
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12610
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12611
+ <xsl:choose>
12612
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12613
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12614
+ </xsl:choose>
12615
+ </xsl:for-each>
12616
+ </fo:basic-link>
12617
+ </xsl:with-param>
12618
+ </xsl:call-template>
12445
12619
  </fo:block>
12446
12620
  </fo:table-cell>
12447
12621
  </xsl:for-each>
12448
12622
  <!-- last column - for page numbers -->
12449
12623
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
12450
12624
  <fo:block>
12451
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12452
- <fo:page-number-citation ref-id="{$target}"/>
12453
- </fo:basic-link>
12625
+ <xsl:call-template name="insert_basic_link">
12626
+ <xsl:with-param name="element">
12627
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12628
+ <fo:page-number-citation ref-id="{$target}"/>
12629
+ </fo:basic-link>
12630
+ </xsl:with-param>
12631
+ </xsl:call-template>
12454
12632
  </fo:block>
12455
12633
  </fo:table-cell>
12456
12634
  </xsl:template>
@@ -12492,6 +12670,27 @@
12492
12670
  <!-- End Table of Contents (ToC) processing -->
12493
12671
  <!-- =================== -->
12494
12672
 
12673
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
12674
+ <xsl:template name="insert_basic_link">
12675
+ <xsl:param name="element"/>
12676
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
12677
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
12678
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
12679
+ <xsl:choose>
12680
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
12681
+ <xsl:copy-of select="$element_node"/>
12682
+ </xsl:when>
12683
+ <xsl:otherwise>
12684
+ <fo:inline>
12685
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
12686
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
12687
+ </xsl:for-each>
12688
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
12689
+ </fo:inline>
12690
+ </xsl:otherwise>
12691
+ </xsl:choose>
12692
+ </xsl:template>
12693
+
12495
12694
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
12496
12695
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
12497
12696
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -12747,6 +12946,23 @@
12747
12946
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
12748
12947
  <xsl:copy-of select="."/>
12749
12948
  </xsl:template>
12949
+
12950
+ <!-- add @id, redundant for table auto-layout algorithm -->
12951
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12952
+ <xsl:copy>
12953
+ <xsl:copy-of select="@*"/>
12954
+ <xsl:call-template name="add_id"/>
12955
+ <xsl:apply-templates mode="update_xml_step1"/>
12956
+ </xsl:copy>
12957
+ </xsl:template>
12958
+
12959
+ <xsl:template name="add_id">
12960
+ <xsl:if test="not(@id)">
12961
+ <!-- add @id - first element with @id plus '_element_name' -->
12962
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12963
+ </xsl:if>
12964
+ </xsl:template>
12965
+
12750
12966
  <!-- =========================================================================== -->
12751
12967
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12752
12968
  <!-- =========================================================================== -->