metanorma-cc 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.
@@ -478,79 +478,12 @@
478
478
 
479
479
  <xsl:if test="count(*) = 1 and mn:fmt-title"> <!-- if there isn't user ToC -->
480
480
 
481
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:item[@display = 'true']">
481
+ <xsl:apply-templates select="$contents/mnx:doc[@num = $num]/mnx:contents/mnx:item[@display = 'true']"/>
482
482
 
483
- <fo:block xsl:use-attribute-sets="toc-item-style">
484
-
485
- <xsl:call-template name="refine_toc-item-style"/>
486
-
487
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section} {mnx:title}"> <!-- link at this level needs for PDF structure tags -->
488
- <fo:list-block role="SKIP">
489
- <xsl:attribute name="provisional-distance-between-starts">
490
- <xsl:choose>
491
- <!-- skip 0 section without subsections -->
492
- <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') -->
493
- <xsl:otherwise>0mm</xsl:otherwise>
494
- </xsl:choose>
495
- </xsl:attribute>
496
- <fo:list-item role="SKIP">
497
- <fo:list-item-label end-indent="label-end()" role="SKIP">
498
- <fo:block role="SKIP" id="__internal_layout__toc_label_{@id}">
499
- <xsl:value-of select="@section"/>
500
- </fo:block>
501
- </fo:list-item-label>
502
- <fo:list-item-body start-indent="body-start()" role="SKIP">
503
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm" role="SKIP">
504
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{mnx:title}" role="SKIP">
505
- <xsl:apply-templates select="mnx:title"/>
506
- <fo:inline keep-together.within-line="always" role="SKIP">
507
- <fo:leader xsl:use-attribute-sets="toc-leader-style"><xsl:call-template name="refine_toc-leader-style"/></fo:leader>
508
- <fo:inline role="SKIP"><fo:wrapper role="artifact"><fo:page-number-citation ref-id="{@id}"/></fo:wrapper></fo:inline>
509
- </fo:inline>
510
- </fo:basic-link>
511
- </fo:block>
512
- </fo:list-item-body>
513
- </fo:list-item>
514
- </fo:list-block>
515
- </fo:basic-link>
516
- </fo:block>
517
- </xsl:for-each>
518
-
519
- <!-- List of Tables -->
520
- <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
521
- <xsl:call-template name="insertListOf_Title">
522
- <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-tables"/>
523
- </xsl:call-template>
524
- <fo:block role="TOC">
525
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
526
- <xsl:call-template name="insertListOf_Item"/>
527
- </xsl:for-each>
528
- </fo:block>
529
- </xsl:if>
530
-
531
- <!-- List of Figures -->
532
- <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
533
- <xsl:call-template name="insertListOf_Title">
534
- <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-figures"/>
535
- </xsl:call-template>
536
- <fo:block role="TOC">
537
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
538
- <xsl:call-template name="insertListOf_Item"/>
539
- </xsl:for-each>
540
- </fo:block>
541
- </xsl:if>
483
+ <xsl:call-template name="insertListsOf">
484
+ <xsl:with-param name="num" select="$num"/>
485
+ </xsl:call-template>
542
486
 
543
- <!-- List of Examples -->
544
- <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
545
- <xsl:call-template name="insertListOf_Title">
546
- <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-examples"/>
547
- </xsl:call-template>
548
- <fo:block role="TOC">
549
- <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
550
- <xsl:call-template name="insertListOf_Item"/>
551
- </xsl:for-each>
552
- </fo:block>
553
- </xsl:if>
554
487
  </xsl:if>
555
488
  </fo:block>
556
489
  </fo:block-container>
@@ -563,6 +496,113 @@
563
496
  </fo:block>
564
497
  </xsl:template>
565
498
 
499
+ <xsl:template match="mnx:contents//mnx:item[@display = 'true']">
500
+ <fo:block xsl:use-attribute-sets="toc-item-style">
501
+
502
+ <xsl:call-template name="refine_toc-item-style"/>
503
+
504
+ <!-- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section} {mnx:title}"> --> <!-- link at this level needs for PDF structure tags -->
505
+ <fo:list-block role="SKIP">
506
+ <xsl:attribute name="provisional-distance-between-starts">
507
+ <xsl:choose>
508
+ <!-- skip 0 section without subsections -->
509
+ <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') -->
510
+ <xsl:otherwise>0mm</xsl:otherwise>
511
+ </xsl:choose>
512
+ </xsl:attribute>
513
+ <fo:list-item role="SKIP">
514
+ <fo:list-item-label end-indent="label-end()">
515
+ <fo:block role="SKIP" id="__internal_layout__toc_label_{@id}">
516
+ <xsl:value-of select="@section"/>
517
+ </fo:block>
518
+ </fo:list-item-label>
519
+ <fo:list-item-body start-indent="body-start()" role="SKIP">
520
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm" role="Reference">
521
+ <xsl:variable name="alt_text"><xsl:apply-templates select="mnx:title" mode="bookmarks"/></xsl:variable>
522
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{$alt_text}">
523
+ <xsl:apply-templates select="mnx:title"/>
524
+ <fo:inline keep-together.within-line="always" role="SKIP">
525
+ <fo:leader xsl:use-attribute-sets="toc-leader-style"><xsl:call-template name="refine_toc-leader-style"/></fo:leader>
526
+ <fo:inline role="SKIP"><fo:page-number-citation ref-id="{@id}" role="SKIP"/></fo:inline>
527
+ </fo:inline>
528
+ </fo:basic-link>
529
+ </fo:block>
530
+ </fo:list-item-body>
531
+ </fo:list-item>
532
+ </fo:list-block>
533
+ <!-- </fo:basic-link> -->
534
+
535
+ <xsl:if test="mnx:item[@display = 'true']">
536
+ <fo:block role="TOC">
537
+ <xsl:apply-templates select="mnx:item[@display = 'true']"/>
538
+ </fo:block>
539
+ </xsl:if>
540
+ </fo:block>
541
+ </xsl:template>
542
+
543
+ <xsl:template name="insertListsOf">
544
+ <xsl:param name="num"/>
545
+ <!-- List of Tables -->
546
+ <xsl:call-template name="insertListOfTables">
547
+ <xsl:with-param name="num" select="$num"/>
548
+ </xsl:call-template>
549
+
550
+ <!-- List of Figures -->
551
+ <xsl:call-template name="insertListOfFigures">
552
+ <xsl:with-param name="num" select="$num"/>
553
+ </xsl:call-template>
554
+
555
+ <!-- List of Examples -->
556
+ <xsl:call-template name="insertListOfExamples">
557
+ <xsl:with-param name="num" select="$num"/>
558
+ </xsl:call-template>
559
+ </xsl:template>
560
+
561
+ <xsl:template name="insertListOfTables">
562
+ <xsl:param name="num"/>
563
+ <!-- List of Tables -->
564
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
565
+ <xsl:call-template name="insertListOf_Title">
566
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-tables"/>
567
+ </xsl:call-template>
568
+ <fo:block role="TOC">
569
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
570
+ <xsl:call-template name="insertListOf_Item"/>
571
+ </xsl:for-each>
572
+ </fo:block>
573
+ </xsl:if>
574
+ </xsl:template>
575
+
576
+ <xsl:template name="insertListOfFigures">
577
+ <xsl:param name="num"/>
578
+ <!-- List of Figures -->
579
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
580
+ <xsl:call-template name="insertListOf_Title">
581
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-figures"/>
582
+ </xsl:call-template>
583
+ <fo:block role="TOC">
584
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
585
+ <xsl:call-template name="insertListOf_Item"/>
586
+ </xsl:for-each>
587
+ </fo:block>
588
+ </xsl:if>
589
+ </xsl:template>
590
+
591
+ <xsl:template name="insertListOfExamples">
592
+ <xsl:param name="num"/>
593
+ <!-- List of Examples -->
594
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
595
+ <xsl:call-template name="insertListOf_Title">
596
+ <xsl:with-param name="title" select="$toc_title_lists/mnx:doc[@num = $num]/mnx:title-list-examples"/>
597
+ </xsl:call-template>
598
+ <fo:block role="TOC">
599
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:examples/mnx:example">
600
+ <xsl:call-template name="insertListOf_Item"/>
601
+ </xsl:for-each>
602
+ </fo:block>
603
+ </xsl:if>
604
+ </xsl:template>
605
+
566
606
  <xsl:template match="node()">
