metanorma-nist 1.2.11 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@
5
5
 
6
6
 
7
7
  <xsl:param name="svg_images"/>
8
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
8
9
  <xsl:variable name="images" select="document($svg_images)"/>
9
10
 
10
11
 
@@ -86,7 +87,9 @@
86
87
  </fo:simple-page-master>
87
88
  </fo:layout-master-set>
88
89
 
89
- <xsl:call-template name="addPDFUAmeta"/>
90
+ <fo:declarations>
91
+ <xsl:call-template name="addPDFUAmeta"/>
92
+ </fo:declarations>
90
93
 
91
94
  <xsl:call-template name="addBookmarks">
92
95
  <xsl:with-param name="contents" select="$contents"/>
@@ -1470,7 +1473,7 @@
1470
1473
  </fo:block>
1471
1474
  </xsl:when>
1472
1475
  <xsl:when test="ancestor-or-self::nist:annex and $level &gt;= 2">
1473
- <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" margin-top="3pt" margin-bottom="12pt" keep-with-next="always">
1476
+ <fo:block font-family="Arial" font-size="12pt" font-weight="bold" margin-top="3pt" margin-bottom="12pt" keep-with-next="always"> <!-- text-align="center" -->
1474
1477
  <xsl:apply-templates/>
1475
1478
  </fo:block>
1476
1479
  </xsl:when>
@@ -1545,6 +1548,7 @@
1545
1548
  <fo:list-block>
1546
1549
  <xsl:attribute name="space-after">
1547
1550
  <xsl:choose>
1551
+ <xsl:when test="ancestor::nist:figure and not(following-sibling::*)">0pt</xsl:when>
1548
1552
  <xsl:when test="$margin != ''"><xsl:value-of select="$margin"/></xsl:when>
1549
1553
  <xsl:otherwise>12pt</xsl:otherwise>
1550
1554
  </xsl:choose>
@@ -1681,7 +1685,8 @@
1681
1685
  <fo:table-body>
1682
1686
  <fo:table-row>
1683
1687
  <fo:table-cell>
1684
- <fo:block text-align="left" margin-left="7mm">
1688
+ <!-- <fo:block text-align="left" margin-left="7mm"> -->
1689
+ <fo:block text-align="center" margin-left="7mm">
1685
1690
  <xsl:apply-templates/>
1686
1691
  </fo:block>
1687
1692
  </fo:table-cell>
@@ -1794,6 +1799,10 @@
1794
1799
  </fo:block>
1795
1800
  </xsl:template>
1796
1801
 
1802
+ <xsl:template match="nist:figure[@class='pseudocode']//nist:dd//nist:stem[count(ancestor::nist:dd/nist:p) = 1 and normalize-space(ancestor::nist:dd/nist:p/text()) = '']" priority="2">
1803
+ <fo:inline><xsl:apply-templates/></fo:inline>
1804
+ </xsl:template>
1805
+
1797
1806
  <xsl:template match="nist:dd//nist:stem[count(ancestor::nist:dd/nist:p) = 1 and normalize-space(ancestor::nist:dd/nist:p/text()) = '']">
1798
1807
  <fo:block text-align="center">
1799
1808
  <xsl:apply-templates/>
@@ -1806,6 +1815,37 @@
1806
1815
  </fo:block>
1807
1816
  </xsl:template>
1808
1817
 
