metanorma-ribose 2.9.0 → 2.9.1.pre.alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -289,6 +289,7 @@
289
289
 
290
290
  <fo:page-sequence xsl:use-attribute-sets="page-sequence-main">
291
291
  <xsl:call-template name="refine_page-sequence-main"/>
292
+ <xsl:copy-of select="@role"/>
292
293
 
293
294
  <xsl:call-template name="insertFootnoteSeparatorCommon"/>
294
295
 
@@ -598,41 +599,9 @@
598
599
  <xsl:apply-templates select="$contents/mnx:doc[@num = $num]/mnx:contents/mnx:item[@display = 'true']"/>
599
600
  </fo:block>
600
601
 
601
- <!-- List of Tables -->
602
- <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
603
- <xsl:call-template name="insertListOf_Title">
604
- <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-tables"/>
605
- </xsl:call-template>
606
- <fo:block role="TOC">
607
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
608
- <xsl:call-template name="insertListOf_Item"/>
609
- </xsl:for-each>
610
- </fo:block>
611
- </xsl:if>
612
-
613
- <!-- List of Figures -->
614
- <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
615
- <xsl:call-template name="insertListOf_Title">
616
- <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-figures"/>
617
- </xsl:call-template>
618
- <fo:block role="TOC">
619
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
620
- <xsl:call-template name="insertListOf_Item"/>
621
- </xsl:for-each>
622
- </fo:block>
623
- </xsl:if>
624
-
625
- <!-- List of Examples -->
626
- <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
627
- <xsl:call-template name="insertListOf_Title">
628
- <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-examples"/>
629
- </xsl:call-template>
630
- <fo:block role="TOC">
631
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
632
- <xsl:call-template name="insertListOf_Item"/>
633
- </xsl:for-each>
634
- </fo:block>
635
- </xsl:if>
602
+ <xsl:call-template name="insertListsOf">
603
+ <xsl:with-param name="num" select="$num"/>
604
+ </xsl:call-template>
636
605
 
637
606
  </fo:block-container>
638
607
  </fo:block-container>
@@ -668,12 +637,13 @@
668
637
 
669
638
  <fo:inline role="Lbl"><xsl:value-of select="@section"/></fo:inline>
670
639
  <fo:wrapper role="Reference">
671
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{mnx:title}">
640
+ <xsl:variable name="alt_text"><xsl:apply-templates select="mnx:title" mode="bookmarks"/></xsl:variable>
641
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{$alt_text}"> <!-- mnx:title -->
672
642
  <xsl:if test="@section != ''">
673
643
  <xsl:text> </xsl:text>
674
644
  </xsl:if>
675
645
  <xsl:apply-templates select="mnx:title"/>
676
- <xsl:text>  </xsl:text>
646
+ <fo:wrapper role="artifact"><xsl:text>  </xsl:text></fo:wrapper>
677
647
  <fo:inline role="SKIP">
678
648
  <fo:leader xsl:use-attribute-sets="toc-leader-style"><xsl:call-template name="refine_toc-leader-style"/></fo:leader>
679
649
  <fo:inline xsl:use-attribute-sets="toc-pagenumber-style"><fo:page-number-citation ref-id="{@id}" role="SKIP"/></fo:inline> <!-- <fo:wrapper role="artifact"> </fo:wrapper> -->
@@ -689,6 +659,69 @@
689
659
  </fo:block>
690
660
  </xsl:template>
691
661
 
662
+ <xsl:template name="insertListsOf">
663
+ <xsl:param name="num"/>
664
+ <!-- List of Tables -->
665
+ <xsl:call-template name="insertListOfTables">
666
+ <xsl:with-param name="num" select="$num"/>
667
+ </xsl:call-template>
668
+
669
+ <!-- List of Figures -->
670
+ <xsl:call-template name="insertListOfFigures">
671
+ <xsl:with-param name="num" select="$num"/>
672
+ </xsl:call-template>
673
+
674
+ <!-- List of Examples -->
675
+ <xsl:call-template name="insertListOfExamples">
676
+ <xsl:with-param name="num" select="$num"/>
677
+ </xsl:call-template>
678
+ </xsl:template>
679
+
680
+ <xsl:template name="insertListOfTables">
681
+ <xsl:param name="num"/>
682
+ <!-- List of Tables -->
683
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
684
+ <xsl:call-template name="insertListOf_Title">
685
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-tables"/>
686
+ </xsl:call-template>
687
+ <fo:block role="TOC">
688
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
689
+ <xsl:call-template name="insertListOf_Item"/>
690
+ </xsl:for-each>
691
+ </fo:block>
692
+ </xsl:if>
693
+ </xsl:template>
694
+
695
+ <xsl:template name="insertListOfFigures">
696
+ <xsl:param name="num"/>
697
+ <!-- List of Figures -->
698
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
699
+ <xsl:call-template name="insertListOf_Title">
700
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-figures"/>
701
+ </xsl:call-template>
702
+ <fo:block role="TOC">
703
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
704
+ <xsl:call-template name="insertListOf_Item"/>
705
+ </xsl:for-each>
706
+ </fo:block>
707
+ </xsl:if>
708
+ </xsl:template>
709
+
710
+ <xsl:template name="insertListOfExamples">
711
+ <xsl:param name="num"/>
712
+ <!-- List of Examples -->
713
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
714
+ <xsl:call-template name="insertListOf_Title">
715
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-examples"/>
716
+ </xsl:call-template>
717
+ <fo:block role="TOC">
718
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
719
+ <xsl:call-template name="insertListOf_Item"/>
720
+ </xsl:for-each>
721
+ </fo:block>
722
+ </xsl:if>
723
+ </xsl:template>
724
+
692
725
  <xsl:template match="mn:bibdata/mn:ext/mn:security">
693
726
  <fo:block>
694
727
  <xsl:call-template name="capitalize">
@@ -1584,6 +1617,7 @@
1584
1617
  </xsl:variable>
1585
1618
 
1586
1619
  <!-- Characters -->
1620
+ <xsl:variable name="nbsp"> </xsl:variable>
1587
1621
  <xsl:variable name="linebreak">&#8232;</xsl:variable>
1588
1622
  <xsl:variable name="em_space"> </xsl:variable>