567
607
  <xsl:apply-templates/>
568
608
  </xsl:template>
@@ -990,6 +1030,7 @@
990
1030
  </xsl:variable>
991
1031
 
992
1032
  <!-- Characters -->
1033
+ <xsl:variable name="nbsp"> </xsl:variable>
993
1034
  <xsl:variable name="linebreak">&#8232;</xsl:variable>
994
1035
  <xsl:variable name="em_space"> </xsl:variable>
995
1036
  <xsl:variable name="tab_zh"> </xsl:variable>
@@ -1923,7 +1964,11 @@
1923
1964
  <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
1924
1965
 
1925
1966
  <!-- create a new page_sequence (opening elements) -->
1926
- <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>
1967
+ <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>
1968
+ <xsl:text> xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"</xsl:text>
1969
+ <!-- prevent for role="Part_continue" for last pagebreak in preface, sections, annex -->
1970
+ <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>
1971
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
1927
1972
 
1928
1973
  <xsl:call-template name="insertOpeningElements">
1929
1974
  <xsl:with-param name="tree" select="$tree"/>
@@ -1983,6 +2028,7 @@
1983
2028
  <xsl:text>"</xsl:text>
1984
2029
  </xsl:for-each>
1985
2030
  <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
2031
+ <xsl:if test="$add_continue = 'true'"> role="NonStruct"</xsl:if><!-- the condition 'xsl:if' to prevent the attribute role for math -->
1986
2032
  <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
1987
2033
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
1988
2034
  <xsl:if test="$debug = 'true'">
@@ -2495,6 +2541,7 @@
2495
2541
  </xsl:template>
2496
2542
 
2497
2543
  <xsl:attribute-set name="license-statement-style">
2544
+ <xsl:attribute name="role">SKIP</xsl:attribute>
2498
2545
  </xsl:attribute-set> <!-- license-statement-style -->
2499
2546
 
2500
2547
  <xsl:template name="refine_license-statement-style">
@@ -2716,10 +2763,10 @@
2716
2763
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
2717
2764
  </xsl:if>
2718
2765
 
2719
- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
2766
+ <!-- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
2720
2767
  <xsl:attribute name="color">inherit</xsl:attribute>
2721
2768
  <xsl:attribute name="text-decoration">none</xsl:attribute>
2722
- </xsl:if>
2769
+ </xsl:if> -->
2723
2770
 
2724
2771
  <xsl:call-template name="refine_link-style"/>
2725
2772
 
@@ -2757,11 +2804,17 @@
2757
2804
  </xsl:choose>
2758
2805
  </xsl:otherwise>
2759
2806
  </xsl:choose>
2807
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
2808
+ <!-- paper clip icon rendering moved here from
2809
+ org/apache/pdfbox/pdmodel/interactive/annotation/handlers/PDFileAttachmentAppearanceHandler.java drawPaperclip
2810
+ for https://github.com/metanorma/metanorma-pdfa/issues/71 -->
2811
+ <xsl:call-template name="drawPaperClip"/>
2812
+ </xsl:if>
2760
2813
  </fo:basic-link>
2761
- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
2762
- <!-- reserve space at right for PaperClip icon -->
2763
- <fo:inline keep-with-previous.within-line="always">        </fo:inline>
2764
- </xsl:if>
2814
+ <!-- <xsl:if test="$isLinkToEmbeddedFile = 'true'">
2815
+ <!- - reserve space at right for PaperClip icon - ->
2816
+ <fo:inline keep-with-previous.within-line="always">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</fo:inline>
2817
+ </xsl:if> -->
2765
2818
  </xsl:with-param>
2766
2819
  </xsl:call-template>
2767
2820
  </xsl:otherwise>
@@ -2769,6 +2822,59 @@
2769
2822
  </fo:inline>
2770
2823
  </xsl:template> <!-- link -->
2771
2824
 
