metanorma-nist 1.2.14 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,9 @@
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)"/>
10
+ <xsl:param name="basepath"/>
9
11
 
10
12
 
11
13
 
@@ -86,7 +88,9 @@
86
88
  </fo:simple-page-master>
87
89
  </fo:layout-master-set>
88
90
 
89
- <xsl:call-template name="addPDFUAmeta"/>
91
+ <fo:declarations>
92
+ <xsl:call-template name="addPDFUAmeta"/>
93
+ </fo:declarations>
90
94
 
91
95
  <xsl:call-template name="addBookmarks">
92
96
  <xsl:with-param name="contents" select="$contents"/>
@@ -1470,7 +1474,7 @@
1470
1474
  </fo:block>
1471
1475
  </xsl:when>
1472
1476
  <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">
1477
+ <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
1478
  <xsl:apply-templates/>
1475
1479
  </fo:block>
1476
1480
  </xsl:when>
@@ -1545,6 +1549,7 @@
1545
1549
  <fo:list-block>
1546
1550
  <xsl:attribute name="space-after">
1547
1551
  <xsl:choose>
1552
+ <xsl:when test="ancestor::nist:figure and not(following-sibling::*)">0pt</xsl:when>
1548
1553
  <xsl:when test="$margin != ''"><xsl:value-of select="$margin"/></xsl:when>
1549
1554
  <xsl:otherwise>12pt</xsl:otherwise>
1550
1555
  </xsl:choose>
@@ -1681,7 +1686,8 @@
1681
1686
  <fo:table-body>
1682
1687
  <fo:table-row>
1683
1688
  <fo:table-cell>
1684
- <fo:block text-align="left" margin-left="7mm">
1689
+ <!-- <fo:block text-align="left" margin-left="7mm"> -->
1690
+ <fo:block text-align="center" margin-left="7mm">
1685
1691
  <xsl:apply-templates/>
1686
1692
  </fo:block>
1687
1693
  </fo:table-cell>
@@ -1794,6 +1800,10 @@
1794
1800
  </fo:block>
1795
1801
  </xsl:template>
1796
1802
 
1803
+ <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">
1804
+ <fo:inline><xsl:apply-templates/></fo:inline>
1805
+ </xsl:template>
1806
+
1797
1807
  <xsl:template match="nist:dd//nist:stem[count(ancestor::nist:dd/nist:p) = 1 and normalize-space(ancestor::nist:dd/nist:p/text()) = '']">
1798
1808
  <fo:block text-align="center">
1799
1809
  <xsl:apply-templates/>
@@ -1806,6 +1816,37 @@
1806
1816
  </fo:block>
1807
1817
  </xsl:template>
1808
1818
 