1589
1623
  <xsl:variable name="tab_zh"> </xsl:variable>
@@ -2514,7 +2548,11 @@
2514
2548
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
2515
2549
 
2516
2550
  <!-- create a new page_sequence (opening elements) -->
2517
- <xsl:text disable-output-escaping="yes">&lt;page_sequence xmlns="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
2551
+ <xsl:text disable-output-escaping="yes">&lt;page_sequence xmlns="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if>
2552
+ <xsl:text> xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"</xsl:text>
2553
+ <!-- prevent for role="Part_continue" for last pagebreak in preface, sections, annex -->
2554
+ <xsl:if test="(ancestor::mn:preface and following::*[ancestor::mn:preface]) or (ancestor::mn:sections and following::*[ancestor::mn:sections]) or (ancestor::mn:annex and following::*[ancestor::mn:annex])"><xsl:text> role="NonStruct"</xsl:text></xsl:if>
2555
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
2518
2556
 
2519
2557
  <xsl:call-template name="insertOpeningElements">
2520
2558
  <xsl:with-param name="tree" select="$tree"/>
@@ -2574,6 +2612,7 @@
2574
2612
  <xsl:text>"</xsl:text>
2575
2613
  </xsl:for-each>
2576
2614
  <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
2615
+ <xsl:if test="$add_continue = 'true'"> role="NonStruct"</xsl:if><!-- the condition 'xsl:if' to prevent the attribute role for math -->
2577
2616
  <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
2578
2617
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
2579
2618
  <xsl:if test="$debug = 'true'">
@@ -3086,6 +3125,7 @@
3086
3125
  </xsl:template>
3087
3126
 
3088
3127
  <xsl:attribute-set name="license-statement-style">
3128
+ <xsl:attribute name="role">SKIP</xsl:attribute>
3089
3129
  </xsl:attribute-set> <!-- license-statement-style -->
3090
3130
 
3091
3131
  <xsl:template name="refine_license-statement-style">
@@ -3324,10 +3364,10 @@
3324
3364
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3325
3365
  </xsl:if>
3326
3366
 
3327
- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
3367
+ <!-- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
3328
3368
  <xsl:attribute name="color">inherit</xsl:attribute>
3329
3369
  <xsl:attribute name="text-decoration">none</xsl:attribute>
3330
- </xsl:if>
3370
+ </xsl:if> -->
3331
3371
 
3332
3372
  <xsl:call-template name="refine_link-style"/>
3333
3373
 
@@ -3365,11 +3405,17 @@
3365
3405
  </xsl:choose>
3366
3406
  </xsl:otherwise>
3367
3407
  </xsl:choose>
3408
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
3409
+ <!-- paper clip icon rendering moved here from
3410
+ org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java drawPaperclip
3411
+ for https://github.com/metanorma/metanorma-pdfa/issues/71 -->
3412
+ <xsl:call-template name="drawPaperClip"/>
3413
+ </xsl:if>
3368
3414
  </fo:basic-link>
3369
- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
3370
- <!-- reserve space at right for PaperClip icon -->
3371
- <fo:inline keep-with-previous.within-line="always">        </fo:inline>
3372
- </xsl:if>
3415
+ <!-- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
3416
+ <!- - reserve space at right for PaperClip icon - ->
3417
+ <fo:inline keep-with-previous.within-line="always">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</fo:inline>
3418
+ </xsl:if> -->
3373
3419
  </xsl:with-param>
3374
3420
  </xsl:call-template>
3375
3421
  </xsl:otherwise>
@@ -3377,6 +3423,59 @@
3377
3423
  </fo:inline>
3378
3424
  </xsl:template> <!-- link -->
3379
3425
 
3426
+ <xsl:template name="drawPaperClip">
3427
+ <fo:wrapper role="artifact">
3428
+ <fo:inline-container width="6mm" height="1mm" keep-with-previous.within-line="always" id="__internal_layout__attachment_{@target}_{generate-id()}">
3429
+ <!-- underline for paperclip icon -->
3430
+ <fo:block line-height="0.5">        </fo:block>
3431
+ <fo:block line-height="1" margin-top="-4mm" font-size="1pt" text-align="center">
3432
+ <xsl:if test="ancestor::mn:tr">
3433
+ <xsl:attribute name="margin-top">-3mm</xsl:attribute>
3434
+ </xsl:if>
3435
+ <fo:instream-foreign-object content-height="3.8mm" scaling="uniform" fox:alt-text="PaperClip" fox:placement="Inline">
3436
+ <xsl:copy-of select="$paperClipImage"/>
3437
+ </fo:instream-foreign-object>
3438
+ </fo:block>
3439
+ </fo:inline-container>
3440
+ </fo:wrapper>
3441
+ </xsl:template>
3442
+
3443
+ <xsl:variable name="paperClipImage">
3444
+ <!-- <svg width="17" height="17" xmlns="http://www.w3.org/2000/svg">
3445
+ <path style="transform-origin: center; transform: scale(1, -1);"
3446
+ d="M 13.574 9.301
3447
+ L 8.926 13.949
3448
+ C 7.648 15.227 5.625 15.227 4.426 13.949
3449
+ C 3.148 12.676 3.148 10.648 4.426 9.449
3450
+ L 10.426 3.449
3451
+ C 11.176 2.773 12.301 2.773 13.051 3.449
3452
+ C 13.801 4.199 13.801 5.398 13.051 6.074
3453
+ L 7.875 11.25
3454
+ C 7.648 11.477 7.273 11.477 7.051 11.25
3455
+ C 6.824 11.023 6.824 10.648 7.051 10.426
3456
+ L 10.875 6.602
3457
+ C 11.176 6.301 11.176 5.852 10.875 5.551
3458
+ C 10.574 5.25 10.125 5.25 9.824 5.551
3459
+ L 6 9.449
3460
+ C 5.176 10.273 5.176 11.551 6 12.375
3461
+ C 6.824 13.125 8.102 13.125 8.926 12.375
3462
+ L 14.102 7.199
3463
+ C 15.449 5.852 15.449 3.75 14.102 2.398
3464
+ C 12.75 1.051 10.648 1.051 9.301 2.398
3465
+ L 3.301 8.398
3466
+ C 2.398 9.301 1.949 10.5 1.949 11.699
3467
+ C 1.949 14.324 4.051 16.352 6.676 16.352
3468
+ C 7.949 16.352 9.074 15.824 9.977 15
3469
+ L 14.625 10.352
3470
+ C 14.926 10.051 14.926 9.602 14.625 9.301
3471
+ C 14.324 9 13.875 9 13.574 9.301"
3472
+ stroke="none" fill="black" />
3473
+ </svg> -->
3474
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.16 14.96">
3475
+ <path d="m11.63,7.05c.3.3.75.3,1.05,0,.3-.3.3-.75,0-1.05L8.03,1.35c-.9-.82-2.03-1.35-3.3-1.35C2.1,0,0,2.03,0,4.65c0,1.2.45,2.4,1.35,3.3l6,6c1.35,1.35,3.45,1.35,4.8,0,1.35-1.35,1.35-3.45,0-4.8L6.98,3.98c-.82-.75-2.1-.75-2.93,0-.82.82-.82,2.1,0,2.93l3.82,3.9c.3.3.75.3,1.05,0s.3-.75,0-1.05l-3.82-3.82c-.23-.22-.23-.6,0-.82.22-.23.6-.23.82,0l5.18,5.18c.75.68.75,1.88,0,2.62-.75.68-1.88.68-2.62,0L2.48,6.9c-1.28-1.2-1.28-3.23,0-4.5,1.2-1.28,3.22-1.28,4.5,0l4.65,4.65" style="stroke-width: 0px;"/>
3476
+ </svg>
3477
+ </xsl:variable>
3478
+
3380
3479
  <xsl:attribute-set name="sourcecode-container-style">