2825
+ <xsl:template name="drawPaperClip">
2826
+ <fo:wrapper role="artifact">
2827
+ <fo:inline-container width="6mm" height="1mm" keep-with-previous.within-line="always" id="__internal_layout__attachment_{@target}_{generate-id()}">
2828
+ <!-- underline for paperclip icon -->
2829
+ <fo:block line-height="0.5">        </fo:block>
2830
+ <fo:block line-height="1" margin-top="-4mm" font-size="1pt" text-align="center">
2831
+ <xsl:if test="ancestor::mn:tr">
2832
+ <xsl:attribute name="margin-top">-3mm</xsl:attribute>
2833
+ </xsl:if>
2834
+ <fo:instream-foreign-object content-height="3.8mm" scaling="uniform" fox:alt-text="PaperClip" fox:placement="Inline">
2835
+ <xsl:copy-of select="$paperClipImage"/>
2836
+ </fo:instream-foreign-object>
2837
+ </fo:block>
2838
+ </fo:inline-container>
2839
+ </fo:wrapper>
2840
+ </xsl:template>
2841
+
2842
+ <xsl:variable name="paperClipImage">
2843
+ <!-- <svg width="17" height="17" xmlns="http://www.w3.org/2000/svg">
2844
+ <path style="transform-origin: center; transform: scale(1, -1);"
2845
+ d="M 13.574 9.301
2846
+ L 8.926 13.949
2847
+ C 7.648 15.227 5.625 15.227 4.426 13.949
2848
+ C 3.148 12.676 3.148 10.648 4.426 9.449
2849
+ L 10.426 3.449
2850
+ C 11.176 2.773 12.301 2.773 13.051 3.449
2851
+ C 13.801 4.199 13.801 5.398 13.051 6.074
2852
+ L 7.875 11.25
2853
+ C 7.648 11.477 7.273 11.477 7.051 11.25
2854
+ C 6.824 11.023 6.824 10.648 7.051 10.426
2855
+ L 10.875 6.602
2856
+ C 11.176 6.301 11.176 5.852 10.875 5.551
2857
+ C 10.574 5.25 10.125 5.25 9.824 5.551
2858
+ L 6 9.449
2859
+ C 5.176 10.273 5.176 11.551 6 12.375
2860
+ C 6.824 13.125 8.102 13.125 8.926 12.375
2861
+ L 14.102 7.199
2862
+ C 15.449 5.852 15.449 3.75 14.102 2.398
2863
+ C 12.75 1.051 10.648 1.051 9.301 2.398
2864
+ L 3.301 8.398
2865
+ C 2.398 9.301 1.949 10.5 1.949 11.699
2866
+ C 1.949 14.324 4.051 16.352 6.676 16.352
2867
+ C 7.949 16.352 9.074 15.824 9.977 15
2868
+ L 14.625 10.352
2869
+ C 14.926 10.051 14.926 9.602 14.625 9.301
2870
+ C 14.324 9 13.875 9 13.574 9.301"
2871
+ stroke="none" fill="black" />
2872
+ </svg> -->
2873
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.16 14.96">
2874
+ <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;"/>
2875
+ </svg>
2876
+ </xsl:variable>
2877
+
2772
2878
  <xsl:attribute-set name="sourcecode-container-style">
2773
2879
  </xsl:attribute-set>
2774
2880
 
@@ -4475,7 +4581,15 @@
4475
4581
  <xsl:call-template name="refine_term-style"/>
4476
4582
  <xsl:call-template name="addTagElementT"/>
4477
4583
 
4478
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
4584
+ <fo:block role="SKIP">
4585
+
4586
+ <!-- element before fmt-defition -->
4587
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name) and not(self::mn:fmt-definition) and not(preceding-sibling::mn:fmt-definition)]"/>
4588
+ </fo:block>
4589
+
4590
+ <!-- elements after fmt-definition (include fmt-definition) -->
4591
+ <xsl:apply-templates select="node()[self::mn:fmt-definition or preceding-sibling::mn:fmt-definition]"/>
4592
+
4479
4593
  </fo:block>
4480
4594
  </xsl:template>
4481
4595
 
@@ -5197,6 +5311,13 @@
5197
5311
  <xsl:template name="refine_table-fn-body-style">
5198
5312
  </xsl:template>
5199
5313
 
5314
+ <xsl:attribute-set name="table-fn-p-style">
5315
+ <xsl:attribute name="role">P</xsl:attribute>
5316
+ </xsl:attribute-set>
5317
+
5318
+ <xsl:template name="refine_table-fn-p-style">
5319
+ </xsl:template>
5320
+
5200
5321
  <xsl:template name="setNoBordersForTableList">
5201
5322
  <xsl:if test="ancestor::mn:fmt-ol or ancestor::mn:fmt-ul">
5202
5323
  <xsl:attribute name="border">none</xsl:attribute>
@@ -5526,6 +5647,10 @@
5526
5647
  <!-- <Caption><P> tags, see https://github.com/metanorma/metanorma-pdfa/issues/81 -->
5527
5648
  <fo:block role="P">
5528
5649
 
5650
+ <xsl:if test="$continued = 'true'">
5651
+ <xsl:attribute name="role">SKIP</xsl:attribute>
5652
+ </xsl:if>
5653
+
5529
5654
  <xsl:choose>
5530
5655
  <xsl:when test="$continued = 'true'">
5531
5656
  </xsl:when>
@@ -5535,7 +5660,7 @@
5535
5660
  </xsl:choose>
5536
5661
 
5537
5662
  </fo:block>
5538
- </fo:block>
5663
+ </fo:block> <!-- END: Table name -->
5539
5664
 
5540
5665
  <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'pas' or $namespace = 'iec' or $namespace = 'iso'"> -->
5541
5666
  <xsl:if test="$continued = 'true'">
@@ -6470,8 +6595,16 @@
6470
6595
  </fo:block>
6471
6596
  </xsl:template> <!-- table/note -->
6472
6597
 
6473
- <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">
6474
- <fo:inline role="P"><xsl:apply-templates/></fo:inline>
6598
+ <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">
6599
+ <xsl:param name="fo_element">inline</xsl:param>
6600
+ <xsl:choose>
6601
+ <xsl:when test="contains($fo_element, 'block')">
6602
+ <fo:block role="P"><xsl:apply-templates/></fo:block>
6603
+ </xsl:when>
6604
+ <xsl:otherwise>
6605
+ <fo:inline role="P"><xsl:apply-templates/></fo:inline>
6606
+ </xsl:otherwise>
6607
+ </xsl:choose>
6475
6608
  </xsl:template>