1818
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']" priority="2">
1819
+ <fo:block-container id="{@id}" border="1pt solid black" background-color="rgb(230, 230, 230)" padding="1.5mm" space-before="6pt" space-after="6pt">
1820
+ <xsl:apply-templates/>
1821
+ </fo:block-container>
1822
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
1823
+ </xsl:template>
1824
+
1825
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name()='dl']" priority="2">
1826
+ <fo:block-container id="{@id}">
1827
+ <xsl:apply-templates/>
1828
+ </fo:block-container>
1829
+ </xsl:template>
1830
+
1831
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name()='dt']" priority="2">
1832
+ <fo:block>
1833
+ <xsl:if test="following-sibling::*[local-name()='dt'] or ancestor::*[local-name()='dd']/following-sibling::*[local-name()='dt']">
1834
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1835
+ </xsl:if>
1836
+ <xsl:if test="preceding-sibling::*[local-name()='dt'] or ancestor::*[local-name()='dd']/preceding-sibling::*[local-name()='dt']">
1837
+ <xsl:attribute name="margin-top">2pt</xsl:attribute>
1838
+ </xsl:if>
1839
+ <xsl:apply-templates/>
1840
+ <fo:inline>: </fo:inline>
1841
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
1842
+ </fo:block>
1843
+ </xsl:template>
1844
+
1845
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name()='dd']/*[local-name()='p']" priority="2">
1846
+ <fo:inline><xsl:apply-templates/></fo:inline>
1847
+ </xsl:template>
1848
+
1809
1849
  <!-- <xsl:template match="nist:dl[@type = 'glossary']" priority="2">
1810
1850
  <xsl:apply-templates />
1811
1851
  </xsl:template>
@@ -2347,6 +2387,7 @@
2347
2387
 
2348
2388
 
2349
2389
 
2390
+
2350
2391
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2351
2392
 
2352
2393
 
@@ -2457,6 +2498,7 @@
2457
2498
 
2458
2499
 
2459
2500
 
2501
+
2460
2502
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2461
2503
 
2462
2504
 
@@ -2584,205 +2626,239 @@
2584
2626
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2585
2627
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2586
2628
  <xsl:call-template name="add-zero-spaces-java"/>
2587
- </xsl:template><xsl:template match="*[local-name()='table']">
2629
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2588
2630
 
2589
- <xsl:variable name="simple-table">
2590
- <xsl:call-template name="getSimpleTable"/>
2591
- </xsl:variable>
2631
+ <xsl:variable name="table">
2592
2632
 
2593
-
2594
-
2595
-
2596
-
2597
- <!-- <xsl:if test="$namespace = 'bipm'">
2598
- <fo:block>&#xA0;</fo:block>
2599
- </xsl:if> -->
2600
-
2601
- <!-- $namespace = 'iso' or -->
2602
-
2603
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2604
-
2605
-
2633
+ <xsl:variable name="simple-table">
2634
+ <xsl:call-template name="getSimpleTable"/>
2635
+ </xsl:variable>
2606
2636
 
2607
2637
 
2608
-
2609
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2610
-
2611
- <!-- <xsl:variable name="cols-count">
2612
- <xsl:choose>
2613
- <xsl:when test="*[local-name()='thead']">
2614
- <xsl:call-template name="calculate-columns-numbers">
2615
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2616
- </xsl:call-template>
2617
- </xsl:when>
2618
- <xsl:otherwise>
2619
- <xsl:call-template name="calculate-columns-numbers">
2620
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2621
- </xsl:call-template>
2622
- </xsl:otherwise>
2623
- </xsl:choose>
2624
- </xsl:variable> -->
2625
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2626
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2627
-
2628
-
2629
-
2630
- <xsl:variable name="colwidths">
2631
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2632
- <xsl:call-template name="calculate-column-widths">
2633
- <xsl:with-param name="cols-count" select="$cols-count"/>
2634
- <xsl:with-param name="table" select="$simple-table"/>
2635
- </xsl:call-template>
2636
- </xsl:if>
2637
- </xsl:variable>
2638
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2639
-
2640
- <!-- <xsl:variable name="colwidths2">
2641
- <xsl:call-template name="calculate-column-widths">
2642
- <xsl:with-param name="cols-count" select="$cols-count"/>
2643
- </xsl:call-template>
2644
- </xsl:variable> -->
2645
-
2646
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2647
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2648
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2649
-
2650
- <xsl:variable name="margin-left">
2651
- <xsl:choose>
2652
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2653
- <xsl:otherwise>0</xsl:otherwise>
2654
- </xsl:choose>
2655
- </xsl:variable>
2656
-
2657
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2658
2638
 
2659
2639
 
2660
- <xsl:attribute name="space-after">6pt</xsl:attribute>
2661
2640
 
2662
-
2663
-
2664
-
2641
+ <!-- <xsl:if test="$namespace = 'bipm'">
2642
+ <fo:block>&#xA0;</fo:block>
2643
+ </xsl:if> -->
2665
2644
 
2645
+ <!-- $namespace = 'iso' or -->
2666
2646
 
2667
- <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
2668
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2669
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2670
- </xsl:if>
2671
- <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
2672
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2673
- <xsl:attribute name="font-size">12pt</xsl:attribute>
2674
- </xsl:if>
2675
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2647
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2676
2648
 
2677
-
2649
+
2678
2650
 
2651
+
2679
2652
 
2653
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2680
2654
 
2655
+ <!-- <xsl:variable name="cols-count">
2656
+ <xsl:choose>
2657
+ <xsl:when test="*[local-name()='thead']">
2658
+ <xsl:call-template name="calculate-columns-numbers">
2659
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2660
+ </xsl:call-template>
2661
+ </xsl:when>
2662
+ <xsl:otherwise>
2663
+ <xsl:call-template name="calculate-columns-numbers">
2664
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2665
+ </xsl:call-template>
2666
+ </xsl:otherwise>
2667
+ </xsl:choose>
2668
+ </xsl:variable> -->
2669
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2670
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2681
2671
 
2682
2672
 
2683
2673
 
2674
+ <xsl:variable name="colwidths">
2675
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2676
+ <xsl:call-template name="calculate-column-widths">
2677
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2678
+ <xsl:with-param name="table" select="$simple-table"/>
2679
+ </xsl:call-template>
2680
+ </xsl:if>
2681
+ </xsl:variable>
2682
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2684
2683
 
2685
- <xsl:variable name="table_attributes">
2686
- <attribute name="table-layout">fixed</attribute>
2687
- <attribute name="width">
2688
- <xsl:choose>
2689
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2690
- <xsl:otherwise>100%</xsl:otherwise>
2691
- </xsl:choose>
2692
- </attribute>
2693
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2694
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2684
+ <!-- <xsl:variable name="colwidths2">
2685
+ <xsl:call-template name="calculate-column-widths">
2686
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2687
+ </xsl:call-template>
2688
+ </xsl:variable> -->
2689
+
2690
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2691
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2692
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2693
+
2694
+ <xsl:variable name="margin-left">
2695
+ <xsl:choose>
2696
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2697
+ <xsl:otherwise>0</xsl:otherwise>
2698
+ </xsl:choose>
2699
+ </xsl:variable>
2700
+
2701
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2695
2702
 
2696
2703
 
2704
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2697
2705
 
2706
+
2707
+
2708
+
2698
2709
 
2699
-
2700
-
2701
-
2702
2710
 
2703
-
2711
+ <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
2712
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2713
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2714
+ </xsl:if>
2715
+ <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
2716
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2717
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2718
+ </xsl:if>
2719
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2704
2720
 
2705
- </xsl:variable>
2706
-
2707
-
2708
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2721
+
2709
2722
 
2710
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2711
- <xsl:attribute name="{@name}">
2712
- <xsl:value-of select="."/>
2713
- </xsl:attribute>
2714
- </xsl:for-each>
2715
2723
 
2716
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2717
- <xsl:if test="$isNoteOrFnExist = 'true'">
2718
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2719
- </xsl:if>
2720
2724
 
2721
- <xsl:choose>
2722
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2723
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2724
- <fo:table-column column-width="{@width}"/>
2725
- </xsl:for-each>
2726
- </xsl:when>
2727
- <xsl:otherwise>
2728
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2729
- <xsl:choose>
2730
- <xsl:when test=". = 1 or . = 0">
2731
- <fo:table-column column-width="proportional-column-width(2)"/>
2732
- </xsl:when>
2733
- <xsl:otherwise>
2734
- <fo:table-column column-width="proportional-column-width({.})"/>
2735
- </xsl:otherwise>
2736
- </xsl:choose>
2737
- </xsl:for-each>
2738
- </xsl:otherwise>
2739
- </xsl:choose>
2740
2725
 
2741
- <xsl:choose>
2742
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2743
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2744
- </xsl:when>
2745
- <xsl:otherwise>
2746
- <xsl:apply-templates/>
2747
- </xsl:otherwise>
2748
- </xsl:choose>
2749
2726
 
2750
- </fo:table>
2751
-
2752
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2753
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2754
- <xsl:call-template name="insertTableFooterInSeparateTable">
2755
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2756
- <xsl:with-param name="colwidths" select="$colwidths"/>
2757
- <xsl:with-param name="colgroup" select="$colgroup"/>
2758
- </xsl:call-template>
2759
- </xsl:for-each>
2760
-
2761
- <!-- insert footer as table -->
2762
- <!-- <fo:table>
2763
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2764
- <xsl:attribute name="{@name}">
2765
- <xsl:value-of select="."/>
2766
- </xsl:attribute>
2767
- </xsl:for-each>
2768
2727
 
2769
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2728
+ <xsl:variable name="table_width">
2729
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2730
+ 100%
2731
+
2732
+
2733
+ </xsl:variable>
2734
+
2735
+ <xsl:variable name="table_attributes">
2736
+ <attribute name="table-layout">fixed</attribute>
2737
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
2738
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2739
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+
2749
+
2750
+ </xsl:variable>
2751
+
2752
+
2753
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
2754
+
2755
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2756
+ <xsl:attribute name="{@name}">
2757
+ <xsl:value-of select="."/>
2758
+ </xsl:attribute>
2759
+ </xsl:for-each>
2760
+
2761
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2762
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2763
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2764
+ </xsl:if>
2765
+
2770
2766
  <xsl:choose>
2771
- <xsl:when test=". = 1 or . = 0">
2772
- <fo:table-column column-width="proportional-column-width(2)"/>
2767
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2768
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2769
+ <fo:table-column column-width="{@width}"/>
2770
+ </xsl:for-each>
2773
2771
  </xsl:when>
2774
2772
  <xsl:otherwise>
2775
- <fo:table-column column-width="proportional-column-width({.})"/>
2773
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2774
+ <xsl:choose>
2775
+ <xsl:when test=". = 1 or . = 0">
2776
+ <fo:table-column column-width="proportional-column-width(2)"/>
2777
+ </xsl:when>
2778
+ <xsl:otherwise>
2779
+ <fo:table-column column-width="proportional-column-width({.})"/>
2780
+ </xsl:otherwise>
2781
+ </xsl:choose>
2782
+ </xsl:for-each>
2776
2783
  </xsl:otherwise>
2777
2784
  </xsl:choose>
2785
+
2786
+ <xsl:choose>
2787
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2788
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2789
+ </xsl:when>
2790
+ <xsl:otherwise>
2791
+ <xsl:apply-templates/>
2792
+ </xsl:otherwise>
2793
+ </xsl:choose>
2794
+
2795
+ </fo:table>
2796
+
2797
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2798
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2799
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2800
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2801
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2802
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2803
+ </xsl:call-template>
2778
2804
  </xsl:for-each>
2779
- </fo:table>-->
2780
-
2781
-
2782
-
2783
-
2784
-
2785
- </fo:block-container>
2805
+
2806
+ <!-- insert footer as table -->
2807
+ <!-- <fo:table>
2808
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2809
+ <xsl:attribute name="{@name}">
2810
+ <xsl:value-of select="."/>
2811
+ </xsl:attribute>
2812
+ </xsl:for-each>
2813
+
2814
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2815
+ <xsl:choose>
2816
+ <xsl:when test=". = 1 or . = 0">
2817
+ <fo:table-column column-width="proportional-column-width(2)"/>
2818
+ </xsl:when>
2819
+ <xsl:otherwise>
2820
+ <fo:table-column column-width="proportional-column-width({.})"/>
2821
+ </xsl:otherwise>
2822
+ </xsl:choose>
2823
+ </xsl:for-each>
2824
+ </fo:table>-->
2825
+
2826
+
2827
+
2828
+
2829
+
2830
+ </fo:block-container>
2831
+ </xsl:variable>
2832
+
2833
+
2834
+
2835
+ <xsl:choose>
2836
+ <xsl:when test="@width">
2837
+
2838
+ <!-- centered table when table name is centered (see table-name-style) -->
2839
+
2840
+ <fo:table table-layout="fixed" width="100%">
2841
+ <fo:table-column column-width="proportional-column-width(1)"/>
2842
+ <fo:table-column column-width="{@width}"/>
2843
+ <fo:table-column column-width="proportional-column-width(1)"/>
2844
+ <fo:table-body>
2845
+ <fo:table-row>
2846
+ <fo:table-cell column-number="2">
2847
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
2848
+ </fo:table-cell>
2849
+ </fo:table-row>
2850
+ </fo:table-body>
2851
+ </fo:table>
2852
+
2853
+
2854
+
2855
+
2856
+ </xsl:when>
2857
+ <xsl:otherwise>
2858
+ <xsl:copy-of select="$table"/>
2859
+ </xsl:otherwise>
2860
+ </xsl:choose>
2861
+
2786
2862
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2787
2863
  <xsl:if test="normalize-space() != ''">
2788
2864
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2910,7 +2986,15 @@
2910
2986
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2911
2987
  <xsl:value-of select="@target"/>
2912
2988
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2913
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2989
+ <xsl:variable name="mathml">
2990
+ <xsl:for-each select="*">
2991
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2992
+ <xsl:copy-of select="."/>
2993
+ </xsl:if>
2994
+ </xsl:for-each>
2995
+ </xsl:variable>
2996
+
2997
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2914
2998
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2915
2999
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2916
3000
  <xsl:param name="cols-count"/>
@@ -3623,7 +3707,7 @@
3623
3707
  <xsl:with-param name="table" select="$html-table"/>
3624
3708
  </xsl:call-template>
3625
3709
  </xsl:variable>
3626
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3710
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3627
3711
  <xsl:variable name="maxlength_dt">
3628
3712
  <xsl:call-template name="getMaxLength_dt"/>
3629
3713
  </xsl:variable>
@@ -3652,13 +3736,22 @@
3652
3736
  </xsl:when>
3653
3737
  <xsl:otherwise>
3654
3738
  <xsl:choose>
3739
+ <!-- to set width check most wide chars like `W` -->
3655
3740
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3656
- <fo:table-column column-width="5%"/>
3657
- <fo:table-column column-width="95%"/>
3741
+ <fo:table-column column-width="7%"/>
3742
+ <fo:table-column column-width="93%"/>
3658
3743
  </xsl:when>
3659
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3660
- <fo:table-column column-width="10%"/>
3661
- <fo:table-column column-width="90%"/>
3744
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
3745
+ <fo:table-column column-width="15%"/>
3746
+ <fo:table-column column-width="85%"/>
3747
+ </xsl:when>
3748
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
3749
+ <fo:table-column column-width="20%"/>
3750
+ <fo:table-column column-width="80%"/>
3751
+ </xsl:when>
3752
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
3753
+ <fo:table-column column-width="25%"/>
3754
+ <fo:table-column column-width="75%"/>
3662
3755
  </xsl:when>
3663
3756
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3664
3757
  <fo:table-column column-width="60%"/>
@@ -3870,6 +3963,7 @@
3870
3963
 
3871
3964
 
3872
3965
 
3966
+
3873
3967
 
3874
3968
  </xsl:variable>
3875
3969
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3891,6 +3985,10 @@
3891
3985
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3892
3986
  <xsl:apply-templates/>
3893
3987
  </fo:inline>
3988
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3989
+ <fo:inline background-color="yellow">
3990
+ <xsl:apply-templates/>
3991
+ </fo:inline>
3894
3992
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3895
3993
  <xsl:variable name="text" select="normalize-space(.)"/>
3896
3994
  <fo:inline font-size="75%">
@@ -3980,6 +4078,10 @@
3980
4078
  <xsl:param name="text" select="."/>
3981
4079
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3982
4080
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4081
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4082
+ <xsl:param name="text" select="."/>
4083
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4084
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
3983
4085
  </xsl:template><xsl:template name="add-zero-spaces">
3984
4086
  <xsl:param name="text" select="."/>
3985
4087
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4227,6 +4329,7 @@
4227
4329
  <xsl:apply-templates select="." mode="mathml"/>
4228
4330
  </xsl:variable>
4229
4331
  <fo:instream-foreign-object fox:alt-text="Math">
4332
+
4230
4333
  <!-- <xsl:copy-of select="."/> -->
4231
4334
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4232
4335
  </fo:instream-foreign-object>
@@ -4240,7 +4343,12 @@
4240
4343
  <!-- replace start and end spaces to non-break space -->
4241
4344
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4242
4345
  </xsl:copy>
4243
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4346
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4347
+ <xsl:copy>
4348
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4349
+ </xsl:copy>
4350
+ <mathml:mspace width="0.5ex"/>
4351
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4244
4352
  <xsl:variable name="target">
4245
4353
  <xsl:choose>
4246
4354
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4261,7 +4369,10 @@
4261
4369
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4262
4370
  <xsl:choose>
4263
4371
  <xsl:when test="normalize-space(.) = ''">
4264
- <xsl:value-of select="$target"/>
4372
+ <!-- <xsl:value-of select="$target"/> -->
4373
+ <xsl:call-template name="add-zero-spaces-link-java">
4374
+ <xsl:with-param name="text" select="$target"/>
4375
+ </xsl:call-template>
4265
4376
  </xsl:when>
4266
4377
  <xsl:otherwise>
4267
4378
  <xsl:apply-templates/>
@@ -4271,8 +4382,6 @@
4271
4382
  </xsl:otherwise>
4272
4383
  </xsl:choose>
4273
4384
  </fo:inline>
4274
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4275
- <fo:inline id="{@id}"/>
4276
4385
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4277
4386
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4278
4387
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4467,7 +4576,7 @@
4467
4576
  </xsl:if> -->
4468
4577
  </fo:inline>
4469
4578
  </xsl:if>
4470
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4579
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4471
4580
  <fo:block-container id="{@id}">
4472
4581
 
4473
4582
  <fo:block>
@@ -4483,6 +4592,7 @@
4483
4592
  <fo:block id="{@id}">
4484
4593
  <xsl:apply-templates/>
4485
4594
  </fo:block>
4595
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4486
4596
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4487
4597
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4488
4598
  <xsl:apply-templates/>
@@ -4705,6 +4815,12 @@
4705
4815
  <!-- <xsl:text> </xsl:text> -->
4706
4816
  </xsl:template><xsl:template name="getSection">
4707
4817
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4818
+ <!--
4819
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
4820
+ <xsl:value-of select="."/>
4821
+ </xsl:for-each>
4822
+ -->
4823
+
4708
4824
  </xsl:template><xsl:template name="getName">
4709
4825
  <xsl:choose>
4710
4826
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4757,6 +4873,12 @@
4757
4873
  <xsl:copy>
4758
4874
  <xsl:apply-templates mode="contents_item"/>
4759
4875
  </xsl:copy>
4876
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
4877
+ <xsl:copy>
4878
+ <xsl:apply-templates mode="contents_item"/>
4879
+ </xsl:copy>
4880
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
4881
+ <xsl:copy-of select="."/>
4760
4882
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4761
4883
  <xsl:text> </xsl:text>
4762
4884
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4782,6 +4904,7 @@
4782
4904
 
4783
4905
 
4784
4906
 
4907
+
4785
4908
 
4786
4909
 
4787
4910
  10
@@ -5086,10 +5209,11 @@
5086
5209
  </xsl:choose>
5087
5210
 
5088
5211
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5089
-
5212
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5090
5213
  <xsl:variable name="element">
5091
5214
  block
5092
5215
 
5216
+
5093
5217
  </xsl:variable>
5094
5218
  <xsl:choose>
5095
5219
  <xsl:when test="normalize-space($element) = 'block'">
@@ -5151,11 +5275,13 @@
5151
5275
  </xsl:if>
5152
5276
  </xsl:if>
5153
5277
 
5278
+
5154
5279
  <fo:block-container margin-left="0mm">
5155
5280
 
5156
5281
  <fo:block xsl:use-attribute-sets="quote-style">
5157
5282
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5158
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5283
+
5284
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5159
5285
  </fo:block>
5160
5286
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5161
5287
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5178,31 +5304,49 @@
5178
5304
  <xsl:text>— </xsl:text>
5179
5305
  <xsl:apply-templates/>
5180
5306
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5181
- <fo:inline xsl:use-attribute-sets="eref-style">
5182
- <xsl:if test="@type = 'footnote'">
5183
-
5184
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5185
- <xsl:attribute name="font-size">80%</xsl:attribute>
5186
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5187
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5188
-
5189
-
5190
- </xsl:if>
5191
-
5192
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5193
-
5194
- <xsl:if test="@type = 'inline'">
5195
-
5196
-
5197
-
5198
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
5199
-
5200
- </xsl:if>
5201
-
5202
-
5203
- <xsl:apply-templates/>
5204
- </fo:basic-link>
5205
- </fo:inline>
5307
+
5308
+ <xsl:variable name="bibitemid">
5309
+ <xsl:choose>
5310
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5311
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5312
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5313
+ </xsl:choose>
5314
+ </xsl:variable>
5315
+
5316
+ <xsl:choose>
5317
+ <xsl:when test="normalize-space($bibitemid) != ''">
5318
+ <fo:inline xsl:use-attribute-sets="eref-style">
5319
+ <xsl:if test="@type = 'footnote'">
5320
+
5321
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5322
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5323
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5324
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5325
+
5326
+
5327
+ </xsl:if>
5328
+
5329
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5330
+ <xsl:if test="normalize-space(@citeas) = ''">
5331
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5332
+ </xsl:if>
5333
+ <xsl:if test="@type = 'inline'">
5334
+
5335
+
5336
+
5337
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
5338
+
5339
+ </xsl:if>
5340
+
5341
+ <xsl:apply-templates/>
5342
+ </fo:basic-link>
5343
+
5344
+ </fo:inline>
5345
+ </xsl:when>
5346
+ <xsl:otherwise>
5347
+ <fo:inline><xsl:apply-templates/></fo:inline>
5348
+ </xsl:otherwise>
5349
+ </xsl:choose>
5206
5350
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5207
5351
  <!-- zero-space char -->
5208
5352
  <xsl:variable name="depth">
@@ -5309,6 +5453,7 @@
5309
5453
 
5310
5454
 
5311
5455
 
5456
+
5312
5457
 
5313
5458
 
5314
5459
 
@@ -5324,7 +5469,7 @@
5324
5469
  </xsl:if>
5325
5470
 
5326
5471
 
5327
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5472
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5328
5473
  <fo:block break-after="page"/>
5329
5474
  <fo:block>
5330
5475
  <xsl:call-template name="setId"/>
@@ -5332,7 +5477,8 @@
5332
5477
  </fo:block>
5333
5478
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5334
5479
  <fo:block>
5335
- <xsl:call-template name="setId"/>
5480
+ <xsl:call-template name="setId"/>
5481
+
5336
5482
 
5337
5483
  <xsl:apply-templates/>
5338
5484
  </fo:block>
@@ -5385,6 +5531,153 @@
5385
5531
  </fo:block>
5386
5532
  </xsl:otherwise>
5387
5533
  </xsl:choose>
5534
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5535
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5536
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5537
+ </xsl:for-each>
5538
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5539
+ <xsl:copy>
5540
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5541
+ </xsl:copy>
5542
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5543
+ <xsl:variable name="id">
5544
+ <xsl:call-template name="generateIndexXrefId"/>
5545
+ </xsl:variable>
5546
+ <xsl:copy> <!-- add id to xref -->
5547
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5548
+ <xsl:attribute name="id">
5549
+ <xsl:value-of select="$id"/>
5550
+ </xsl:attribute>
5551
+ <xsl:apply-templates mode="index_add_id"/>
5552
+ </xsl:copy>
5553
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5554
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5555
+ <xsl:if test="@to">
5556
+ <xsl:value-of select="$dash"/>
5557
+ <xsl:copy>
5558
+ <xsl:copy-of select="@*"/>
5559
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5560
+ <xsl:attribute name="id">
5561
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5562
+ </xsl:attribute>
5563
+ <xsl:apply-templates mode="index_add_id"/>
5564
+ </xsl:copy>
5565
+ </xsl:if>
5566
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5567
+ <xsl:copy>
5568
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5569
+ </xsl:copy>
5570
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
5571
+ <xsl:copy>
5572
+ <xsl:apply-templates select="@*" mode="index_update"/>
5573
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
5574
+ </xsl:copy>
5575
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
5576
+ <xsl:param name="element"/>
5577
+ <xsl:param name="remove" select="'false'"/>
5578
+ <xsl:param name="target"/>
5579
+ <!-- <node></node> -->
5580
+ <xsl:choose>
5581
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5582
+ <!-- skip text (i.e. remove it) and process next element -->
5583
+ <!-- [removed_<xsl:value-of select="."/>] -->
5584
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5585
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
5586
+ </xsl:apply-templates>
5587
+ </xsl:when>
5588
+ <xsl:when test="self::text()">
5589
+ <xsl:value-of select="."/>
5590
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5591
+ </xsl:when>
5592
+ <xsl:when test="self::* and local-name(.) = 'xref'">
5593
+ <xsl:variable name="id" select="@id"/>
5594
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
5595
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
5596
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
5597
+
5598
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
5599
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
5600
+
5601
+ <xsl:choose>
5602
+ <!-- 2nd pass -->
5603
+ <!-- if page is equal to page for next and page is not the end of range -->
5604
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
5605
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
5606
+ <!-- [removed_xref] -->
5607
+
5608
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5609
+ <xsl:with-param name="remove">true</xsl:with-param>
5610
+ <xsl:with-param name="target">
5611
+ <xsl:choose>
5612
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
5613
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
5614
+ </xsl:choose>
5615
+ </xsl:with-param>
5616
+ </xsl:apply-templates>
5617
+ </xsl:when>
5618
+
5619
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
5620
+ <!-- remove xref -->
5621
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5622
+ <xsl:with-param name="remove">true</xsl:with-param>
5623
+ </xsl:apply-templates>
5624
+ </xsl:when>
5625
+
5626
+ <xsl:otherwise>
5627
+ <xsl:apply-templates select="." mode="xref_copy">
5628
+ <xsl:with-param name="target" select="$target"/>
5629
+ </xsl:apply-templates>
5630
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5631
+ </xsl:otherwise>
5632
+ </xsl:choose>
5633
+ </xsl:when>
5634
+ <xsl:when test="self::* and local-name(.) = 'ul'">
5635
+ <!-- ul -->
5636
+ <xsl:apply-templates select="." mode="index_update"/>
5637
+ </xsl:when>
5638
+ <xsl:otherwise>
5639
+ <xsl:apply-templates select="." mode="xref_copy">
5640
+ <xsl:with-param name="target" select="$target"/>
5641
+ </xsl:apply-templates>
5642
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5643
+ </xsl:otherwise>
5644
+ </xsl:choose>
5645
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
5646
+ <xsl:param name="target"/>
5647
+ <xsl:copy>
5648
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
5649
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
5650
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
5651
+ </xsl:if>
5652
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
5653
+ </xsl:copy>
5654
+ </xsl:template><xsl:template name="generateIndexXrefId">
5655
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5656
+
5657
+ <xsl:variable name="docid">
5658
+ <xsl:call-template name="getDocumentId"/>
5659
+ </xsl:variable>
5660
+ <xsl:variable name="item_number">
5661
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
5662
+ </xsl:variable>
5663
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5664
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5665
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5666
+ <xsl:apply-templates/>
5667
+ <fo:block>
5668
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5669
+ <fo:block> </fo:block>
5670
+ </xsl:if>
5671
+ </fo:block>
5672
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5673
+ <xsl:apply-templates/>
5674
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5675
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5676
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5677
+ <xsl:apply-templates/>
5678
+ </fo:block>
5679
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5680
+ <fo:inline id="{@id}" font-size="1pt"/>
5388
5681
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5389
5682
  <!-- <row>
5390
5683
  <date>05-07-2013</date>
@@ -5508,6 +5801,57 @@
5508
5801
  </xsl:variable>
5509
5802
  <xsl:variable name="result">
5510
5803
  <xsl:choose>
5804
+ <xsl:when test="$format = 'ddMMyyyy'">
5805
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5806
+ <xsl:text> </xsl:text>
5807
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5808
+ </xsl:when>
5809
+ <xsl:when test="$format = 'ddMM'">
5810
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5811
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5812
+ </xsl:when>
5813
+ <xsl:when test="$format = 'short' or $day = ''">
5814
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5815
+ </xsl:when>
5816
+ <xsl:otherwise>
5817
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5818
+ </xsl:otherwise>
5819
+ </xsl:choose>
5820
+ </xsl:variable>
5821
+ <xsl:value-of select="$result"/>
5822
+ </xsl:template><xsl:template name="convertDateLocalized">
5823
+ <xsl:param name="date"/>
5824
+ <xsl:param name="format" select="'short'"/>
5825
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5826
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5827
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5828
+ <xsl:variable name="monthStr">
5829
+ <xsl:choose>
5830
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
5831
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
5832
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
5833
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
5834
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
5835
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
5836
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
5837
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
5838
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
5839
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
5840
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
5841
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
5842
+ </xsl:choose>
5843
+ </xsl:variable>
5844
+ <xsl:variable name="result">
5845
+ <xsl:choose>
5846
+ <xsl:when test="$format = 'ddMMyyyy'">
5847
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5848
+ <xsl:text> </xsl:text>
5849
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5850
+ </xsl:when>
5851
+ <xsl:when test="$format = 'ddMM'">
5852
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5853
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5854
+ </xsl:when>
5511
5855
  <xsl:when test="$format = 'short' or $day = ''">
5512
5856
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5513
5857
  </xsl:when>
@@ -5523,7 +5867,7 @@
5523
5867
  <xsl:param name="charDelim" select="', '"/>
5524
5868
  <xsl:choose>
5525
5869
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5526
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5870
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5527
5871
  <xsl:sort data-type="text" order="ascending"/>
5528
5872
  <xsl:call-template name="insertKeyword">
5529
5873
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5532,7 +5876,7 @@
5532
5876
  </xsl:for-each>
5533
5877
  </xsl:when>
5534
5878
  <xsl:otherwise>
5535
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5879
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5536
5880
  <xsl:call-template name="insertKeyword">
5537
5881
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5538
5882
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5549,68 +5893,71 @@
5549
5893
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5550
5894
  </xsl:choose>
5551
5895
  </xsl:template><xsl:template name="addPDFUAmeta">
5552
- <fo:declarations>
5553
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5554
- <pdf:dictionary type="normal" key="ViewerPreferences">
5555
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5556
- </pdf:dictionary>
5557
- </pdf:catalog>
5558
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5559
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5560
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5561
- <!-- Dublin Core properties go here -->
5562
- <dc:title>
5563
- <xsl:variable name="title">
5896
+ <xsl:variable name="lang">
5897
+ <xsl:call-template name="getLang"/>
5898
+ </xsl:variable>
5899
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5900
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5901
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5902
+ </pdf:dictionary>
5903
+ </pdf:catalog>
5904
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5905
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5906
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5907
+ <!-- Dublin Core properties go here -->
5908
+ <dc:title>
5909
+ <xsl:variable name="title">
5910
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5911
+
5912
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5564
5913
 
5565
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5566
5914
 
5567
5915
 
5568
5916
 
5569
5917
 
5570
5918
 
5571
- </xsl:variable>
5572
- <xsl:choose>
5573
- <xsl:when test="normalize-space($title) != ''">
5574
- <xsl:value-of select="$title"/>
5575
- </xsl:when>
5576
- <xsl:otherwise>
5577
- <xsl:text> </xsl:text>
5578
- </xsl:otherwise>
5579
- </xsl:choose>
5580
- </dc:title>
5581
- <dc:creator>
5919
+ </xsl:for-each>
5920
+ </xsl:variable>
5921
+ <xsl:choose>
5922
+ <xsl:when test="normalize-space($title) != ''">
5923
+ <xsl:value-of select="$title"/>
5924
+ </xsl:when>
5925
+ <xsl:otherwise>
5926
+ <xsl:text> </xsl:text>
5927
+ </xsl:otherwise>
5928
+ </xsl:choose>
5929
+ </dc:title>
5930
+ <dc:creator>
5931
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5582
5932
 
5583
5933
 
5584
5934
 
5585
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5935
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5586
5936
  <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5587
5937
  <xsl:if test="position() != last()">; </xsl:if>
5588
5938
  </xsl:for-each>
5589
5939
 
5590
- </dc:creator>
5591
- <dc:description>
5592
- <xsl:variable name="abstract">
5593
-
5594
-
5595
-
5596
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5597
-
5598
-
5599
-
5600
- </xsl:variable>
5601
- <xsl:value-of select="normalize-space($abstract)"/>
5602
- </dc:description>
5603
- <pdf:Keywords>
5604
- <xsl:call-template name="insertKeywords"/>
5605
- </pdf:Keywords>
5606
- </rdf:Description>
5607
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5608
- <!-- XMP properties go here -->
5609
- <xmp:CreatorTool/>
5610
- </rdf:Description>
5611
- </rdf:RDF>
5612
- </x:xmpmeta>
5613
- </fo:declarations>
5940
+ </xsl:for-each>
5941
+ </dc:creator>
5942
+ <dc:description>
5943
+ <xsl:variable name="abstract">
5944
+
5945
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5946
+
5947
+
5948
+ </xsl:variable>
5949
+ <xsl:value-of select="normalize-space($abstract)"/>
5950
+ </dc:description>
5951
+ <pdf:Keywords>
5952
+ <xsl:call-template name="insertKeywords"/>
5953
+ </pdf:Keywords>
5954
+ </rdf:Description>
5955
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5956
+ <!-- XMP properties go here -->
5957
+ <xmp:CreatorTool/>
5958
+ </rdf:Description>
5959
+ </rdf:RDF>
5960
+ </x:xmpmeta>
5614
5961
  </xsl:template><xsl:template name="getId">
5615
5962
  <xsl:choose>
5616
5963
  <xsl:when test="../@id">
@@ -5707,6 +6054,7 @@
5707
6054
 
5708
6055
 
5709
6056
 
6057
+
5710
6058
  </xsl:variable>
5711
6059
  <xsl:if test="$documentNS != $XSLNS">
5712
6060
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>