3381
3480
  <xsl:attribute name="space-after">12pt</xsl:attribute>
3382
3481
  </xsl:attribute-set>
@@ -5151,7 +5250,15 @@
5151
5250
  <xsl:call-template name="refine_term-style"/>
5152
5251
  <xsl:call-template name="addTagElementT"/>
5153
5252
 
5154
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
5253
+ <fo:block role="SKIP">
5254
+
5255
+ <!-- element before fmt-defition -->
5256
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name) and not(self::mn:fmt-definition) and not(preceding-sibling::mn:fmt-definition)]"/>
5257
+ </fo:block>
5258
+
5259
+ <!-- elements after fmt-definition (include fmt-definition) -->
5260
+ <xsl:apply-templates select="node()[self::mn:fmt-definition or preceding-sibling::mn:fmt-definition]"/>
5261
+
5155
5262
  </fo:block>
5156
5263
  </xsl:template>
5157
5264
 
@@ -5894,6 +6001,13 @@
5894
6001
  <xsl:template name="refine_table-fn-body-style">
5895
6002
  </xsl:template>
5896
6003
 
6004
+ <xsl:attribute-set name="table-fn-p-style">
6005
+ <xsl:attribute name="role">P</xsl:attribute>
6006
+ </xsl:attribute-set>
6007
+
6008
+ <xsl:template name="refine_table-fn-p-style">
6009
+ </xsl:template>
6010
+
5897
6011
  <xsl:template name="setNoBordersForTableList">
5898
6012
  <xsl:if test="ancestor::mn:fmt-ol or ancestor::mn:fmt-ul">
5899
6013
  <xsl:attribute name="border">none</xsl:attribute>
@@ -6222,6 +6336,10 @@
6222
6336
  <!-- <Caption><P> tags, see https://github.com/metanorma/metanorma-pdfa/issues/81 -->
6223
6337
  <fo:block role="P">
6224
6338
 
6339
+ <xsl:if test="$continued = 'true'">
6340
+ <xsl:attribute name="role">SKIP</xsl:attribute>
6341
+ </xsl:if>
6342
+
6225
6343
  <xsl:choose>
6226
6344
  <xsl:when test="$continued = 'true'">
6227
6345
  </xsl:when>
@@ -6231,7 +6349,7 @@
6231
6349
  </xsl:choose>
6232
6350
 
6233
6351
  </fo:block>
6234
- </fo:block>
6352
+ </fo:block> <!-- END: Table name -->
6235
6353
 
6236
6354
  <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'pas' or $namespace = 'iec' or $namespace = 'iso'"> -->
6237
6355
  <xsl:if test="$continued = 'true'">
@@ -7166,8 +7284,16 @@
7166
7284
  </fo:block>
7167
7285
  </xsl:template> <!-- table/note -->
7168
7286
 
7169
- <xsl:template match="mn:table/*[self::mn:note or self::mn:example]/mn:p | mn:table/mn:tfoot//*[self::mn:note or self::mn:example]/mn:p" priority="2">
7170
- <fo:inline role="P"><xsl:apply-templates/></fo:inline>
7287
+ <xsl:template match="mn:table/*[self::mn:note or self::mn:example]/mn:p | mn:table/mn:tfoot//*[self::mn:note or self::mn:example][not(ancestor::mn:fn)]/mn:p" priority="2">
7288
+ <xsl:param name="fo_element">inline</xsl:param>
7289
+ <xsl:choose>
7290
+ <xsl:when test="contains($fo_element, 'block')">
7291
+ <fo:block role="P"><xsl:apply-templates/></fo:block>
7292
+ </xsl:when>
7293
+ <xsl:otherwise>
7294
+ <fo:inline role="P"><xsl:apply-templates/></fo:inline>
7295
+ </xsl:otherwise>
7296
+ </xsl:choose>
7171
7297
  </xsl:template>
7172
7298
 
7173
7299
  <!-- ============================ -->
@@ -7206,11 +7332,19 @@
7206
7332
  <xsl:with-param name="process">true</xsl:with-param>
7207
7333
  </xsl:apply-templates>
7208
7334
 
7335
+ <!-- 1st element in fn ('p' usually) -->
7209
7336
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
7210
7337
  <xsl:call-template name="refine_table-fn-body-style"/>
7211
7338
  <!-- <xsl:copy-of select="./node()"/> -->
7212
- <xsl:apply-templates/>
7339
+ <xsl:apply-templates select="node()[normalize-space() != '' or self::*][1]"/>
7213
7340
  </fo:inline>