6476
6609
 
6477
6610
  <!-- ============================ -->
@@ -6510,11 +6643,19 @@
6510
6643
  <xsl:with-param name="process">true</xsl:with-param>
6511
6644
  </xsl:apply-templates>
6512
6645
 
6646
+ <!-- 1st element in fn ('p' usually) -->
6513
6647
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6514
6648
  <xsl:call-template name="refine_table-fn-body-style"/>
6515
6649
  <!-- <xsl:copy-of select="./node()"/> -->
6516
- <xsl:apply-templates/>
6650
+ <xsl:apply-templates select="node()[normalize-space() != '' or self::*][1]"/>
6517
6651
  </fo:inline>
6652
+ <!-- 2th, 3rd ... -->
6653
+ <xsl:if test="node()[position() &gt; 1][normalize-space() != '' or self::*]">
6654
+ <fo:block xsl:use-attribute-sets="table-fn-body-style">
6655
+ <xsl:call-template name="refine_table-fn-body-style"/>
6656
+ <xsl:apply-templates select="node()[position() &gt; 1]"/>
6657
+ </fo:block>
6658
+ </xsl:if>
6518
6659
 
6519
6660
  </fo:block>
6520
6661
 
@@ -6668,6 +6809,23 @@
6668
6809
  </xsl:choose>
6669
6810
  </xsl:template> <!-- fn -->
6670
6811
 
6812
+ <xsl:template match="mn:table//mn:fn//mn:p | mn:table//mn:fmt-fn-body//mn:p" priority="4">
6813
+ <xsl:choose>
6814
+ <xsl:when test="preceding-sibling::*">
6815
+ <fo:block xsl:use-attribute-sets="table-fn-p-style">
6816
+ <xsl:call-template name="refine_table-fn-p-style"/>
6817
+ <xsl:apply-templates/>
6818
+ </fo:block>
6819
+ </xsl:when>
6820
+ <xsl:otherwise>
6821
+ <fo:inline xsl:use-attribute-sets="table-fn-p-style">
6822
+ <xsl:call-template name="refine_table-fn-p-style"/>
6823
+ <xsl:apply-templates/>
6824
+ </fo:inline>
6825
+ </xsl:otherwise>
6826
+ </xsl:choose>
6827
+ </xsl:template>
6828
+
6671
6829
  <!-- split string 'text' by 'separator' -->
6672
6830
  <xsl:template name="tokenize">
6673
6831
  <xsl:param name="text"/>
@@ -9506,6 +9664,7 @@
9506
9664
  <xsl:template match="mn:figure[not(mn:image) and *[local-name() = 'svg']]/mn:fmt-name/mn:bookmark" priority="2"/>
9507
9665
  <xsl:template match="mn:figure[not(mn:image)]/*[local-name() = 'svg']" priority="2" name="image_svg">
9508
9666
  <xsl:param name="name"/>
9667
+ <xsl:param name="inline_image">false</xsl:param>
9509
9668
 
9510
9669
  <xsl:variable name="svg_content">
9511
9670
  <xsl:apply-templates select="." mode="svg_update"/>
@@ -9617,7 +9776,7 @@
9617
9776
  <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
9618
9777
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
9619
9778
  </xsl:when>
9620
- <xsl:when test="not(ancestor::mn:figure)">
9779
+ <xsl:when test="not(ancestor::mn:figure) or ancestor::mn:fmt-name">
9621
9780
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
9622
9781
  </xsl:when>
9623
9782
  <xsl:otherwise>
@@ -9646,7 +9805,7 @@
9646
9805
  <xsl:attribute name="height">3.5mm</xsl:attribute>
9647
9806
  </xsl:when>
9648
9807
  <xsl:otherwise>
9649
- <xsl:if test="$isGenerateTableIF = 'false'">
9808
+ <xsl:if test="$isGenerateTableIF = 'false' and normalize-space($inline_image) = 'false'">
9650
9809
  <xsl:attribute name="width">100%</xsl:attribute>
9651
9810
  </xsl:if>
9652
9811
  <xsl:attribute name="content-height">100%</xsl:attribute>
@@ -9842,9 +10001,12 @@
9842
10001
  </xsl:template>
9843
10002
 
9844
10003
  <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
9845
- <xsl:template match="*[not(self::mn:figure)]/mn:image[*[local-name() = 'svg']]" priority="3">
10004
+ <!-- Note: count(ancestor::*) = 0 for image in mnx:figures/mnx:figure/fmt-name, when fmt-name is context/root node in template insertListOf_Item -->
10005
+ <xsl:template match="*[not(self::mn:figure)]/mn:image[*[local-name() = 'svg']] | mn:image[count(ancestor::*) = 0][*[local-name() = 'svg']]" priority="3">
9846
10006
  <xsl:for-each select="*[local-name() = 'svg']">
9847
- <xsl:call-template name="image_svg"/>
10007
+ <xsl:call-template name="image_svg">
10008
+ <xsl:with-param name="inline_image" select="not(ancestor::mn:bibdata)"/>
10009
+ </xsl:call-template>
9848
10010
  </xsl:for-each>
9849
10011
  </xsl:template>
9850
10012
 
@@ -10500,6 +10662,10 @@
10500
10662
 
10501
10663
  </fo:inline>
10502
10664
  </xsl:template>