1819
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']" priority="2">
1820
+ <fo:block-container id="{@id}" border="1pt solid black" background-color="rgb(230, 230, 230)" padding="1.5mm" space-before="6pt" space-after="6pt">
1821
+ <xsl:apply-templates/>
1822
+ </fo:block-container>
1823
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
1824
+ </xsl:template>
1825
+
1826
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name()='dl']" priority="2">
1827
+ <fo:block-container id="{@id}">
1828
+ <xsl:apply-templates/>
1829
+ </fo:block-container>
1830
+ </xsl:template>
1831
+
1832
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name()='dt']" priority="2">
1833
+ <fo:block>
1834
+ <xsl:if test="following-sibling::*[local-name()='dt'] or ancestor::*[local-name()='dd']/following-sibling::*[local-name()='dt']">
1835
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1836
+ </xsl:if>
1837
+ <xsl:if test="preceding-sibling::*[local-name()='dt'] or ancestor::*[local-name()='dd']/preceding-sibling::*[local-name()='dt']">
1838
+ <xsl:attribute name="margin-top">2pt</xsl:attribute>
1839
+ </xsl:if>
1840
+ <xsl:apply-templates/>
1841
+ <fo:inline>: </fo:inline>
1842
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
1843
+ </fo:block>
1844
+ </xsl:template>
1845
+
1846
+ <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name()='dd']/*[local-name()='p']" priority="2">
1847
+ <fo:inline><xsl:apply-templates/></fo:inline>
1848
+ </xsl:template>
1849
+
1809
1850
  <!-- <xsl:template match="nist:dl[@type = 'glossary']" priority="2">
1810
1851
  <xsl:apply-templates />
1811
1852
  </xsl:template>
@@ -2206,6 +2247,9 @@
2206
2247
  <title-continued lang="en">(continued)</title-continued>
2207
2248
  <title-continued lang="fr">(continué)</title-continued>
2208
2249
 
2250
+ </xsl:variable><xsl:variable name="bibdata">
2251
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2252
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2209
2253
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2210
2254
  <xsl:param name="name"/>
2211
2255
  <xsl:param name="lang"/>
@@ -2231,10 +2275,12 @@
2231
2275
  </xsl:choose>
2232
2276
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
2233
2277
 
2278
+
2234
2279
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2235
2280
 
2236
2281
 
2237
2282
 
2283
+
2238
2284
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2239
2285
  <xsl:attribute name="white-space">pre</xsl:attribute>
2240
2286
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2347,6 +2393,7 @@
2347
2393
 
2348
2394
 
2349
2395
 
2396
+
2350
2397
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2351
2398
 
2352
2399
 
@@ -2354,6 +2401,7 @@
2354
2401
 
2355
2402
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2356
2403
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2404
+
2357
2405
 
2358
2406
 
2359
2407
 
@@ -2383,6 +2431,7 @@
2383
2431
  </xsl:attribute-set><xsl:attribute-set name="xref-style">
2384
2432
 
2385
2433
 
2434
+
2386
2435
  <xsl:attribute name="color">blue</xsl:attribute>
2387
2436
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2388
2437
 
@@ -2398,6 +2447,7 @@
2398
2447
 
2399
2448
 
2400
2449
 
2450
+
2401
2451
 
2402
2452
 
2403
2453
 
@@ -2425,6 +2475,7 @@
2425
2475
 
2426
2476
 
2427
2477
 
2478
+
2428
2479
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
2429
2480
 
2430
2481
 
@@ -2443,11 +2494,13 @@
2443
2494
 
2444
2495
 
2445
2496
 
2497
+
2446
2498
 
2447
2499
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
2448
2500
 
2449
2501
 
2450
2502
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2503
+
2451
2504
 
2452
2505
 
2453
2506
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
@@ -2468,6 +2521,7 @@
2468
2521
 
2469
2522
 
2470
2523
 
2524
+
2471
2525
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2472
2526
 
2473
2527
 
@@ -2476,6 +2530,7 @@
2476
2530
 
2477
2531
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2478
2532
 
2533
+
2479
2534
 
2480
2535
 
2481
2536
 
@@ -2508,6 +2563,7 @@
2508
2563
 
2509
2564
 
2510
2565
 
2566
+
2511
2567
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2512
2568
 
2513
2569
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
@@ -2515,6 +2571,7 @@
2515
2571
 
2516
2572
 
2517
2573
 
2574
+
2518
2575
  <xsl:attribute name="width">75%</xsl:attribute>
2519
2576
  <xsl:attribute name="content-height">100%</xsl:attribute>
2520
2577
  <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
@@ -2536,13 +2593,32 @@
2536
2593
 
2537
2594
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2538
2595
 
2539
-
2596
+
2540
2597
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2541
2598
 
2542
2599
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2543
2600
 
2544
2601
 
2545
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2602
+
2603
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2604
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2605
+ </xsl:variable><xsl:attribute-set name="add-style">
2606
+ <xsl:attribute name="color">red</xsl:attribute>
2607
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2608
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2609
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2610
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2611
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2612
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2613
+ <xsl:text>red</xsl:text>
2614
+ </xsl:variable><xsl:attribute-set name="del-style">
2615
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2616
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2617
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2618
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2619
+
2620
+
2621
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2546
2622
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2547
2623
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2548
2624
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2587,16 +2663,17 @@
2587
2663
  <xsl:call-template name="add-zero-spaces-java"/>
2588
2664
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2589
2665
 
2666
+ <xsl:variable name="table-preamble">
2667
+
2668
+
2669
+ </xsl:variable>
2670
+
2590
2671
  <xsl:variable name="table">
2591
2672
 
2592
2673
  <xsl:variable name="simple-table">
2593
2674
  <xsl:call-template name="getSimpleTable"/>
2594
2675
  </xsl:variable>
2595
2676
 
2596
-
2597
-
2598
-
2599
-
2600
2677
  <!-- <xsl:if test="$namespace = 'bipm'">
2601
2678
  <fo:block>&#xA0;</fo:block>
2602
2679
  </xsl:if> -->
@@ -2609,7 +2686,7 @@
2609
2686
 
2610
2687
 
2611
2688
 
2612
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2689
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2613
2690
 
2614
2691
  <!-- <xsl:variable name="cols-count">
2615
2692
  <xsl:choose>
@@ -2628,8 +2705,6 @@
2628
2705
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2629
2706
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2630
2707
 
2631
-
2632
-
2633
2708
  <xsl:variable name="colwidths">
2634
2709
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2635
2710
  <xsl:call-template name="calculate-column-widths">
@@ -2657,9 +2732,11 @@
2657
2732
  </xsl:choose>
2658
2733
  </xsl:variable>
2659
2734
 
2735
+
2660
2736
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2661
2737
 
2662
2738
 
2739
+
2663
2740
  <xsl:attribute name="space-after">6pt</xsl:attribute>
2664
2741
 
2665
2742
 
@@ -2684,6 +2761,8 @@
2684
2761
 
2685
2762
 
2686
2763
 
2764
+
2765
+
2687
2766
  <xsl:variable name="table_width">
2688
2767
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2689
2768
  100%
@@ -2700,6 +2779,8 @@
2700
2779
 
2701
2780
 
2702
2781
 
2782
+
2783
+
2703
2784
 
2704
2785
 
2705
2786
 
@@ -2789,7 +2870,8 @@
2789
2870
  </fo:block-container>
2790
2871
  </xsl:variable>
2791
2872
 
2792
-
2873
+ <xsl:variable name="isAdded" select="@added"/>
2874
+ <xsl:variable name="isDeleted" select="@deleted"/>
2793
2875
 
2794
2876
  <xsl:choose>
2795
2877
  <xsl:when test="@width">
@@ -2803,7 +2885,14 @@
2803
2885
  <fo:table-body>
2804
2886
  <fo:table-row>
2805
2887
  <fo:table-cell column-number="2">
2806
- <fo:block><xsl:copy-of select="$table"/></fo:block>
2888
+ <xsl:copy-of select="$table-preamble"/>
2889
+ <fo:block>
2890
+ <xsl:call-template name="setTrackChangesStyles">
2891
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2892
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2893
+ </xsl:call-template>
2894
+ <xsl:copy-of select="$table"/>
2895
+ </fo:block>
2807
2896
  </fo:table-cell>
2808
2897
  </fo:table-row>
2809
2898
  </fo:table-body>
@@ -2814,16 +2903,42 @@
2814
2903
 
2815
2904
  </xsl:when>
2816
2905
  <xsl:otherwise>
2817
- <xsl:copy-of select="$table"/>
2906
+ <xsl:choose>
2907
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2908
+ <xsl:copy-of select="$table-preamble"/>
2909
+ <fo:block>
2910
+ <xsl:call-template name="setTrackChangesStyles">
2911
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2912
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2913
+ </xsl:call-template>
2914
+ <xsl:copy-of select="$table"/>
2915
+ </fo:block>
2916
+ </xsl:when>
2917
+ <xsl:otherwise>
2918
+ <xsl:copy-of select="$table-preamble"/>
2919
+ <xsl:copy-of select="$table"/>
2920
+ </xsl:otherwise>
2921
+ </xsl:choose>
2818
2922
  </xsl:otherwise>
2819
2923
  </xsl:choose>
2820
2924
 
2821
2925
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2926
+ <xsl:param name="continued"/>
2822
2927
  <xsl:if test="normalize-space() != ''">
2823
2928
  <fo:block xsl:use-attribute-sets="table-name-style">
2824
2929
 
2825
2930
 
2826
- <xsl:apply-templates/>
2931
+ <xsl:choose>
2932
+ <xsl:when test="$continued = 'true'">
2933
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
2934
+
2935
+ </xsl:when>
2936
+ <xsl:otherwise>
2937
+ <xsl:apply-templates/>
2938
+ </xsl:otherwise>
2939
+ </xsl:choose>
2940
+
2941
+
2827
2942
  </fo:block>
2828
2943
  </xsl:if>
2829
2944
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -2875,7 +2990,7 @@
2875
2990
  </xsl:for-each>
2876
2991
  </xsl:when>
2877
2992
  <xsl:otherwise>
2878
- <xsl:for-each select="xalan:nodeset($table)//tr">
2993
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2879
2994
  <xsl:variable name="td_text">
2880
2995
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2881
2996
 
@@ -2945,7 +3060,15 @@
2945
3060
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2946
3061
  <xsl:value-of select="@target"/>
2947
3062
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2948
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3063
+ <xsl:variable name="mathml">
3064
+ <xsl:for-each select="*">
3065
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3066
+ <xsl:copy-of select="."/>
3067
+ </xsl:if>
3068
+ </xsl:for-each>
3069
+ </xsl:variable>
3070
+
3071
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2949
3072
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2950
3073
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2951
3074
  <xsl:param name="cols-count"/>
@@ -2955,18 +3078,18 @@
2955
3078
  <xsl:apply-templates/>
2956
3079
  </fo:table-header>
2957
3080
  </xsl:template><xsl:template name="table-header-title">
2958
- <xsl:param name="cols-count"/>
3081
+ <xsl:param name="cols-count"/>
2959
3082
  <!-- row for title -->
2960
3083
  <fo:table-row>
2961
3084
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
2962
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3085
+
3086
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3087
+ <xsl:with-param name="continued">true</xsl:with-param>
3088
+ </xsl:apply-templates>
2963
3089
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2964
3090
  <xsl:call-template name="fn_name_display"/>
2965
- </xsl:for-each>
2966
- <fo:block text-align="right" font-style="italic">
2967
- <xsl:text> </xsl:text>
2968
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
2969
- </fo:block>
3091
+ </xsl:for-each>
3092
+
2970
3093
  </fo:table-cell>
2971
3094
  </fo:table-row>
2972
3095
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3190,6 +3313,7 @@
3190
3313
 
3191
3314
 
3192
3315
 
3316
+
3193
3317
  </xsl:if>
3194
3318
  <xsl:if test="$parent-name = 'tfoot'">
3195
3319
 
@@ -3210,7 +3334,8 @@
3210
3334
  <xsl:attribute name="text-align">
3211
3335
  <xsl:choose>
3212
3336
  <xsl:when test="@align">
3213
- <xsl:value-of select="@align"/>
3337
+ <xsl:call-template name="setAlignment"/>
3338
+ <!-- <xsl:value-of select="@align"/> -->
3214
3339
  </xsl:when>
3215
3340
  <xsl:otherwise>center</xsl:otherwise>
3216
3341
  </xsl:choose>
@@ -3219,6 +3344,7 @@
3219
3344
 
3220
3345
 
3221
3346
 
3347
+
3222
3348
  <xsl:attribute name="text-align">center</xsl:attribute>
3223
3349
  <xsl:attribute name="background-color">black</xsl:attribute>
3224
3350
  <xsl:attribute name="color">white</xsl:attribute>
@@ -3230,6 +3356,9 @@
3230
3356
 
3231
3357
 
3232
3358
 
3359
+ <xsl:if test="$lang = 'ar'">
3360
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3361
+ </xsl:if>
3233
3362
  <xsl:if test="@colspan">
3234
3363
  <xsl:attribute name="number-columns-spanned">
3235
3364
  <xsl:value-of select="@colspan"/>
@@ -3261,11 +3390,16 @@
3261
3390
  <xsl:attribute name="text-align">
3262
3391
  <xsl:choose>
3263
3392
  <xsl:when test="@align">
3264
- <xsl:value-of select="@align"/>
3393
+ <xsl:call-template name="setAlignment"/>
3394
+ <!-- <xsl:value-of select="@align"/> -->
3265
3395
  </xsl:when>
3266
3396
  <xsl:otherwise>left</xsl:otherwise>
3267
3397
  </xsl:choose>
3268
3398
  </xsl:attribute>
3399
+ <xsl:if test="$lang = 'ar'">
3400
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3401
+ </xsl:if>
3402
+
3269
3403
 
3270
3404
 
3271
3405
 
@@ -3281,6 +3415,9 @@
3281
3415
  </xsl:if>
3282
3416
 
3283
3417
 
3418
+ <xsl:if test=".//*[local-name() = 'table']">
3419
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3420
+ </xsl:if>
3284
3421
  <xsl:if test="@colspan">
3285
3422
  <xsl:attribute name="number-columns-spanned">
3286
3423
  <xsl:value-of select="@colspan"/>
@@ -3412,13 +3549,13 @@
3412
3549
  </xsl:choose>
3413
3550
  </xsl:variable>
3414
3551
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3415
- <xsl:element name="{$ns}:table">
3552
+ <!-- <xsl:element name="{$ns}:table"> -->
3416
3553
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3417
3554
  <tbody>
3418
3555
  <xsl:apply-templates mode="dl"/>
3419
3556
  </tbody>
3420
3557
  </xsl:for-each>
3421
- </xsl:element>
3558
+ <!-- </xsl:element> -->
3422
3559
  </xsl:variable>
3423
3560
 
3424
3561
  <xsl:call-template name="calculate-column-widths">
@@ -3514,6 +3651,8 @@
3514
3651
  <xsl:apply-templates/>
3515
3652
  </fo:inline>
3516
3653
  </xsl:template><xsl:template match="*[local-name()='dl']">
3654
+ <xsl:variable name="isAdded" select="@added"/>
3655
+ <xsl:variable name="isDeleted" select="@deleted"/>
3517
3656
  <fo:block-container>
3518
3657
 
3519
3658
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3530,6 +3669,12 @@
3530
3669
  </xsl:attribute>
3531
3670
 
3532
3671
  </xsl:if>
3672
+
3673
+ <xsl:call-template name="setTrackChangesStyles">
3674
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3675
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3676
+ </xsl:call-template>
3677
+
3533
3678
  <fo:block-container>
3534
3679
 
3535
3680
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3645,11 +3790,11 @@
3645
3790
  </xsl:choose>
3646
3791
  </xsl:variable>
3647
3792
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3648
- <xsl:element name="{$ns}:table">
3793
+ <!-- <xsl:element name="{$ns}:table"> -->
3649
3794
  <tbody>
3650
3795
  <xsl:apply-templates mode="dl"/>
3651
3796
  </tbody>
3652
- </xsl:element>
3797
+ <!-- </xsl:element> -->
3653
3798
  </xsl:variable>
3654
3799
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3655
3800
  <xsl:variable name="colwidths">
@@ -3915,6 +4060,7 @@
3915
4060
 
3916
4061
 
3917
4062
 
4063
+
3918
4064
 
3919
4065
  </xsl:variable>
3920
4066
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3932,8 +4078,78 @@
3932
4078
  <fo:inline text-decoration="underline">
3933
4079
  <xsl:apply-templates/>
3934
4080
  </fo:inline>
4081
+ </xsl:template><xsl:template match="*[local-name()='add']">
4082
+ <xsl:choose>
4083
+ <xsl:when test="@amendment">
4084
+ <fo:inline>
4085
+ <xsl:call-template name="insertTag">
4086
+ <xsl:with-param name="kind">A</xsl:with-param>
4087
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4088
+ </xsl:call-template>
4089
+ <xsl:apply-templates/>
4090
+ <xsl:call-template name="insertTag">
4091
+ <xsl:with-param name="type">closing</xsl:with-param>
4092
+ <xsl:with-param name="kind">A</xsl:with-param>
4093
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4094
+ </xsl:call-template>
4095
+ </fo:inline>
4096
+ </xsl:when>
4097
+ <xsl:when test="@corrigenda">
4098
+ <fo:inline>
4099
+ <xsl:call-template name="insertTag">
4100
+ <xsl:with-param name="kind">C</xsl:with-param>
4101
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4102
+ </xsl:call-template>
4103
+ <xsl:apply-templates/>
4104
+ <xsl:call-template name="insertTag">
4105
+ <xsl:with-param name="type">closing</xsl:with-param>
4106
+ <xsl:with-param name="kind">C</xsl:with-param>
4107
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4108
+ </xsl:call-template>
4109
+ </fo:inline>
4110
+ </xsl:when>
4111
+ <xsl:otherwise>
4112
+ <fo:inline xsl:use-attribute-sets="add-style">
4113
+ <xsl:apply-templates/>
4114
+ </fo:inline>
4115
+ </xsl:otherwise>
4116
+ </xsl:choose>
4117
+
4118
+ </xsl:template><xsl:template name="insertTag">
4119
+ <xsl:param name="type"/>
4120
+ <xsl:param name="kind"/>
4121
+ <xsl:param name="value"/>
4122
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4123
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4124
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4125
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4126
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4127
+ <xsl:attribute name="height">5mm</xsl:attribute>
4128
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4129
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4130
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4131
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4132
+ <g>
4133
+ <xsl:if test="$type = 'closing'">
4134
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4135
+ </xsl:if>
4136
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4137
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4138
+ </g>
4139
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4140
+ <xsl:if test="$type = 'closing'">
4141
+ <xsl:attribute name="x">25</xsl:attribute>
4142
+ </xsl:if>
4143
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4144
+ </text>
4145
+ </svg>
4146
+ </fo:instream-foreign-object>
3935
4147
  </xsl:template><xsl:template match="*[local-name()='del']">
3936
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4148
+ <fo:inline xsl:use-attribute-sets="del-style">
4149
+ <xsl:apply-templates/>
4150
+ </fo:inline>
4151
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4152
+ <fo:inline background-color="yellow">
3937
4153
  <xsl:apply-templates/>
3938
4154
  </fo:inline>
3939
4155
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4226,11 +4442,15 @@
4226
4442
  </xsl:apply-templates>
4227
4443
  </xsl:template><xsl:template name="getLang">
4228
4444
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4445
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4229
4446
  <xsl:variable name="language">
4230
4447
  <xsl:choose>
4231
4448
  <xsl:when test="$language_current != ''">
4232
4449
  <xsl:value-of select="$language_current"/>
4233
4450
  </xsl:when>
4451
+ <xsl:when test="$language_current_2 != ''">
4452
+ <xsl:value-of select="$language_current_2"/>
4453
+ </xsl:when>
4234
4454
  <xsl:otherwise>
4235
4455
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4236
4456
  </xsl:otherwise>
@@ -4270,12 +4490,23 @@
4270
4490
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4271
4491
  <xsl:value-of select="substring($str, 2)"/>
4272
4492
  </xsl:template><xsl:template match="mathml:math">
4273
- <fo:inline font-family="STIX Two Math"> <!-- -->
4493
+ <xsl:variable name="isAdded" select="@added"/>
4494
+ <xsl:variable name="isDeleted" select="@deleted"/>
4495
+
4496
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4497
+
4498
+
4499
+ <xsl:call-template name="setTrackChangesStyles">
4500
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4501
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4502
+ </xsl:call-template>
4274
4503
 
4275
4504
  <xsl:variable name="mathml">
4276
4505
  <xsl:apply-templates select="." mode="mathml"/>
4277
4506
  </xsl:variable>
4278
4507
  <fo:instream-foreign-object fox:alt-text="Math">
4508
+
4509
+
4279
4510
  <!-- <xsl:copy-of select="."/> -->
4280
4511
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4281
4512
  </fo:instream-foreign-object>
@@ -4294,7 +4525,7 @@
4294
4525
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4295
4526
  </xsl:copy>
4296
4527
  <mathml:mspace width="0.5ex"/>
4297
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4528
+ </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">
4298
4529
  <xsl:variable name="target">
4299
4530
  <xsl:choose>
4300
4531
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4328,8 +4559,6 @@
4328
4559
  </xsl:otherwise>
4329
4560
  </xsl:choose>
4330
4561
  </fo:inline>
4331
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4332
- <fo:inline id="{@id}"/>
4333
4562
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4334
4563
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4335
4564
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4434,6 +4663,7 @@
4434
4663
 
4435
4664
 
4436
4665
  <fo:inline xsl:use-attribute-sets="note-name-style">
4666
+
4437
4667
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4438
4668
  </fo:inline>
4439
4669
  <xsl:apply-templates/>
@@ -4460,6 +4690,7 @@
4460
4690
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4461
4691
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4462
4692
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4693
+
4463
4694
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4464
4695
  </fo:inline>
4465
4696
  <xsl:apply-templates/>
@@ -4525,8 +4756,15 @@
4525
4756
  </fo:inline>
4526
4757
  </xsl:if>
4527
4758
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4759
+ <xsl:variable name="isAdded" select="@added"/>
4760
+ <xsl:variable name="isDeleted" select="@deleted"/>
4528
4761
  <fo:block-container id="{@id}">
4529
4762
 
4763
+ <xsl:call-template name="setTrackChangesStyles">
4764
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4765
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4766
+ </xsl:call-template>
4767
+
4530
4768
  <fo:block>
4531
4769
  <xsl:apply-templates/>
4532
4770
  </fo:block>
@@ -4534,48 +4772,137 @@
4534
4772
  <xsl:for-each select="*[local-name() = 'note']">
4535
4773
  <xsl:call-template name="note"/>
4536
4774
  </xsl:for-each>
4537
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4775
+
4776
+
4777
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4778
+
4538
4779
  </fo:block-container>
4539
4780
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
4540
4781
  <fo:block id="{@id}">
4541
4782
  <xsl:apply-templates/>
4542
4783
  </fo:block>
4784
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4543
4785
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4544
4786
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4545
4787
  <xsl:apply-templates/>
4546
4788
  </fo:block>
4547
4789
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4548
- <fo:block xsl:use-attribute-sets="image-style">
4549
-
4550
-
4551
- <xsl:variable name="src">
4552
- <xsl:choose>
4553
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4554
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4555
- </xsl:when>
4556
- <xsl:otherwise>
4557
- <xsl:value-of select="@src"/>
4558
- </xsl:otherwise>
4559
- </xsl:choose>
4560
- </xsl:variable>
4561
-
4562
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4563
- </fo:block>
4790
+ <xsl:variable name="isAdded" select="../@added"/>
4791
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4792
+ <xsl:choose>
4793
+ <xsl:when test="ancestor::*[local-name() = 'title']">
4794
+ <fo:inline padding-left="1mm" padding-right="1mm">
4795
+ <xsl:variable name="src">
4796
+ <xsl:call-template name="image_src"/>
4797
+ </xsl:variable>
4798
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
4799
+ </fo:inline>
4800
+ </xsl:when>
4801
+ <xsl:otherwise>
4802
+ <fo:block xsl:use-attribute-sets="image-style">
4803
+
4804
+ <xsl:variable name="src">
4805
+ <xsl:call-template name="image_src"/>
4806
+ </xsl:variable>
4807
+
4808
+ <xsl:choose>
4809
+ <xsl:when test="$isDeleted = 'true'">
4810
+ <!-- enclose in svg -->
4811
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4812
+ <xsl:attribute name="width">100%</xsl:attribute>
4813
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4814
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4815
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4816
+
4817
+
4818
+ <xsl:apply-templates select="." mode="cross_image"/>
4819
+
4820
+ </fo:instream-foreign-object>
4821
+ </xsl:when>
4822
+ <xsl:otherwise>
4823
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4824
+ </xsl:otherwise>
4825
+ </xsl:choose>
4826
+
4827
+ </fo:block>
4828
+ </xsl:otherwise>
4829
+ </xsl:choose>
4830
+ </xsl:template><xsl:template name="image_src">
4831
+ <xsl:choose>
4832
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4833
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4834
+ </xsl:when>
4835
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4836
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4837
+ </xsl:when>
4838
+ <xsl:otherwise>
4839
+ <xsl:value-of select="@src"/>
4840
+ </xsl:otherwise>
4841
+ </xsl:choose>
4842
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4843
+ <xsl:choose>
4844
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4845
+ <xsl:variable name="src">
4846
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4847
+ </xsl:variable>
4848
+ <xsl:variable name="width" select="document($src)/@width"/>
4849
+ <xsl:variable name="height" select="document($src)/@height"/>
4850
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4851
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4852
+ </svg>
4853
+ </xsl:when>
4854
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4855
+ <xsl:variable name="src">
4856
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4857
+ </xsl:variable>
4858
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4859
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4860
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4861
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4862
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4863
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4864
+ </svg>
4865
+ </xsl:when>
4866
+ <xsl:otherwise>
4867
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4868
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4869
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4870
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4871
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4872
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4873
+ <!-- width=<xsl:value-of select="$width"/> -->
4874
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4875
+ <!-- height=<xsl:value-of select="$height"/> -->
4876
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
4877
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4878
+ <xsl:call-template name="svg_cross">
4879
+ <xsl:with-param name="width" select="$width"/>
4880
+ <xsl:with-param name="height" select="$height"/>
4881
+ </xsl:call-template>
4882
+ </svg>
4883
+ </xsl:otherwise>
4884
+ </xsl:choose>
4885
+
4886
+ </xsl:template><xsl:template name="svg_cross">
4887
+ <xsl:param name="width"/>
4888
+ <xsl:param name="height"/>
4889
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4890
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4564
4891
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4565
4892
  <xsl:apply-templates mode="contents"/>
4566
4893
  <xsl:text> </xsl:text>
4567
4894
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
4568
4895
  <xsl:apply-templates mode="bookmarks"/>
4569
4896
  <xsl:text> </xsl:text>
4570
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
4897
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
4571
4898
  <xsl:value-of select="."/>
4572
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
4899
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
4573
4900
  <xsl:value-of select="."/>
4574
4901
  </xsl:template><xsl:template match="node()" mode="contents">
4575
4902
  <xsl:apply-templates mode="contents"/>
4576
4903
  </xsl:template><xsl:template match="node()" mode="bookmarks">
4577
4904
  <xsl:apply-templates mode="bookmarks"/>
4578
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
4905
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
4579
4906
  <xsl:apply-templates select="."/>
4580
4907
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4581
4908
  <xsl:apply-templates mode="bookmarks"/>
@@ -4805,6 +5132,8 @@
4805
5132
  </fo:list-item-body>
4806
5133
  </fo:list-item>
4807
5134
  </fo:list-block>
5135
+ </xsl:template><xsl:template name="extractSection">
5136
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4808
5137
  </xsl:template><xsl:template name="extractTitle">
4809
5138
  <xsl:choose>
4810
5139
  <xsl:when test="*[local-name() = 'tab']">
@@ -4852,6 +5181,7 @@
4852
5181
 
4853
5182
 
4854
5183
 
5184
+
4855
5185
 
4856
5186
 
4857
5187
  10
@@ -5136,6 +5466,7 @@
5136
5466
  <xsl:variable name="element">
5137
5467
  block
5138
5468
 
5469
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5139
5470
  </xsl:variable>
5140
5471
  <xsl:choose>
5141
5472
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5143,7 +5474,7 @@
5143
5474
  <xsl:apply-templates/>
5144
5475
  </fo:inline>
5145
5476
  </xsl:when>
5146
- <xsl:when test="normalize-space($element) = 'block'">
5477
+ <xsl:when test="contains(normalize-space($element), 'block')">
5147
5478
  <fo:block xsl:use-attribute-sets="example-name-style">
5148
5479
  <xsl:apply-templates/>
5149
5480
  </fo:block>
@@ -5156,10 +5487,11 @@
5156
5487
  </xsl:choose>
5157
5488
 
5158
5489
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5159
-
5490
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5160
5491
  <xsl:variable name="element">
5161
5492
  block
5162
5493
 
5494
+
5163
5495
  </xsl:variable>
5164
5496
  <xsl:choose>
5165
5497
  <xsl:when test="normalize-space($element) = 'block'">
@@ -5174,7 +5506,7 @@
5174
5506
  </fo:inline>
5175
5507
  </xsl:otherwise>
5176
5508
  </xsl:choose>
5177
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
5509
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5178
5510
  <fo:block xsl:use-attribute-sets="termsource-style">
5179
5511
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5180
5512
  <xsl:variable name="termsource_text">
@@ -5183,13 +5515,15 @@
5183
5515
 
5184
5516
  <xsl:choose>
5185
5517
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5186
- <xsl:apply-templates/>
5518
+ <!-- <xsl:apply-templates /> -->
5519
+ <xsl:copy-of select="$termsource_text"/>
5187
5520
  </xsl:when>
5188
5521
  <xsl:otherwise>
5189
5522
 
5190
5523
  <xsl:text>[</xsl:text>
5191
5524
 
5192
- <xsl:apply-templates/>
5525
+ <!-- <xsl:apply-templates /> -->
5526
+ <xsl:copy-of select="$termsource_text"/>
5193
5527
 
5194
5528
  <xsl:text>]</xsl:text>
5195
5529
 
@@ -5200,8 +5534,15 @@
5200
5534
  <xsl:if test="normalize-space() != ''">
5201
5535
  <xsl:value-of select="."/>
5202
5536
  </xsl:if>
5203
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
5537
+ </xsl:template><xsl:variable name="localized.source">
5538
+ <xsl:call-template name="getLocalizedString">
5539
+ <xsl:with-param name="key">source</xsl:with-param>
5540
+ </xsl:call-template>
5541
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5204
5542
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5543
+ <xsl:if test="normalize-space(@citeas) = ''">
5544
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5545
+ </xsl:if>
5205
5546
 
5206
5547
  <fo:inline xsl:use-attribute-sets="origin-style">
5207
5548
  <xsl:apply-templates/>
@@ -5250,31 +5591,49 @@
5250
5591
  <xsl:text>— </xsl:text>
5251
5592
  <xsl:apply-templates/>
5252
5593
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5253
- <fo:inline xsl:use-attribute-sets="eref-style">
5254
- <xsl:if test="@type = 'footnote'">
5255
-
5256
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5257
- <xsl:attribute name="font-size">80%</xsl:attribute>
5258
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5259
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5260
-
5261
-
5262
- </xsl:if>
5263
-
5264
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5265
-
5266
- <xsl:if test="@type = 'inline'">
5267
-
5268
-
5269
-
5270
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
5271
-
5272
- </xsl:if>
5273
-
5274
-
5275
- <xsl:apply-templates/>
5276
- </fo:basic-link>
5277
- </fo:inline>
5594
+
5595
+ <xsl:variable name="bibitemid">
5596
+ <xsl:choose>
5597
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5598
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5599
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5600
+ </xsl:choose>
5601
+ </xsl:variable>
5602
+
5603
+ <xsl:choose>
5604
+ <xsl:when test="normalize-space($bibitemid) != ''">
5605
+ <fo:inline xsl:use-attribute-sets="eref-style">
5606
+ <xsl:if test="@type = 'footnote'">
5607
+
5608
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5609
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5610
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5611
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5612
+
5613
+
5614
+ </xsl:if>
5615
+
5616
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5617
+ <xsl:if test="normalize-space(@citeas) = ''">
5618
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5619
+ </xsl:if>
5620
+ <xsl:if test="@type = 'inline'">
5621
+
5622
+
5623
+
5624
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
5625
+
5626
+ </xsl:if>
5627
+
5628
+ <xsl:apply-templates/>
5629
+ </fo:basic-link>
5630
+
5631
+ </fo:inline>
5632
+ </xsl:when>
5633
+ <xsl:otherwise>
5634
+ <fo:inline><xsl:apply-templates/></fo:inline>
5635
+ </xsl:otherwise>
5636
+ </xsl:choose>
5278
5637
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5279
5638
  <!-- zero-space char -->
5280
5639
  <xsl:variable name="depth">
@@ -5333,7 +5692,8 @@
5333
5692
  </fo:inline>
5334
5693
  </xsl:when>
5335
5694
  <xsl:otherwise>
5336
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5695
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5696
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5337
5697
  </xsl:otherwise>
5338
5698
  </xsl:choose>
5339
5699
 
@@ -5387,7 +5747,6 @@
5387
5747
 
5388
5748
 
5389
5749
 
5390
-
5391
5750
  <xsl:apply-templates/>
5392
5751
  </fo:block>
5393
5752
 
@@ -5436,7 +5795,7 @@
5436
5795
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5437
5796
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5438
5797
  <xsl:choose>
5439
- <xsl:when test="parent::*[local-name() = 'note']">
5798
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
5440
5799
  <fo:block-container>
5441
5800
  <xsl:attribute name="margin-left">
5442
5801
  <xsl:choose>
@@ -5446,6 +5805,7 @@
5446
5805
  </xsl:attribute>
5447
5806
 
5448
5807
 
5808
+
5449
5809
  <fo:block-container margin-left="0mm">
5450
5810
  <fo:block>
5451
5811
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -5459,6 +5819,153 @@
5459
5819
  </fo:block>
5460
5820
  </xsl:otherwise>
5461
5821
  </xsl:choose>
5822
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5823
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5824
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5825
+ </xsl:for-each>
5826
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5827
+ <xsl:copy>
5828
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5829
+ </xsl:copy>
5830
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5831
+ <xsl:variable name="id">
5832
+ <xsl:call-template name="generateIndexXrefId"/>
5833
+ </xsl:variable>
5834
+ <xsl:copy> <!-- add id to xref -->
5835
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5836
+ <xsl:attribute name="id">
5837
+ <xsl:value-of select="$id"/>
5838
+ </xsl:attribute>
5839
+ <xsl:apply-templates mode="index_add_id"/>
5840
+ </xsl:copy>
5841
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5842
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5843
+ <xsl:if test="@to">
5844
+ <xsl:value-of select="$dash"/>
5845
+ <xsl:copy>
5846
+ <xsl:copy-of select="@*"/>
5847
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5848
+ <xsl:attribute name="id">
5849
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5850
+ </xsl:attribute>
5851
+ <xsl:apply-templates mode="index_add_id"/>
5852
+ </xsl:copy>
5853
+ </xsl:if>
5854
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5855
+ <xsl:copy>
5856
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5857
+ </xsl:copy>
5858
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
5859
+ <xsl:copy>
5860
+ <xsl:apply-templates select="@*" mode="index_update"/>
5861
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
5862
+ </xsl:copy>
5863
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
5864
+ <xsl:param name="element"/>
5865
+ <xsl:param name="remove" select="'false'"/>
5866
+ <xsl:param name="target"/>
5867
+ <!-- <node></node> -->
5868
+ <xsl:choose>
5869
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5870
+ <!-- skip text (i.e. remove it) and process next element -->
5871
+ <!-- [removed_<xsl:value-of select="."/>] -->
5872
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5873
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
5874
+ </xsl:apply-templates>
5875
+ </xsl:when>
5876
+ <xsl:when test="self::text()">
5877
+ <xsl:value-of select="."/>
5878
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5879
+ </xsl:when>
5880
+ <xsl:when test="self::* and local-name(.) = 'xref'">
5881
+ <xsl:variable name="id" select="@id"/>
5882
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
5883
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
5884
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
5885
+
5886
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
5887
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
5888
+
5889
+ <xsl:choose>
5890
+ <!-- 2nd pass -->
5891
+ <!-- if page is equal to page for next and page is not the end of range -->
5892
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
5893
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
5894
+ <!-- [removed_xref] -->
5895
+
5896
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5897
+ <xsl:with-param name="remove">true</xsl:with-param>
5898
+ <xsl:with-param name="target">
5899
+ <xsl:choose>
5900
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
5901
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
5902
+ </xsl:choose>
5903
+ </xsl:with-param>
5904
+ </xsl:apply-templates>
5905
+ </xsl:when>
5906
+
5907
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
5908
+ <!-- remove xref -->
5909
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5910
+ <xsl:with-param name="remove">true</xsl:with-param>
5911
+ </xsl:apply-templates>
5912
+ </xsl:when>
5913
+
5914
+ <xsl:otherwise>
5915
+ <xsl:apply-templates select="." mode="xref_copy">
5916
+ <xsl:with-param name="target" select="$target"/>
5917
+ </xsl:apply-templates>
5918
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5919
+ </xsl:otherwise>
5920
+ </xsl:choose>
5921
+ </xsl:when>
5922
+ <xsl:when test="self::* and local-name(.) = 'ul'">
5923
+ <!-- ul -->
5924
+ <xsl:apply-templates select="." mode="index_update"/>
5925
+ </xsl:when>
5926
+ <xsl:otherwise>
5927
+ <xsl:apply-templates select="." mode="xref_copy">
5928
+ <xsl:with-param name="target" select="$target"/>
5929
+ </xsl:apply-templates>
5930
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5931
+ </xsl:otherwise>
5932
+ </xsl:choose>
5933
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
5934
+ <xsl:param name="target"/>
5935
+ <xsl:copy>
5936
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
5937
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
5938
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
5939
+ </xsl:if>
5940
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
5941
+ </xsl:copy>
5942
+ </xsl:template><xsl:template name="generateIndexXrefId">
5943
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5944
+
5945
+ <xsl:variable name="docid">
5946
+ <xsl:call-template name="getDocumentId"/>
5947
+ </xsl:variable>
5948
+ <xsl:variable name="item_number">
5949
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
5950
+ </xsl:variable>
5951
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5952
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5953
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5954
+ <xsl:apply-templates/>
5955
+ <fo:block>
5956
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5957
+ <fo:block> </fo:block>
5958
+ </xsl:if>
5959
+ </fo:block>
5960
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5961
+ <xsl:apply-templates/>
5962
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5963
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5964
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5965
+ <xsl:apply-templates/>
5966
+ </fo:block>
5967
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5968
+ <fo:inline id="{@id}" font-size="1pt"/>
5462
5969
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5463
5970
  <!-- <row>
5464
5971
  <date>05-07-2013</date>
@@ -5502,6 +6009,10 @@
5502
6009
 
5503
6010
 
5504
6011
 
6012
+
6013
+
6014
+
6015
+
5505
6016
  </xsl:template><xsl:template name="processBibitemDocId">
5506
6017
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
5507
6018
  <xsl:choose>
@@ -5558,6 +6069,70 @@
5558
6069
  <xsl:value-of select="substring(.,1,1)"/>
5559
6070
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5560
6071
  <fo:inline><xsl:apply-templates/></fo:inline>
6072
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6073
+ <fo:block>
6074
+ <xsl:apply-templates/>
6075
+ </fo:block>
6076
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6077
+ <fo:inline><xsl:apply-templates/></fo:inline>
6078
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6079
+ <fo:inline>
6080
+ <xsl:call-template name="text_input"/>
6081
+ </fo:inline>
6082
+ </xsl:template><xsl:template name="text_input">
6083
+ <xsl:variable name="count">
6084
+ <xsl:choose>
6085
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6086
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6087
+ <xsl:otherwise>10</xsl:otherwise>
6088
+ </xsl:choose>
6089
+ </xsl:variable>
6090
+ <xsl:call-template name="repeat">
6091
+ <xsl:with-param name="char" select="'_'"/>
6092
+ <xsl:with-param name="count" select="$count"/>
6093
+ </xsl:call-template>
6094
+ <xsl:text> </xsl:text>
6095
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6096
+ <xsl:variable name="caption">
6097
+ <xsl:choose>
6098
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6099
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6100
+ </xsl:choose>
6101
+ </xsl:variable>
6102
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6103
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6104
+ <fo:inline padding-right="1mm">
6105
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6106
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6107
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6108
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6109
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6110
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6111
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6112
+ </svg>
6113
+ </fo:instream-foreign-object>
6114
+ </fo:inline>
6115
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6116
+ <fo:inline padding-right="1mm">
6117
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6118
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6119
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6120
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6121
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6122
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6123
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6124
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6125
+ </svg>
6126
+ </fo:instream-foreign-object>
6127
+ </fo:inline>
6128
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6129
+ <fo:inline>
6130
+ <xsl:call-template name="text_input"/>
6131
+ </fo:inline>
6132
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6133
+ <fo:block-container border="1pt solid black" width="50%">
6134
+ <fo:block> </fo:block>
6135
+ </fo:block-container>
5561
6136
  </xsl:template><xsl:template name="convertDate">
5562
6137
  <xsl:param name="date"/>
5563
6138
  <xsl:param name="format" select="'short'"/>
@@ -5677,70 +6252,68 @@
5677
6252
  <xsl:variable name="lang">
5678
6253
  <xsl:call-template name="getLang"/>
5679
6254
  </xsl:variable>
5680
- <fo:declarations>
5681
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5682
- <pdf:dictionary type="normal" key="ViewerPreferences">
5683
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5684
- </pdf:dictionary>
5685
- </pdf:catalog>
5686
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5687
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5688
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5689
- <!-- Dublin Core properties go here -->
5690
- <dc:title>
5691
- <xsl:variable name="title">
5692
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5693
-
5694
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5695
-
5696
-
5697
-
5698
-
5699
-
5700
-
5701
- </xsl:for-each>
5702
- </xsl:variable>
5703
- <xsl:choose>
5704
- <xsl:when test="normalize-space($title) != ''">
5705
- <xsl:value-of select="$title"/>
5706
- </xsl:when>
5707
- <xsl:otherwise>
5708
- <xsl:text> </xsl:text>
5709
- </xsl:otherwise>
5710
- </xsl:choose>
5711
- </dc:title>
5712
- <dc:creator>
6255
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6256
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6257
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6258
+ </pdf:dictionary>
6259
+ </pdf:catalog>
6260
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6261
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6262
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6263
+ <!-- Dublin Core properties go here -->
6264
+ <dc:title>
6265
+ <xsl:variable name="title">
5713
6266
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5714
6267
 
6268
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5715
6269
 
5716
6270
 
5717
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5718
- <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5719
- <xsl:if test="position() != last()">; </xsl:if>
5720
- </xsl:for-each>
5721
-
5722
- </xsl:for-each>
5723
- </dc:creator>
5724
- <dc:description>
5725
- <xsl:variable name="abstract">
5726
6271
 
5727
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5728
6272
 
5729
6273
 
5730
- </xsl:variable>
5731
- <xsl:value-of select="normalize-space($abstract)"/>
5732
- </dc:description>
5733
- <pdf:Keywords>
5734
- <xsl:call-template name="insertKeywords"/>
5735
- </pdf:Keywords>
5736
- </rdf:Description>
5737
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5738
- <!-- XMP properties go here -->
5739
- <xmp:CreatorTool/>
5740
- </rdf:Description>
5741
- </rdf:RDF>
5742
- </x:xmpmeta>
5743
- </fo:declarations>
6274
+
6275
+ </xsl:for-each>
6276
+ </xsl:variable>
6277
+ <xsl:choose>
6278
+ <xsl:when test="normalize-space($title) != ''">
6279
+ <xsl:value-of select="$title"/>
6280
+ </xsl:when>
6281
+ <xsl:otherwise>
6282
+ <xsl:text> </xsl:text>
6283
+ </xsl:otherwise>
6284
+ </xsl:choose>
6285
+ </dc:title>
6286
+ <dc:creator>
6287
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6288
+
6289
+
6290
+
6291
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6292
+ <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
6293
+ <xsl:if test="position() != last()">; </xsl:if>
6294
+ </xsl:for-each>
6295
+
6296
+ </xsl:for-each>
6297
+ </dc:creator>
6298
+ <dc:description>
6299
+ <xsl:variable name="abstract">
6300
+
6301
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6302
+
6303
+
6304
+ </xsl:variable>
6305
+ <xsl:value-of select="normalize-space($abstract)"/>
6306
+ </dc:description>
6307
+ <pdf:Keywords>
6308
+ <xsl:call-template name="insertKeywords"/>
6309
+ </pdf:Keywords>
6310
+ </rdf:Description>
6311
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6312
+ <!-- XMP properties go here -->
6313
+ <xmp:CreatorTool/>
6314
+ </rdf:Description>
6315
+ </rdf:RDF>
6316
+ </x:xmpmeta>
5744
6317
  </xsl:template><xsl:template name="getId">
5745
6318
  <xsl:choose>
5746
6319
  <xsl:when test="../@id">
@@ -5826,6 +6399,7 @@
5826
6399
 
5827
6400
 
5828
6401
 
6402
+
5829
6403
  <xsl:value-of select="document('')//*/namespace::nist"/>