7341
+ <!-- 2th, 3rd ... -->
7342
+ <xsl:if test="node()[position() &gt; 1][normalize-space() != '' or self::*]">
7343
+ <fo:block xsl:use-attribute-sets="table-fn-body-style">
7344
+ <xsl:call-template name="refine_table-fn-body-style"/>
7345
+ <xsl:apply-templates select="node()[position() &gt; 1]"/>
7346
+ </fo:block>
7347
+ </xsl:if>
7214
7348
 
7215
7349
  </fo:block>
7216
7350
 
@@ -7364,6 +7498,23 @@
7364
7498
  </xsl:choose>
7365
7499
  </xsl:template> <!-- fn -->
7366
7500
 
7501
+ <xsl:template match="mn:table//mn:fn//mn:p | mn:table//mn:fmt-fn-body//mn:p" priority="4">
7502
+ <xsl:choose>
7503
+ <xsl:when test="preceding-sibling::*">
7504
+ <fo:block xsl:use-attribute-sets="table-fn-p-style">
7505
+ <xsl:call-template name="refine_table-fn-p-style"/>
7506
+ <xsl:apply-templates/>
7507
+ </fo:block>
7508
+ </xsl:when>
7509
+ <xsl:otherwise>
7510
+ <fo:inline xsl:use-attribute-sets="table-fn-p-style">
7511
+ <xsl:call-template name="refine_table-fn-p-style"/>
7512
+ <xsl:apply-templates/>
7513
+ </fo:inline>
7514
+ </xsl:otherwise>
7515
+ </xsl:choose>
7516
+ </xsl:template>
7517
+
7367
7518
  <!-- split string 'text' by 'separator' -->
7368
7519
  <xsl:template name="tokenize">
7369
7520
  <xsl:param name="text"/>
@@ -10235,6 +10386,7 @@
10235
10386
  <xsl:template match="mn:figure[not(mn:image) and *[local-name() = 'svg']]/mn:fmt-name/mn:bookmark" priority="2"/>
10236
10387
  <xsl:template match="mn:figure[not(mn:image)]/*[local-name() = 'svg']" priority="2" name="image_svg">
10237
10388
  <xsl:param name="name"/>
10389
+ <xsl:param name="inline_image">false</xsl:param>
10238
10390
 
10239
10391
  <xsl:variable name="svg_content">
10240
10392
  <xsl:apply-templates select="." mode="svg_update"/>
@@ -10346,7 +10498,7 @@
10346
10498
  <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
10347
10499
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
10348
10500
  </xsl:when>
10349
- <xsl:when test="not(ancestor::mn:figure)">
10501
+ <xsl:when test="not(ancestor::mn:figure) or ancestor::mn:fmt-name">
10350
10502
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
10351
10503
  </xsl:when>
10352
10504
  <xsl:otherwise>
@@ -10375,7 +10527,7 @@
10375
10527
  <xsl:attribute name="height">3.5mm</xsl:attribute>
10376
10528
  </xsl:when>
10377
10529
  <xsl:otherwise>
10378
- <xsl:if test="$isGenerateTableIF = 'false'">
10530
+ <xsl:if test="$isGenerateTableIF = 'false' and normalize-space($inline_image) = 'false'">
10379
10531
  <xsl:attribute name="width">100%</xsl:attribute>
10380
10532
  </xsl:if>
10381
10533
  <xsl:attribute name="content-height">100%</xsl:attribute>
@@ -10571,9 +10723,12 @@
10571
10723
  </xsl:template>
10572
10724
 
10573
10725
  <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
10574
- <xsl:template match="*[not(self::mn:figure)]/mn:image[*[local-name() = 'svg']]" priority="3">
10726
+ <!-- Note: count(ancestor::*) = 0 for image in mnx:figures/mnx:figure/fmt-name, when fmt-name is context/root node in template insertListOf_Item -->
10727
+ <xsl:template match="*[not(self::mn:figure)]/mn:image[*[local-name() = 'svg']] | mn:image[count(ancestor::*) = 0][*[local-name() = 'svg']]" priority="3">
10575
10728
  <xsl:for-each select="*[local-name() = 'svg']">
10576
- <xsl:call-template name="image_svg"/>
10729
+ <xsl:call-template name="image_svg">
10730
+ <xsl:with-param name="inline_image" select="not(ancestor::mn:bibdata)"/>
10731
+ </xsl:call-template>
10577
10732
  </xsl:for-each>
10578
10733
  </xsl:template>
10579
10734
 
@@ -11229,6 +11384,10 @@
11229
11384
 
11230
11385
  </fo:inline>
11231
11386
  </xsl:template>