10665
+
10666
+ <!-- remove whitespace from PDF structure tree (https://github.com/metanorma/mn-native-pdf/issues/1071) -->
10667
+ <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"/>
10668
+
10503
10669
  <!-- ======================================= -->
10504
10670
  <!-- END: math -->
10505
10671
  <!-- ======================================= -->
@@ -11310,7 +11476,7 @@
11310
11476
  <xsl:template name="refine_references-non-normative-style">
11311
11477
  </xsl:template>
11312
11478
 
11313
- <!-- ======================= -->
11479
+ <!-- ======================= -->
11314
11480
  <!-- Bibliography rendering -->
11315
11481
  <!-- ======================= -->
11316
11482
 
@@ -11328,7 +11494,7 @@
11328
11494
  <xsl:template match="mn:references[@normative='true']" priority="2">
11329
11495
 
11330
11496
  <xsl:call-template name="setNamedDestination"/>
11331
- <fo:block id="{@id}">
11497
+ <fo:block id="{@id}" role="Sect">
11332
11498
  <xsl:apply-templates/>
11333
11499
  </fo:block>
11334
11500
  </xsl:template>
@@ -11352,6 +11518,9 @@
11352
11518
 
11353
11519
  <fo:block xsl:use-attribute-sets="references-non-normative-style">
11354
11520
  <xsl:call-template name="refine_references-non-normative-style"/>
11521
+ <xsl:copy-of select="@role"/>
11522
+ <xsl:call-template name="addTagElementT"/>
11523
+
11355
11524
  <xsl:apply-templates select="node()[not(self::mn:fmt-title and @columns = 1)]"/>
11356
11525
  </fo:block>
11357
11526
  </xsl:template> <!-- references -->
@@ -12357,17 +12526,26 @@
12357
12526
  <xsl:template name="processTables_Contents">
12358
12527
  <mnx:tables>
12359
12528
  <xsl:for-each select="//mn:table[not(ancestor::mn:metanorma-extension)][@id and mn:fmt-name and normalize-space(@id) != '']">
12529
+ <xsl:variable name="root">
12530
+ <xsl:if test="ancestor-or-self::mn:preface">preface</xsl:if>
12531
+ <xsl:if test="ancestor-or-self::mn:annex">annex</xsl:if>
12532
+ </xsl:variable>
12360
12533
  <xsl:choose>
12361
12534
  <xsl:when test="mn:fmt-name">
12362
12535
  <xsl:variable name="fmt_name">
12363
12536
  <xsl:apply-templates select="mn:fmt-name" mode="update_xml_step1"/>
12364
12537
  </xsl:variable>
12365
- <mnx:table id="{@id}" alt-text="{normalize-space($fmt_name)}">
12538
+ <xsl:variable name="alt_text_">
12539
+ <xsl:apply-templates select="xalan:nodeset($fmt_name)/node()" mode="bookmarks"/>
12540
+ </xsl:variable>
12541
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space($alt_text_), concat($nbsp,$zero_width_space,$hair_space), ' '))"/>
12542
+
12543
+ <mnx:table id="{@id}" alt-text="{$alt_text}" root="{$root}">
12366
12544
  <xsl:copy-of select="$fmt_name"/>
12367
12545
  </mnx:table>
12368
12546
  </xsl:when>
12369
12547
  <xsl:otherwise>
12370
- <mnx:table id="{@id}" alt-text="{mn:name}">
12548
+ <mnx:table id="{@id}" alt-text="{mn:name}" root="{$root}">
12371
12549
  <xsl:copy-of select="mn:name"/>
12372
12550
  </mnx:table>
12373
12551
  </xsl:otherwise>
@@ -12379,17 +12557,26 @@
12379
12557
  <xsl:template name="processFigures_Contents">
12380
12558
  <mnx:figures>
12381
12559
  <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) != '']">
12560
+ <xsl:variable name="root">
12561
+ <xsl:if test="ancestor-or-self::mn:preface">preface</xsl:if>
12562
+ <xsl:if test="ancestor-or-self::mn:annex">annex</xsl:if>
12563
+ </xsl:variable>
12382
12564
  <xsl:choose>
12383
12565
  <xsl:when test="mn:fmt-name">
12384
12566
  <xsl:variable name="fmt_name">
12385
12567
  <xsl:apply-templates select="mn:fmt-name" mode="update_xml_step1"/>
12386
12568
  </xsl:variable>
12387
- <mnx:figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
12569
+ <xsl:variable name="alt_text_">
12570
+ <xsl:apply-templates select="xalan:nodeset($fmt_name)/node()" mode="bookmarks"/>
12571
+ </xsl:variable>
12572
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space($alt_text_), concat($nbsp,$zero_width_space,$hair_space), ' '))"/>
12573
+
12574
+ <mnx:figure id="{@id}" alt-text="{$alt_text}" root="{$root}">
12388
12575
  <xsl:copy-of select="$fmt_name"/>
12389
12576
  </mnx:figure>
12390
12577
  </xsl:when>
12391
12578
  <xsl:otherwise>
12392
- <mnx:figure id="{@id}" alt-text="{mn:name}">
12579
+ <mnx:figure id="{@id}" alt-text="{mn:name}" root="{$root}">
12393
12580
  <xsl:copy-of select="mn:name"/>
12394
12581
  </mnx:figure>
12395
12582
  </xsl:otherwise>
@@ -12401,23 +12588,40 @@
12401
12588
  <xsl:template name="processExamples_Contents">
12402
12589
  <mnx:examples>
12403
12590
  <xsl:for-each select="//mn:example[@id and mn:fmt-name and normalize-space(@id) != '']">