5830
6404
 
5831
6405
 
@@ -5891,17 +6465,62 @@
5891
6465
  </xsl:call-template>
5892
6466
  </xsl:if>
5893
6467
  </xsl:template><xsl:template name="getLocalizedString">
5894
- <xsl:param name="key"/>
6468
+ <xsl:param name="key"/>
5895
6469
 
5896
6470
  <xsl:variable name="curr_lang">
5897
6471
  <xsl:call-template name="getLang"/>
5898
6472
  </xsl:variable>
5899
6473
 
6474
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6475
+
5900
6476
  <xsl:choose>
6477
+ <xsl:when test="$data_value != ''">
6478
+ <xsl:value-of select="$data_value"/>
6479
+ </xsl:when>
5901
6480
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5902
6481
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5903
6482
  </xsl:when>
5904
6483
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5905
6484
  </xsl:choose>
5906
6485
 
6486
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6487
+ <xsl:param name="isAdded"/>
6488
+ <xsl:param name="isDeleted"/>
6489
+ <xsl:choose>
6490
+ <xsl:when test="local-name() = 'math'">
6491
+ <xsl:if test="$isAdded = 'true'">
6492
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6493
+ </xsl:if>
6494
+ <xsl:if test="$isDeleted = 'true'">
6495
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6496
+ </xsl:if>
6497
+ </xsl:when>
6498
+ <xsl:otherwise>
6499
+ <xsl:if test="$isAdded = 'true'">
6500
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6501
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6502
+ </xsl:if>
6503
+ <xsl:if test="$isDeleted = 'true'">
6504
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6505
+ <xsl:if test="local-name() = 'table'">
6506
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6507
+ </xsl:if>
6508
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6509
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6510
+ </xsl:if>
6511
+ </xsl:otherwise>
6512
+ </xsl:choose>
6513
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6514
+ <xsl:if test="$lang = 'ar'">
6515
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6516
+ </xsl:if>
6517
+ </xsl:template><xsl:template name="setAlignment">
6518
+ <xsl:param name="align" select="normalize-space(@align)"/>
6519
+ <xsl:choose>
6520
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6521
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6522
+ <xsl:when test="$align != ''">
6523
+ <xsl:value-of select="$align"/>
6524
+ </xsl:when>
6525
+ </xsl:choose>
5907
6526
  </xsl:template></xsl:stylesheet>