11387
+
11388
+ <!-- remove whitespace from PDF structure tree (https://github.com/metanorma/mn-native-pdf/issues/1071) -->
11389
+ <xsl:template match="mn:fmt-stem/mn:semx/text()[normalize-space() = ''] | mn:fmt-stem/text()[normalize-space() = ''] | text()[preceding-sibling::*[1][self::mn:fmt-stem]][following-sibling::*[1][self::mn:bookmark]][normalize-space() = '']" priority="3"/>
11390
+
11232
11391
  <!-- ======================================= -->
11233
11392
  <!-- END: math -->
11234
11393
  <!-- ======================================= -->
@@ -12105,7 +12264,7 @@
12105
12264
  <xsl:template name="refine_references-non-normative-style">
12106
12265
  </xsl:template>
12107
12266
 
12108
- <!-- ======================= -->
12267
+ <!-- ======================= -->
12109
12268
  <!-- Bibliography rendering -->
12110
12269
  <!-- ======================= -->
12111
12270
 
@@ -12123,7 +12282,7 @@
12123
12282
  <xsl:template match="mn:references[@normative='true']" priority="2">
12124
12283
 
12125
12284
  <xsl:call-template name="setNamedDestination"/>
12126
- <fo:block id="{@id}">
12285
+ <fo:block id="{@id}" role="Sect">
12127
12286
  <xsl:apply-templates/>
12128
12287
  </fo:block>
12129
12288
  </xsl:template>
@@ -12147,6 +12306,9 @@
12147
12306
 
12148
12307
  <fo:block xsl:use-attribute-sets="references-non-normative-style">
12149
12308
  <xsl:call-template name="refine_references-non-normative-style"/>
12309
+ <xsl:copy-of select="@role"/>
12310
+ <xsl:call-template name="addTagElementT"/>
12311
+
12150
12312
  <xsl:apply-templates select="node()[not(self::mn:fmt-title and @columns = 1)]"/>
12151
12313
  </fo:block>
12152
12314
  </xsl:template> <!-- references -->
@@ -13187,17 +13349,26 @@
13187
13349
  <xsl:template name="processTables_Contents">
13188
13350
  <mnx:tables>
13189
13351
  <xsl:for-each select="//mn:table[not(ancestor::mn:metanorma-extension)][@id and mn:fmt-name and normalize-space(@id) != '']">
13352
+ <xsl:variable name="root">
13353
+ <xsl:if test="ancestor-or-self::mn:preface">preface</xsl:if>
13354
+ <xsl:if test="ancestor-or-self::mn:annex">annex</xsl:if>
13355
+ </xsl:variable>
13190
13356
  <xsl:choose>
13191
13357
  <xsl:when test="mn:fmt-name">
13192
13358
  <xsl:variable name="fmt_name">
13193
13359
  <xsl:apply-templates select="mn:fmt-name" mode="update_xml_step1"/>
13194
13360
  </xsl:variable>
13195
- <mnx:table id="{@id}" alt-text="{normalize-space($fmt_name)}">
13361
+ <xsl:variable name="alt_text_">
13362
+ <xsl:apply-templates select="xalan:nodeset($fmt_name)/node()" mode="bookmarks"/>
13363
+ </xsl:variable>
13364
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space($alt_text_), concat($nbsp,$zero_width_space,$hair_space), ' '))"/>
13365
+
13366
+ <mnx:table id="{@id}" alt-text="{$alt_text}" root="{$root}">
13196
13367
  <xsl:copy-of select="$fmt_name"/>
13197
13368
  </mnx:table>
13198
13369
  </xsl:when>
13199
13370
  <xsl:otherwise>
13200
- <mnx:table id="{@id}" alt-text="{mn:name}">
13371
+ <mnx:table id="{@id}" alt-text="{mn:name}" root="{$root}">
13201
13372
  <xsl:copy-of select="mn:name"/>
13202
13373
  </mnx:table>
13203
13374
  </xsl:otherwise>
@@ -13209,17 +13380,26 @@
13209
13380
  <xsl:template name="processFigures_Contents">
13210
13381
  <mnx:figures>
13211
13382
  <xsl:for-each select="//mn:figure[@id and mn:fmt-name and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(mn:name, 'Figure ') and normalize-space(@id) != '']">
13383
+ <xsl:variable name="root">
13384
+ <xsl:if test="ancestor-or-self::mn:preface">preface</xsl:if>
13385
+ <xsl:if test="ancestor-or-self::mn:annex">annex</xsl:if>
13386
+ </xsl:variable>
13212
13387
  <xsl:choose>
13213
13388
  <xsl:when test="mn:fmt-name">
13214
13389
  <xsl:variable name="fmt_name">
13215
13390
  <xsl:apply-templates select="mn:fmt-name" mode="update_xml_step1"/>
13216
13391
  </xsl:variable>
13217
- <mnx:figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
13392
+ <xsl:variable name="alt_text_">
13393
+ <xsl:apply-templates select="xalan:nodeset($fmt_name)/node()" mode="bookmarks"/>
13394
+ </xsl:variable>
13395
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space($alt_text_), concat($nbsp,$zero_width_space,$hair_space), ' '))"/>
13396
+
13397
+ <mnx:figure id="{@id}" alt-text="{$alt_text}" root="{$root}">
13218
13398
  <xsl:copy-of select="$fmt_name"/>
13219
13399
  </mnx:figure>
13220
13400
  </xsl:when>
13221
13401
  <xsl:otherwise>
13222
- <mnx:figure id="{@id}" alt-text="{mn:name}">
13402
+ <mnx:figure id="{@id}" alt-text="{mn:name}" root="{$root}">
13223
13403
  <xsl:copy-of select="mn:name"/>
13224
13404
  </mnx:figure>
13225
13405
  </xsl:otherwise>
@@ -13231,23 +13411,40 @@
13231
13411
  <xsl:template name="processExamples_Contents">
13232
13412
  <mnx:examples>
13233
13413
  <xsl:for-each select="//mn:example[@id and mn:fmt-name and normalize-space(@id) != '']">