12404
- <!-- https://github.com/metanorma/metanorma-pdfa/issues/32#issuecomment-4929133938:
12405
- //example/fmt-xref-label[@container] + //example/fmt-name/span[@class = 'fmt-caption-delim'] + //example/name,
12406
- with the last two elements dropped if //example/name does not exist. -->
12407
- <xsl:variable name="example_name">
12408
- <xsl:apply-templates select="mn:name/node()" mode="update_xml_step1"/>
12409
- </xsl:variable>
12410
- <mnx:example id="{@id}" alt-text="{normalize-space($example_name)}">
12411
- <xsl:element name="fmt-name" namespace="{$namespace_full}">
12412
- <xsl:call-template name="capitalize"><!-- https://github.com/metanorma/metanorma-pdfa/issues/72 -->
12413
- <xsl:with-param name="str" select="mn:fmt-xref-label[@container]"/>
12414
- </xsl:call-template>
12415
- <xsl:if test="normalize-space($example_name) != ''">
12416
- <xsl:value-of select="mn:fmt-name/mn:span[@class = 'fmt-caption-delim']"/>
12417
- <xsl:copy-of select="$example_name"/>
12418
- </xsl:if>
12419
- </xsl:element>
12420
- </mnx:example>
12591
+ <xsl:choose>
12592
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/1116 -->
12593
+ <!-- example's will be processed from fmt-footnote-container -->
12594
+ <xsl:when test="ancestor::mn:fn and ancestor::mn:tr"><!--skip--></xsl:when>
12595
+ <xsl:otherwise>
12596
+ <!-- https://github.com/metanorma/metanorma-pdfa/issues/32#issuecomment-4929133938:
12597
+ //example/fmt-xref-label[@container] + //example/fmt-name/span[@class = 'fmt-caption-delim'] + //example/name,
12598
+ with the last two elements dropped if //example/name does not exist. -->
12599
+ <xsl:variable name="example_name">
12600
+ <!-- <xsl:apply-templates select="mn:name/node()" mode="update_xml_step1"/> -->
12601
+ <xsl:apply-templates select="mn:fmt-name/mn:semx[@element = 'name']/node()" mode="update_xml_step1"/>
12602
+ </xsl:variable>
12603
+ <xsl:variable name="alt_text_">
12604
+ <xsl:apply-templates select="xalan:nodeset($example_name)/node()" mode="bookmarks"/>
12605
+ </xsl:variable>
12606
+ <xsl:variable name="alt_text" select="normalize-space(translate(normalize-space($alt_text_), concat($nbsp,$zero_width_space,$hair_space), ' '))"/>
12607
+ <xsl:variable name="root">
12608
+ <xsl:if test="ancestor-or-self::mn:preface">preface</xsl:if>
12609
+ <xsl:if test="ancestor-or-self::mn:annex">annex</xsl:if>
12610
+ </xsl:variable>
12611
+
12612
+ <mnx:example id="{@id}" alt-text="{$alt_text_}" root="{$root}">
12613
+ <xsl:element name="fmt-name" namespace="{$namespace_full}">
12614
+ <xsl:call-template name="capitalize"><!-- https://github.com/metanorma/metanorma-pdfa/issues/72 -->
12615
+ <xsl:with-param name="str" select="mn:fmt-xref-label[@container]"/>
12616
+ </xsl:call-template>
12617
+ <xsl:if test="normalize-space($example_name) != ''">
12618
+ <xsl:value-of select="mn:fmt-name/mn:span[@class = 'fmt-caption-delim']"/>
12619
+ <xsl:copy-of select="$example_name"/>
12620
+ </xsl:if>
12621
+ </xsl:element>
12622
+ </mnx:example>
12623
+ </xsl:otherwise>
12624
+ </xsl:choose>
12421
12625
  </xsl:for-each>
12422
12626
  </mnx:examples>
12423
12627
  </xsl:template>
@@ -12615,6 +12819,11 @@
12615
12819
  <xsl:apply-templates mode="bookmarks"/>
12616
12820
  </xsl:template>
12617
12821
 
12822
+ <xsl:template match="*[local-name() = 'math']" mode="bookmarks">
12823
+ <xsl:value-of select="normalize-space(.)"/>
12824
+ </xsl:template>
12825
+ <xsl:template match="mn:asciimath" mode="bookmarks"/>
12826
+
12618
12827
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
12619
12828
  <xsl:template match="mn:span" mode="bookmarks">
12620
12829
  <xsl:apply-templates mode="bookmarks"/>
@@ -12633,6 +12842,54 @@
12633
12842
 
12634
12843
  <xsl:template match="mn:requirement | mn:recommendation | mn:permission" mode="bookmarks" priority="3"/>
12635
12844
 
12845
+ <xsl:template match="mn:fmt-link" mode="bookmarks">
12846
+ <!-- apply template from common.link.xsl -->
12847
+ <xsl:variable name="link"><xsl:apply-templates select="."/></xsl:variable>
12848
+ <xsl:value-of select="normalize-space($link)"/>
12849
+ </xsl:template>
12850
+
12851
+ <xsl:template match="mn:image" mode="bookmarks"/>
12852
+
12853
+ <xsl:template match="mn:image[normalize-space(@alt) != '']" mode="bookmarks">
12854
+ <xsl:value-of select="concat('[', normalize-space(@alt), ']')"/>
12855
+ </xsl:template>
12856
+
12857
+ <xsl:template match="mnx:item" mode="bookmarks">
12858
+ <xsl:apply-templates mode="bookmarks"/>
12859
+ </xsl:template>
12860
+
12861
+ <xsl:template match="mnx:item[@id != '']" mode="bookmarks">
12862
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
12863
+ <fo:bookmark-title>
12864
+ <xsl:if test="@section != ''">
12865
+ <xsl:value-of select="@section"/>
12866
+ <xsl:text> </xsl:text>
12867
+ </xsl:if>
12868
+ <xsl:variable name="title">
12869
+ <xsl:if test="1 = 2">
12870
+ <xsl:for-each select="mnx:title/node()">
12871
+ <xsl:choose>
12872
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
12873
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
12874
+ </xsl:choose>
12875
+ </xsl:for-each>
12876
+ </xsl:if>
12877
+ <xsl:apply-templates select="mnx:title/node()" mode="bookmarks"/>
12878
+ </xsl:variable>
12879
+ <xsl:value-of select="normalize-space($title)"/>
12880
+ </fo:bookmark-title>
12881
+ <xsl:apply-templates select="mnx:item" mode="bookmarks"/>
12882
+ </fo:bookmark>
12883
+ </xsl:template>
12884
+
12885
+ <xsl:template match="text()" mode="bookmarks">
12886
+ <xsl:value-of select="."/>
12887
+ </xsl:template>
12888
+
12889
+ <xsl:template match="mnx:item/text()" mode="bookmarks"/>
12890
+
12891
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]" mode="bookmarks"/>
12892
+
12636
12893
  <!-- Bookmarks -->
12637
12894
  <xsl:template name="addBookmarks">
12638
12895
  <xsl:param name="contents"/>
@@ -12686,7 +12943,7 @@
12686
12943
  </xsl:choose>
12687
12944
  </fo:bookmark-title>
12688
12945
 
12689
- <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmark"/>
12946
+ <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmarks"/>
12690
12947
 
12691
12948
  <xsl:call-template name="insertFigureBookmarks">
12692
12949
  <xsl:with-param name="contents" select="mnx:contents"/>
@@ -12712,7 +12969,7 @@
12712
12969
  <xsl:otherwise>
12713
12970
  <xsl:for-each select="$contents_nodes/mnx:doc">
12714
12971
 
12715
- <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmark"/>
12972
+ <xsl:apply-templates select="mnx:contents/mnx:item" mode="bookmarks"/>
12716
12973
 
12717
12974
  <xsl:call-template name="insertFigureBookmarks">