13234
- <!-- https://github.com/metanorma/metanorma-pdfa/issues/32#issuecomment-4929133938:
13235
- //example/fmt-xref-label[@container] + //example/fmt-name/span[@class = 'fmt-caption-delim'] + //example/name,
13236
- with the last two elements dropped if //example/name does not exist. -->
13237
- <xsl:variable name="example_name">
13238
- <xsl:apply-templates select="mn:name/node()" mode="update_xml_step1"/>
13239
- </xsl:variable>
13240
- <mnx:example id="{@id}" alt-text="{normalize-space($example_name)}">
13241
- <xsl:element name="fmt-name" namespace="{$namespace_full}">
13242
- <xsl:call-template name="capitalize"><!-- https://github.com/metanorma/metanorma-pdfa/issues/72 -->
13243
- <xsl:with-param name="str" select="mn:fmt-xref-label[@container]"/>
13244
- </xsl:call-template>
13245
- <xsl:if test="normalize-space($example_name) != ''">
13246
- <xsl:value-of select="mn:fmt-name/mn:span[@class = 'fmt-caption-delim']"/>
13247
- <xsl:copy-of select="$example_name"/>
13248
- </xsl:if>
13249
- </xsl:element>
13250
- </mnx:example>
13414
+ <xsl:choose>
13415
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/1116 -->
13416
+ <!-- example's will be processed from fmt-footnote-container -->
13417
+ <xsl:when test="ancestor::mn:fn and ancestor::mn:tr"><!--skip--></xsl:when>
13418
+ <xsl:otherwise>
13419
+ <!-- https://github.com/metanorma/metanorma-pdfa/issues/32#issuecomment-4929133938:
13420
+ //example/fmt-xref-label[@container] + //example/fmt-name/span[@class = 'fmt-caption-delim'] + //example/name,
13421
+ with the last two elements dropped if //example/name does not exist. -->
13422
+ <xsl:variable name="example_name">
13423
+ <!-- <xsl:apply-templates select="mn:name/node()" mode="update_xml_step1"/> -->
13424
+ <xsl:apply-templates select="mn:fmt-name/mn:semx[@element = 'name']/node()" mode="update_xml_step1"/>
13425
+ </xsl:variable>
13426
+ <xsl:variable name="alt_text_">
13427
+ <xsl:apply-templates select="xalan:nodeset($example_name)/node()" mode="bookmarks"/>
13428
+ </xsl:variable>
13429
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space($alt_text_), concat($nbsp,$zero_width_space,$hair_space), ' '))"/>
13430
+ <xsl:variable name="root">
13431
+ <xsl:if test="ancestor-or-self::mn:preface">preface</xsl:if>
13432
+ <xsl:if test="ancestor-or-self::mn:annex">annex</xsl:if>
13433
+ </xsl:variable>
13434
+
13435
+ <mnx:example id="{@id}" alt-text="{$alt_text_}" root="{$root}">
13436
+ <xsl:element name="fmt-name" namespace="{$namespace_full}">
13437
+ <xsl:call-template name="capitalize"><!-- https://github.com/metanorma/metanorma-pdfa/issues/72 -->
13438
+ <xsl:with-param name="str" select="mn:fmt-xref-label[@container]"/>
13439
+ </xsl:call-template>
13440
+ <xsl:if test="normalize-space($example_name) != ''">
13441
+ <xsl:value-of select="mn:fmt-name/mn:span[@class = 'fmt-caption-delim']"/>
13442
+ <xsl:copy-of select="$example_name"/>
13443
+ </xsl:if>
13444
+ </xsl:element>
13445
+ </mnx:example>
13446
+ </xsl:otherwise>
13447
+ </xsl:choose>
13251
13448
  </xsl:for-each>
13252
13449
  </mnx:examples>
13253
13450
  </xsl:template>
@@ -13445,6 +13642,11 @@
13445
13642
  <xsl:apply-templates mode="bookmarks"/>
13446
13643
  </xsl:template>
13447
13644
 
13645
+ <xsl:template match="*[local-name() = 'math']" mode="bookmarks">
13646
+ <xsl:value-of select="normalize-space(.)"/>
13647
+ </xsl:template>
13648
+ <xsl:template match="mn:asciimath" mode="bookmarks"/>
13649
+
13448
13650
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
13449
13651
  <xsl:template match="mn:span" mode="bookmarks">
13450
13652
  <xsl:apply-templates mode="bookmarks"/>
@@ -13463,6 +13665,54 @@
13463
13665
 
13464
13666
  <xsl:template match="mn:requirement | mn:recommendation | mn:permission" mode="bookmarks" priority="3"/>
13465
13667
 
13668
+ <xsl:template match="mn:fmt-link" mode="bookmarks">
13669
+ <!-- apply template from common.link.xsl -->
13670
+ <xsl:variable name="link"><xsl:apply-templates select="."/></xsl:variable>
13671
+ <xsl:value-of select="normalize-space($link)"/>
13672
+ </xsl:template>
13673
+
13674
+ <xsl:template match="mn:image" mode="bookmarks"/>
13675
+
13676
+ <xsl:template match="mn:image[normalize-space(@alt) != '']" mode="bookmarks">
13677
+ <xsl:value-of select="concat('[', normalize-space(@alt), ']')"/>
13678
+ </xsl:template>
13679
+
13680
+ <xsl:template match="mnx:item" mode="bookmarks">
13681
+ <xsl:apply-templates mode="bookmarks"/>
13682
+ </xsl:template>
13683
+
13684
+ <xsl:template match="mnx:item[@id != '']" mode="bookmarks">
13685
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
13686
+ <fo:bookmark-title>
13687
+ <xsl:if test="@section != ''">
13688
+ <xsl:value-of select="@section"/>
13689
+ <xsl:text> </xsl:text>
13690
+ </xsl:if>
13691
+ <xsl:variable name="title">
13692
+ <xsl:if test="1 = 2">
13693
+ <xsl:for-each select="mnx:title/node()">
13694
+ <xsl:choose>
13695
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
13696
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
13697
+ </xsl:choose>
13698
+ </xsl:for-each>
13699
+ </xsl:if>
13700
+ <xsl:apply-templates select="mnx:title/node()" mode="bookmarks"/>
13701
+ </xsl:variable>
13702
+ <xsl:value-of select="normalize-space($title)"/>
13703
+ </fo:bookmark-title>
13704
+ <xsl:apply-templates select="mnx:item" mode="bookmarks"/>
13705
+ </fo:bookmark>
13706
+ </xsl:template>
13707
+
13708
+ <xsl:template match="text()" mode="bookmarks">
13709
+ <xsl:value-of select="."/>
13710
+ </xsl:template>
13711
+
13712
+ <xsl:template match="mnx:item/text()" mode="bookmarks"/>
13713
+
13714
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]" mode="bookmarks"/>
13715
+
13466
13716
  <!-- Bookmarks -->
13467
13717
  <xsl:template name="addBookmarks">
13468
13718
  <xsl:param name="contents"/>
@@ -13516,7 +13766,7 @@
13516
13766
  </xsl:choose>
13517
13767
  </fo:bookmark-title>
13518
13768
 
13519
- <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmark"/>
13769
+ <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmarks"/>
13520
13770
 
13521
13771
  <xsl:call-template name="insertFigureBookmarks">
13522
13772
  <xsl:with-param name="contents" select="mnx:contents"/>
@@ -13542,7 +13792,7 @@
13542
13792
  <xsl:otherwise>
13543
13793
  <xsl:for-each select="$contents_nodes/mnx:doc">
13544
13794
 
13545
- <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmark"/>
13795
+ <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmarks"/>
13546
13796
 
13547
13797
  <xsl:call-template name="insertFigureBookmarks">
13548
13798
  <xsl:with-param name="contents" select="mnx:contents"/>
@@ -13566,7 +13816,7 @@
13566
13816
  </xsl:choose>
13567
13817
  </xsl:when>
13568
13818
  <xsl:otherwise>
13569
- <xsl:apply-templates select="$contents_nodes/mnx:contents/mnx:item" mode="bookmark"/>
13819
+ <xsl:apply-templates select="$contents_nodes/mnx:contents/mnx:item" mode="bookmarks"/>
13570
13820
 
13571
13821
  <xsl:call-template name="insertFigureBookmarks">
13572
13822
  <xsl:with-param name="contents" select="$contents_nodes/mnx:contents"/>
@@ -13620,7 +13870,9 @@
13620
13870
  <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
13621
13871
  <xsl:for-each select="$contents_nodes//mnx:figures/mnx:figure">
13622
13872
  <fo:bookmark internal-destination="{@id}">
13623
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
13873
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
13874
+ <xsl:variable name="title"><xsl:apply-templates mode="bookmarks"/></xsl:variable>
13875
+ <fo:bookmark-title><xsl:value-of select="normalize-space($title)"/></fo:bookmark-title>
13624
13876
  </fo:bookmark>
13625
13877
  </xsl:for-each>
13626
13878
  </fo:bookmark>
@@ -13661,7 +13913,9 @@
13661
13913
  <xsl:for-each select="$contents_nodes//mnx:tables/mnx:table">
13662
13914
  <fo:bookmark internal-destination="{@id}">
13663
13915
  <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
13664
- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
13916
+ <!-- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title> -->
13917
+ <xsl:variable name="title"><xsl:apply-templates mode="bookmarks"/></xsl:variable>
13918
+ <fo:bookmark-title><xsl:value-of select="normalize-space($title)"/></fo:bookmark-title>
13665
13919
  </fo:bookmark>
13666
13920
  </xsl:for-each>
13667
13921
  </fo:bookmark>
@@ -13702,7 +13956,9 @@
13702
13956
  <xsl:for-each select="$contents_nodes//mnx:examples/mnx:example">
13703
13957
  <fo:bookmark internal-destination="{@id}">
13704
13958
  <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
13705
- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
13959
+ <!-- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title> -->
13960
+ <xsl:variable name="title"><xsl:apply-templates mode="bookmarks"/></xsl:variable>
13961
+ <fo:bookmark-title><xsl:value-of select="normalize-space($title)"/></fo:bookmark-title>
13706
13962
  </fo:bookmark>
13707
13963
  </xsl:for-each>
13708
13964
  </fo:bookmark>
@@ -13710,26 +13966,6 @@
13710
13966
  </xsl:template> <!-- insertExampleBookmarks -->
13711
13967
  <!-- End Bookmarks -->
13712
13968
 
13713
- <!-- ============================ -->
13714
- <!-- mode="bookmark_clean" -->
13715
- <!-- ============================ -->
13716
- <xsl:template match="node()" mode="bookmark_clean">
13717
- <xsl:apply-templates select="node()" mode="bookmark_clean"/>
13718
- </xsl:template>
13719
-
13720
- <xsl:template match="text()" mode="bookmark_clean">
13721
- <xsl:value-of select="."/>
13722
- </xsl:template>
13723
-
13724
- <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
13725
- <xsl:value-of select="normalize-space(.)"/>
13726
- </xsl:template>
13727
-
13728
- <xsl:template match="mn:asciimath" mode="bookmark_clean"/>
13729
- <!-- ============================ -->
13730
- <!-- END: mode="bookmark_clean" -->
13731
- <!-- ============================ -->
13732
-
13733
13969
  <xsl:template name="getLangVersion">
13734
13970
  <xsl:param name="lang"/>
13735
13971
  <xsl:param name="doctype" select="''"/>
@@ -13744,37 +13980,6 @@
13744
13980
  </xsl:choose>
13745
13981
  </xsl:template>
13746
13982
 
13747
- <xsl:template match="mnx:item" mode="bookmark">
13748
- <xsl:choose>
13749
- <xsl:when test="@id != ''">
13750
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
13751
- <fo:bookmark-title>
13752
- <xsl:if test="@section != ''">
13753
- <xsl:value-of select="@section"/>
13754
- <xsl:text> </xsl:text>
13755
- </xsl:if>
13756
- <xsl:variable name="title">
13757
- <xsl:for-each select="mnx:title/node()">
13758
- <xsl:choose>
13759
- <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
13760
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
13761
- </xsl:choose>
13762
- </xsl:for-each>
13763
- </xsl:variable>
13764
- <xsl:value-of select="normalize-space($title)"/>
13765
- </fo:bookmark-title>
13766
- <xsl:apply-templates mode="bookmark"/>
13767
- </fo:bookmark>
13768
- </xsl:when>
13769
- <xsl:otherwise>
13770
- <xsl:apply-templates mode="bookmark"/>
13771
- </xsl:otherwise>
13772
- </xsl:choose>
13773
- </xsl:template>
13774
-
13775
- <xsl:template match="mnx:title" mode="bookmark"/>
13776
- <xsl:template match="text()" mode="bookmark"/>
13777
-
13778
13983
  <!-- ====== -->
13779
13984
  <!-- ====== -->
13780
13985
  <xsl:template match="mn:title" mode="contents_item">
@@ -13828,6 +14033,10 @@
13828
14033
  <xsl:text> </xsl:text>
13829
14034
  </xsl:template>
13830
14035
 
14036
+ <xsl:template match="mn:br | mn:tab" mode="bookmarks">
14037
+ <xsl:text> </xsl:text>
14038
+ </xsl:template>
14039
+
13831
14040
  <xsl:template match="mn:strong" mode="contents_item">
13832
14041
  <xsl:param name="element"/>
13833
14042
  <xsl:copy>
@@ -13837,26 +14046,9 @@
13837
14046
  </xsl:copy>
13838
14047
  </xsl:template>
13839
14048
 
13840
- <xsl:template match="mn:em" mode="contents_item">
13841
- <xsl:copy>
13842
- <xsl:apply-templates mode="contents_item"/>
13843
- </xsl:copy>
13844
- </xsl:template>
13845
-
13846
- <xsl:template match="mn:sub" mode="contents_item">
13847
- <xsl:copy>
13848
- <xsl:apply-templates mode="contents_item"/>
13849
- </xsl:copy>
13850
- </xsl:template>
13851
-
13852
- <xsl:template match="mn:sup" mode="contents_item">
13853
- <xsl:copy>
13854
- <xsl:apply-templates mode="contents_item"/>
13855
- </xsl:copy>
13856
- </xsl:template>
13857
-
13858
- <xsl:template match="mn:tt" mode="contents_item">
14049
+ <xsl:template match="mn:em | mn:sub | mn:sup | mn:tt | mn:underline | mn:hi | mn:strike | mn:span[@class] | mn:smallcap" mode="contents_item">
13859
14050
  <xsl:copy>