12718
12975
  <xsl:with-param name="contents" select="mnx:contents"/>
@@ -12736,7 +12993,7 @@
12736
12993
  </xsl:choose>
12737
12994
  </xsl:when>
12738
12995
  <xsl:otherwise>
12739
- <xsl:apply-templates select="$contents_nodes/mnx:contents/mnx:item" mode="bookmark"/>
12996
+ <xsl:apply-templates select="$contents_nodes/mnx:contents/mnx:item" mode="bookmarks"/>
12740
12997
 
12741
12998
  <xsl:call-template name="insertFigureBookmarks">
12742
12999
  <xsl:with-param name="contents" select="$contents_nodes/mnx:contents"/>
@@ -12790,7 +13047,9 @@
12790
13047
  <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
12791
13048
  <xsl:for-each select="$contents_nodes//mnx:figures/mnx:figure">
12792
13049
  <fo:bookmark internal-destination="{@id}">
12793
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
13050
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
13051
+ <xsl:variable name="title"><xsl:apply-templates mode="bookmarks"/></xsl:variable>
13052
+ <fo:bookmark-title><xsl:value-of select="normalize-space($title)"/></fo:bookmark-title>
12794
13053
  </fo:bookmark>
12795
13054
  </xsl:for-each>
12796
13055
  </fo:bookmark>
@@ -12831,7 +13090,9 @@
12831
13090
  <xsl:for-each select="$contents_nodes//mnx:tables/mnx:table">
12832
13091
  <fo:bookmark internal-destination="{@id}">
12833
13092
  <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
12834
- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
13093
+ <!-- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title> -->
13094
+ <xsl:variable name="title"><xsl:apply-templates mode="bookmarks"/></xsl:variable>
13095
+ <fo:bookmark-title><xsl:value-of select="normalize-space($title)"/></fo:bookmark-title>
12835
13096
  </fo:bookmark>
12836
13097
  </xsl:for-each>
12837
13098
  </fo:bookmark>
@@ -12872,7 +13133,9 @@
12872
13133
  <xsl:for-each select="$contents_nodes//mnx:examples/mnx:example">
12873
13134
  <fo:bookmark internal-destination="{@id}">
12874
13135
  <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
12875
- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
13136
+ <!-- <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title> -->
13137
+ <xsl:variable name="title"><xsl:apply-templates mode="bookmarks"/></xsl:variable>
13138
+ <fo:bookmark-title><xsl:value-of select="normalize-space($title)"/></fo:bookmark-title>
12876
13139
  </fo:bookmark>
12877
13140
  </xsl:for-each>
12878
13141
  </fo:bookmark>
@@ -12880,26 +13143,6 @@
12880
13143
  </xsl:template> <!-- insertExampleBookmarks -->
12881
13144
  <!-- End Bookmarks -->
12882
13145
 
12883
- <!-- ============================ -->
12884
- <!-- mode="bookmark_clean" -->
12885
- <!-- ============================ -->
12886
- <xsl:template match="node()" mode="bookmark_clean">
12887
- <xsl:apply-templates select="node()" mode="bookmark_clean"/>
12888
- </xsl:template>
12889
-
12890
- <xsl:template match="text()" mode="bookmark_clean">
12891
- <xsl:value-of select="."/>
12892
- </xsl:template>
12893
-
12894
- <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
12895
- <xsl:value-of select="normalize-space(.)"/>
12896
- </xsl:template>
12897
-
12898
- <xsl:template match="mn:asciimath" mode="bookmark_clean"/>
12899
- <!-- ============================ -->
12900
- <!-- END: mode="bookmark_clean" -->
12901
- <!-- ============================ -->
12902
-
12903
13146
  <xsl:template name="getLangVersion">
12904
13147
  <xsl:param name="lang"/>
12905
13148
  <xsl:param name="doctype" select="''"/>
@@ -12914,37 +13157,6 @@
12914
13157
  </xsl:choose>
12915
13158
  </xsl:template>
12916
13159
 
12917
- <xsl:template match="mnx:item" mode="bookmark">
12918
- <xsl:choose>
12919
- <xsl:when test="@id != ''">
12920
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
12921
- <fo:bookmark-title>
12922
- <xsl:if test="@section != ''">
12923
- <xsl:value-of select="@section"/>
12924
- <xsl:text> </xsl:text>
12925
- </xsl:if>
12926
- <xsl:variable name="title">
12927
- <xsl:for-each select="mnx:title/node()">
12928
- <xsl:choose>
12929
- <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
12930
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
12931
- </xsl:choose>
12932
- </xsl:for-each>
12933
- </xsl:variable>
12934
- <xsl:value-of select="normalize-space($title)"/>
12935
- </fo:bookmark-title>
12936
- <xsl:apply-templates mode="bookmark"/>
12937
- </fo:bookmark>
12938
- </xsl:when>
12939
- <xsl:otherwise>
12940
- <xsl:apply-templates mode="bookmark"/>
12941
- </xsl:otherwise>
12942
- </xsl:choose>
12943
- </xsl:template>
12944
-
12945
- <xsl:template match="mnx:title" mode="bookmark"/>
12946
- <xsl:template match="text()" mode="bookmark"/>
12947
-
12948
13160
  <!-- ====== -->
12949
13161
  <!-- ====== -->
12950
13162
  <xsl:template match="mn:title" mode="contents_item">
@@ -12998,6 +13210,10 @@
12998
13210
  <xsl:text> </xsl:text>
12999
13211
  </xsl:template>
13000
13212
 
13213
+ <xsl:template match="mn:br | mn:tab" mode="bookmarks">
13214
+ <xsl:text> </xsl:text>
13215
+ </xsl:template>
13216
+
13001
13217
  <xsl:template match="mn:strong" mode="contents_item">
13002
13218
  <xsl:param name="element"/>
13003
13219
  <xsl:copy>
@@ -13007,26 +13223,9 @@
13007
13223
  </xsl:copy>
13008
13224
  </xsl:template>
13009
13225
 