14051
+ <xsl:copy-of select="@*"/>
13860
14052
  <xsl:apply-templates mode="contents_item"/>
13861
14053
  </xsl:copy>
13862
14054
  </xsl:template>
@@ -13928,6 +14120,24 @@
13928
14120
  </xsl:apply-templates>
13929
14121
  </xsl:template>
13930
14122
 
14123
+ <xsl:template match="mn:fmt-link" mode="contents_item">
14124
+ <!-- apply template from common.link.xsl -->
14125
+ <xsl:variable name="link"><xsl:apply-templates select="."/></xsl:variable>
14126
+ <xsl:value-of select="normalize-space($link)"/>
14127
+ </xsl:template>
14128
+
14129
+ <xsl:template match="mn:image" mode="contents_item">
14130
+ <xsl:copy-of select="."/>
14131
+ </xsl:template>
14132
+
14133
+ <xsl:template match="*[local-name() = 'padding']" mode="contents_item">
14134
+ <xsl:text> </xsl:text>
14135
+ </xsl:template>
14136
+
14137
+ <xsl:template match="*[local-name() = 'padding']" mode="bookmarks">
14138
+ <xsl:text> </xsl:text>
14139
+ </xsl:template>
14140
+
13931
14141
  <!-- =================== -->
13932
14142
  <!-- Table of Contents (ToC) processing -->
13933
14143
  <!-- =================== -->
@@ -14947,6 +15157,7 @@
14947
15157
  <xsl:call-template name="setId"/>
14948
15158
 
14949
15159
  <xsl:call-template name="sections_element_style"/>
15160
+ <xsl:copy-of select="@role"/>
14950
15161
 
14951
15162
  <!-- <xsl:if test="$namespace = 'rsd'"> -->
14952
15163
  <xsl:call-template name="addTagElementT"/>
@@ -14990,6 +15201,7 @@
14990
15201
  <fo:block break-after="page"/>
14991
15202
  <xsl:call-template name="setNamedDestination"/>
14992
15203
  <fo:block role="Sect">
15204
+ <xsl:copy-of select="@role"/>
14993
15205
  <xsl:call-template name="addTagElementT"/>
14994
15206
  <xsl:call-template name="setId"/>
14995
15207
  <xsl:call-template name="addReviewHelper"/>
@@ -15028,6 +15240,7 @@
15028
15240
  <xsl:call-template name="setBlockSpanAll"/>
15029
15241
 
15030
15242
  <xsl:call-template name="refine_clause-style"/>
15243
+ <xsl:copy-of select="@role"/>
15031
15244
 
15032
15245
  <xsl:call-template name="addReviewHelper"/>
15033
15246
 
@@ -15149,24 +15362,16 @@
15149
15362
 
15150
15363
  <xsl:template name="addTagElementT">
15151
15364
  <xsl:variable name="title_">
15152
- <xsl:apply-templates select="mn:fmt-title"/>
15365
+ <xsl:apply-templates select="mn:fmt-title" mode="bookmarks"/>
15153
15366
  <xsl:if test="not(mn:fmt-title) and self::mn:term">
15154
15367
  <name>
15155
- <xsl:apply-templates select="mn:fmt-name"/>
15368
+ <xsl:apply-templates select="mn:fmt-name" mode="bookmarks"/>
15156
15369
  <xsl:text> </xsl:text>
15157
15370
  <xsl:apply-templates select="mn:fmt-preferred/node()[1]"/>
15158
15371
  </name>
15159
15372
  </xsl:if>
15160
15373
  </xsl:variable>
15161
- <xsl:variable name="title__">
15162
- <xsl:for-each select="xalan:nodeset($title_)/*/node()">
15163
- <xsl:choose>
15164
- <xsl:when test="self::text()"><xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:when>
15165
- <xsl:otherwise><xsl:text> </xsl:text><xsl:copy-of select="."/><xsl:text> </xsl:text></xsl:otherwise>
15166
- </xsl:choose>
15167
- </xsl:for-each>
15168
- </xsl:variable>
15169
- <xsl:variable name="title" select="normalize-space(translate($title__, concat($em_space,' &#8232;'), ' '))"/>
15374
+ <xsl:variable name="title" select="normalize-space(translate($title_, concat($em_space,' &#8232;'), ' '))"/>
15170
15375
  <xsl:if test="$title != ''">
15171
15376
  <xsl:attribute name="fox:title">
15172
15377
  <xsl:if test="ancestor::mn:sections">
@@ -15676,6 +15881,27 @@
15676
15881
  <!-- Get or calculate depth of term's name -->
15677
15882
  <xsl:template name="getLevelTermName">
15678
15883
  <xsl:choose>
15884
+ <xsl:when test="self::mn:term">
15885
+ <xsl:choose>
15886
+ <xsl:when test="normalize-space(@depth) != ''">
15887
+ <xsl:value-of select="@depth"/>
15888
+ </xsl:when>
15889
+ <xsl:otherwise>
15890
+ <xsl:variable name="title_level_">
15891
+ <xsl:for-each select="preceding-sibling::mn:fmt-title[1]">
15892
+ <xsl:call-template name="getLevel"/>
15893
+ </xsl:for-each>
15894
+ </xsl:variable>
15895
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
15896
+ <xsl:choose>
15897
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
15898
+ <xsl:otherwise>
15899
+ <xsl:call-template name="getLevel"/>
15900
+ </xsl:otherwise>
15901
+ </xsl:choose>
15902
+ </xsl:otherwise>
15903
+ </xsl:choose>
15904
+ </xsl:when><!-- end: self::mn:term -->
15679
15905
  <xsl:when test="normalize-space(../@depth) != ''">
15680
15906
  <xsl:value-of select="../@depth"/>
15681
15907
  </xsl:when>