13010
- <xsl:template match="mn:em" mode="contents_item">
13011
- <xsl:copy>
13012
- <xsl:apply-templates mode="contents_item"/>
13013
- </xsl:copy>
13014
- </xsl:template>
13015
-
13016
- <xsl:template match="mn:sub" mode="contents_item">
13017
- <xsl:copy>
13018
- <xsl:apply-templates mode="contents_item"/>
13019
- </xsl:copy>
13020
- </xsl:template>
13021
-
13022
- <xsl:template match="mn:sup" mode="contents_item">
13023
- <xsl:copy>
13024
- <xsl:apply-templates mode="contents_item"/>
13025
- </xsl:copy>
13026
- </xsl:template>
13027
-
13028
- <xsl:template match="mn:tt" mode="contents_item">
13226
+ <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">
13029
13227
  <xsl:copy>
13228
+ <xsl:copy-of select="@*"/>
13030
13229
  <xsl:apply-templates mode="contents_item"/>
13031
13230
  </xsl:copy>
13032
13231
  </xsl:template>
@@ -13098,6 +13297,24 @@
13098
13297
  </xsl:apply-templates>
13099
13298
  </xsl:template>
13100
13299
 
13300
+ <xsl:template match="mn:fmt-link" mode="contents_item">
13301
+ <!-- apply template from common.link.xsl -->
13302
+ <xsl:variable name="link"><xsl:apply-templates select="."/></xsl:variable>
13303
+ <xsl:value-of select="normalize-space($link)"/>
13304
+ </xsl:template>
13305
+
13306
+ <xsl:template match="mn:image" mode="contents_item">
13307
+ <xsl:copy-of select="."/>
13308
+ </xsl:template>
13309
+
13310
+ <xsl:template match="*[local-name() = 'padding']" mode="contents_item">
13311
+ <xsl:text> </xsl:text>
13312
+ </xsl:template>
13313
+
13314
+ <xsl:template match="*[local-name() = 'padding']" mode="bookmarks">
13315
+ <xsl:text> </xsl:text>
13316
+ </xsl:template>
13317
+
13101
13318
  <!-- =================== -->
13102
13319
  <!-- Table of Contents (ToC) processing -->
13103
13320
  <!-- =================== -->
@@ -14108,6 +14325,7 @@
14108
14325
  <xsl:call-template name="setId"/>
14109
14326
 
14110
14327
  <xsl:call-template name="sections_element_style"/>
14328
+ <xsl:copy-of select="@role"/>
14111
14329
 
14112
14330
  <!-- <xsl:if test="$namespace = 'rsd'"> -->
14113
14331
  <xsl:call-template name="addTagElementT"/>
@@ -14151,6 +14369,7 @@
14151
14369
  <fo:block break-after="page"/>
14152
14370
  <xsl:call-template name="setNamedDestination"/>
14153
14371
  <fo:block role="Sect">
14372
+ <xsl:copy-of select="@role"/>
14154
14373
  <xsl:call-template name="addTagElementT"/>
14155
14374
  <xsl:call-template name="setId"/>
14156
14375
  <xsl:call-template name="addReviewHelper"/>
@@ -14189,6 +14408,7 @@
14189
14408
  <xsl:call-template name="setBlockSpanAll"/>
14190
14409
 
14191
14410
  <xsl:call-template name="refine_clause-style"/>
14411
+ <xsl:copy-of select="@role"/>
14192
14412
 
14193
14413
  <xsl:call-template name="addReviewHelper"/>
14194
14414
 
@@ -14310,24 +14530,16 @@
14310
14530
 
14311
14531
  <xsl:template name="addTagElementT">
14312
14532
  <xsl:variable name="title_">
14313
- <xsl:apply-templates select="mn:fmt-title"/>
14533
+ <xsl:apply-templates select="mn:fmt-title" mode="bookmarks"/>
14314
14534
  <xsl:if test="not(mn:fmt-title) and self::mn:term">
14315
14535
  <name>
14316
- <xsl:apply-templates select="mn:fmt-name"/>
14536
+ <xsl:apply-templates select="mn:fmt-name" mode="bookmarks"/>
14317
14537
  <xsl:text> </xsl:text>
14318
14538
  <xsl:apply-templates select="mn:fmt-preferred/node()[1]"/>
14319
14539
  </name>
14320
14540
  </xsl:if>
14321
14541
  </xsl:variable>
14322
- <xsl:variable name="title__">
14323
- <xsl:for-each select="xalan:nodeset($title_)/*/node()">
14324
- <xsl:choose>
14325
- <xsl:when test="self::text()"><xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:when>
14326
- <xsl:otherwise><xsl:text> </xsl:text><xsl:copy-of select="."/><xsl:text> </xsl:text></xsl:otherwise>
14327
- </xsl:choose>
14328
- </xsl:for-each>
14329
- </xsl:variable>
14330
- <xsl:variable name="title" select="normalize-space(translate($title__, concat($em_space,' &#8232;'), ' '))"/>
14542
+ <xsl:variable name="title" select="normalize-space(translate($title_, concat($em_space,' &#8232;'), ' '))"/>
14331
14543
  <xsl:if test="$title != ''">
14332
14544
  <xsl:attribute name="fox:title">
14333
14545
  <xsl:if test="ancestor::mn:sections">
@@ -14837,6 +15049,27 @@
14837
15049
  <!-- Get or calculate depth of term's name -->
14838
15050
  <xsl:template name="getLevelTermName">
14839
15051
  <xsl:choose>
15052
+ <xsl:when test="self::mn:term">
15053
+ <xsl:choose>
15054
+ <xsl:when test="normalize-space(@depth) != ''">
15055
+ <xsl:value-of select="@depth"/>
15056
+ </xsl:when>
15057
+ <xsl:otherwise>
15058
+ <xsl:variable name="title_level_">
15059
+ <xsl:for-each select="preceding-sibling::mn:fmt-title[1]">
15060
+ <xsl:call-template name="getLevel"/>
15061
+ </xsl:for-each>
15062
+ </xsl:variable>
15063
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
15064
+ <xsl:choose>
15065
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
15066
+ <xsl:otherwise>
15067
+ <xsl:call-template name="getLevel"/>
15068
+ </xsl:otherwise>
15069
+ </xsl:choose>
15070
+ </xsl:otherwise>
15071
+ </xsl:choose>
15072
+ </xsl:when><!-- end: self::mn:term -->
14840
15073
  <xsl:when test="normalize-space(../@depth) != ''">
14841
15074
  <xsl:value-of select="../@depth"/>
14842
15075
  </xsl:when>