metanorma-mpfa 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,7 @@
34
34
  -->
35
35
  <xsl:variable name="contents_">
36
36
  <contents>
37
- <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]" mode="contents"/>
37
+ <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms' or local-name() = 'note' or local-name() = 'admonition')]" mode="contents"/>
38
38
  <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms" mode="contents"/>
39
39
 
40
40
  <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:sections/*" mode="contents"/>
@@ -244,11 +244,11 @@
244
244
 
245
245
  </fo:block>
246
246
  </fo:block-container>
247
- <xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*">
247
+ <xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
248
248
  <fo:block break-after="page"/>
249
249
  <!-- Foreword, Introduction -->
250
250
  <fo:block>
251
- <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]"/>
251
+ <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms' or local-name() = 'note' or local-name() = 'admonition')]"/>
252
252
  <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms"/>
253
253
  </fo:block>
254
254
  </xsl:if>
@@ -586,14 +586,41 @@
586
586
  </xsl:template>
587
587
 
588
588
 
589
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
589
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
590
+ <xsl:for-each select="$table_widths_from_if//table">
591
+ <xsl:copy>
592
+ <xsl:copy-of select="@*"/>
593
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
594
+ </xsl:copy>
595
+ </xsl:for-each>
596
+ </xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
590
597
  false
591
598
  </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
592
599
  <xsl:call-template name="getLang"/>
593
- </xsl:variable><xsl:variable name="pageWidth_">
594
- 210
600
+ </xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
601
+ <xsl:choose>
602
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
603
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
604
+ </xsl:choose>
605
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
606
+ <xsl:choose>
607
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
608
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
609
+ </xsl:choose>
610
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
611
+ <xsl:choose>
612
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
613
+ <xsl:otherwise>
614
+ 210
615
+ </xsl:otherwise>
616
+ </xsl:choose>
595
617
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
596
- 297
618
+ <xsl:choose>
619
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
620
+ <xsl:otherwise>
621
+ 297
622
+ </xsl:otherwise>
623
+ </xsl:choose>
597
624
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
598
625
  19
599
626
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -1156,6 +1183,24 @@
1156
1183
 
1157
1184
 
1158
1185
 
1186
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
1187
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1188
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1159
1204
  </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
1160
1205
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1161
1206
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
@@ -1448,6 +1493,23 @@
1448
1493
 
1449
1494
 
1450
1495
 
1496
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
1497
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1498
+
1499
+
1500
+
1501
+
1502
+
1503
+
1504
+
1505
+
1506
+
1507
+
1508
+
1509
+
1510
+
1511
+
1512
+
1451
1513
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1452
1514
 
1453
1515
 
@@ -1839,13 +1901,13 @@
1839
1901
 
1840
1902
  </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:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1841
1903
  <xsl:variable name="nodes_preface_">
1842
- <xsl:for-each select="/*/*[local-name()='preface']/*">
1904
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1843
1905
  <node id="{@id}"/>
1844
1906
  </xsl:for-each>
1845
1907
  </xsl:variable>
1846
1908
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
1847
1909
 
1848
- <xsl:for-each select="/*/*[local-name()='preface']/*">
1910
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1849
1911
  <xsl:sort select="@displayorder" data-type="number"/>
1850
1912
 
1851
1913
  <!-- process Section's title -->
@@ -1911,7 +1973,7 @@
1911
1973
  </xsl:for-each>
1912
1974
  </figures>
1913
1975
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1914
- <xsl:for-each select="/*/*[local-name()='preface']/*">
1976
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1915
1977
  <xsl:sort select="@displayorder" data-type="number"/>
1916
1978
  <xsl:apply-templates select="."/>
1917
1979
  </xsl:for-each>
@@ -2516,8 +2578,9 @@
2516
2578
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2517
2579
  </xsl:if>
2518
2580
  </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
2519
- <xsl:param name="table"/>
2520
- <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
2581
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2582
+
2583
+ <!-- via intermediate format -->
2521
2584
 
2522
2585
  <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
2523
2586
 
@@ -2528,9 +2591,8 @@
2528
2591
  <!-- get current table id -->
2529
2592
  <xsl:variable name="table_id" select="@id"/>
2530
2593
  <!-- find table by id in the file 'table_widths' -->
2531
- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2532
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
2533
-
2594
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2595
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2534
2596
 
2535
2597
  <!-- table='<xsl:copy-of select="$table"/>' -->
2536
2598
  <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
@@ -2538,24 +2600,13 @@
2538
2600
  <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2539
2601
 
2540
2602
  <xsl:variable name="table_with_cell_widths_">
2541
- <xsl:choose>
2542
- <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
2543
-
2544
- <!-- Example: <column>10</column>
2545
- <column>11</column>
2546
- -->
2547
- <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
2548
- </xsl:when>
2549
- <xsl:otherwise>
2550
- <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
2551
- </xsl:otherwise>
2552
- </xsl:choose>
2603
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2553
2604
  </xsl:variable>
2554
2605
  <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2555
2606
 
2556
- <xsl:if test="$table_if_debug = 'true'">
2607
+ <!-- <xsl:if test="$table_if_debug = 'true'">
2557
2608
  <xsl:copy-of select="$table_with_cell_widths"/>
2558
- </xsl:if>
2609
+ </xsl:if> -->
2559
2610
 
2560
2611
 
2561
2612
  <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
@@ -2601,8 +2652,12 @@
2601
2652
 
2602
2653
  <xsl:variable name="page_width">
2603
2654
  <xsl:choose>
2604
- <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
2605
- <xsl:otherwise>75</xsl:otherwise>
2655
+ <xsl:when test="$parent_table_page-width != ''">
2656
+ <xsl:value-of select="$parent_table_page-width"/>
2657
+ </xsl:when>
2658
+ <xsl:otherwise>
2659
+ <xsl:value-of select="@page-width"/>
2660
+ </xsl:otherwise>
2606
2661
  </xsl:choose>
2607
2662
  </xsl:variable>
2608
2663
 
@@ -2610,9 +2665,6 @@
2610
2665
  <table_width>
2611
2666
  <xsl:copy-of select="$table_widths"/>
2612
2667
  </table_width>
2613
- <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
2614
- <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
2615
- -->
2616
2668
  <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2617
2669
  </xsl:if>
2618
2670
 
@@ -2623,11 +2675,11 @@
2623
2675
  <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2624
2676
  <!-- call old algorithm -->
2625
2677
  <case1/>
2626
- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2678
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
2627
2679
  <xsl:call-template name="calculate-column-widths-proportional">
2628
2680
  <xsl:with-param name="cols-count" select="$cols-count"/>
2629
2681
  <xsl:with-param name="table" select="$table"/>
2630
- </xsl:call-template>
2682
+ </xsl:call-template> -->
2631
2683
  </xsl:when>
2632
2684
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2633
2685
  <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
@@ -2671,95 +2723,49 @@
2671
2723
  <xsl:otherwise><unknown_case/></xsl:otherwise>
2672
2724
  </xsl:choose>
2673
2725
 
2726
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
2674
2727
 
2675
- </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
2676
- <xsl:copy>
2677
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
2678
- </xsl:copy>
2679
- </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
2680
- <xsl:copy>
2681
- <xsl:copy-of select="@*"/>
2728
+ <!-- if nested 'dl' or 'table' -->
2729
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
2730
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
2682
2731
 
2683
- <!-- The maximum width is given by the widest line. -->
2684
- <xsl:variable name="widths_max">
2685
- <xsl:for-each select=".//*[local-name() = 'p']">
2686
- <xsl:call-template name="add_width"/>
2687
- </xsl:for-each>
2688
- <xsl:if test="not(*[local-name() = 'p'])">
2689
- <xsl:call-template name="add_width"/>
2690
- </xsl:if>
2691
- </xsl:variable>
2692
- <xsl:variable name="width_max">
2693
- <xsl:for-each select="xalan:nodeset($widths_max)//width">
2694
- <xsl:sort select="." data-type="number" order="descending"/>
2695
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2696
- </xsl:for-each>
2697
- </xsl:variable>
2698
- <xsl:attribute name="width_max">
2699
- <xsl:value-of select="$width_max"/>
2700
- </xsl:attribute>
2732
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2701
2733
 
2702
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2703
- <!-- To do: image width -->
2704
- <xsl:variable name="td_text">
2705
- <xsl:apply-templates select="." mode="td_text"/>
2706
- </xsl:variable>
2707
- <xsl:variable name="words">
2708
- <xsl:variable name="string_with_added_zerospaces">
2709
- <xsl:call-template name="add-zero-spaces-java">
2710
- <xsl:with-param name="text" select="$td_text"/>
2711
- </xsl:call-template>
2734
+ <xsl:variable name="parent_table_page-width_">
2735
+ <xsl:if test="$parent_table_id != ''">
2736
+ <!-- determine column number in the parent table -->
2737
+ <xsl:variable name="parent_table_column_number">
2738
+ <xsl:choose>
2739
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2740
+ <xsl:otherwise> <!-- parent is table -->
2741
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2742
+ </xsl:otherwise>
2743
+ </xsl:choose>
2712
2744
  </xsl:variable>
2713
- <xsl:call-template name="tokenize">
2714
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
2715
- </xsl:call-template>
2716
- </xsl:variable>
2717
-
2718
- <xsl:variable name="max_word_length">
2719
- <xsl:call-template name="max_length">
2720
- <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2721
- </xsl:call-template>
2722
- </xsl:variable>
2723
- <xsl:variable name="width_min">
2724
- <xsl:value-of select="$max_word_length"/>
2725
- </xsl:variable>
2726
- <xsl:attribute name="width_min">
2727
- <xsl:value-of select="$width_min"/>
2728
- </xsl:attribute>
2729
- <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
2730
- <xsl:if test="$width_min &gt; $width_max">
2731
- <xsl:attribute name="width_max">
2732
- <xsl:value-of select="$width_min"/>
2733
- </xsl:attribute>
2734
- </xsl:if>
2735
- <xsl:if test="$width_min = 0">
2736
- <xsl:attribute name="width_min">1</xsl:attribute>
2745
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2746
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2737
2747
  </xsl:if>
2738
-
2739
- <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
2740
-
2741
- </xsl:copy>
2742
- </xsl:template><xsl:template name="add_width">
2743
- <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
2744
- <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
2745
-
2746
- <xsl:variable name="p_text_len">
2747
- <xsl:choose>
2748
- <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
2749
- <xsl:value-of select="$p_text_len_ * 1.5"/>
2750
- </xsl:when>
2751
- <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
2752
- </xsl:choose>
2753
2748
  </xsl:variable>
2749
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2754
2750
 
2755
- <xsl:variable name="math_addon_text">
2756
- <xsl:for-each select=".//*[local-name() = 'math']">
2757
- <xsl:apply-templates mode="td_text"/>
2758
- </xsl:for-each>
2759
- </xsl:variable>
2760
- <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
2751
+ <!-- get current table id -->
2752
+ <xsl:variable name="table_id" select="@id"/>
2753
+
2754
+ <xsl:choose>
2755
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
2756
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
2757
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
2758
+ </xsl:when>
2759
+ <xsl:otherwise>
2760
+ <!-- recalculate columns width based on parent table width -->
2761
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
2762
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
2763
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
2764
+ </xsl:call-template>
2765
+ </xsl:for-each>
2766
+ </xsl:otherwise>
2767
+ </xsl:choose>
2761
2768
 
2762
- <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
2763
2769
  </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
2764
2770
  <xsl:copy>
2765
2771
  <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
@@ -3537,11 +3543,19 @@
3537
3543
 
3538
3544
 
3539
3545
 
3546
+
3547
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
3548
+ <xsl:attribute name="margin-top">0</xsl:attribute>
3549
+ </xsl:if>
3550
+
3540
3551
  <fo:block>
3541
3552
 
3542
3553
 
3543
3554
 
3544
3555
 
3556
+ <xsl:apply-templates select="*[local-name() = 'name']">
3557
+ <xsl:with-param name="process">true</xsl:with-param>
3558
+ </xsl:apply-templates>
3545
3559
 
3546
3560
  <xsl:if test="$isGenerateTableIF = 'true'">
3547
3561
  <!-- to determine start of table -->
@@ -3564,6 +3578,7 @@
3564
3578
  </xsl:choose>
3565
3579
 
3566
3580
 
3581
+
3567
3582
  <xsl:choose>
3568
3583
  <xsl:when test="$isGenerateTableIF = 'true'">
3569
3584
  <!-- generate IF for table widths -->
@@ -3692,6 +3707,18 @@
3692
3707
  </xsl:if> <!-- END: a few components -->
3693
3708
  </fo:block-container>
3694
3709
  </fo:block-container>
3710
+
3711
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
3712
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
3713
+ </xsl:if>
3714
+
3715
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
3716
+ <xsl:param name="process">false</xsl:param>
3717
+ <xsl:if test="$process = 'true'">
3718
+ <fo:block xsl:use-attribute-sets="dl-name-style">
3719
+ <xsl:apply-templates/>
3720
+ </fo:block>
3721
+ </xsl:if>
3695
3722
  </xsl:template><xsl:template name="setColumnWidth_dl">
3696
3723
  <xsl:param name="colwidths"/>
3697
3724
  <xsl:param name="maxlength_dt"/>
@@ -3700,6 +3727,11 @@
3700
3727
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
3701
3728
 
3702
3729
  <xsl:choose>
3730
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
3731
+ <xsl:call-template name="insertTableColumnWidth">
3732
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3733
+ </xsl:call-template>
3734
+ </xsl:when>
3703
3735
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3704
3736
  <fo:table-column column-width="50%"/>
3705
3737
  <fo:table-column column-width="50%"/>
@@ -3952,12 +3984,24 @@
3952
3984
  </td>
3953
3985
  <td>
3954
3986
 
3955
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
3987
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
3988
+
3989
+ <!-- get paragraphs from nested 'dl' -->
3990
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
3991
+
3956
3992
 
3957
3993
  </td>
3958
3994
  </tr>
3959
3995
 
3960
- </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
3996
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
3997
+ <xsl:for-each select="*[local-name() = 'dt']">
3998
+ <p>
3999
+ <xsl:copy-of select="node()"/>
4000
+ <xsl:text> </xsl:text>
4001
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
4002
+ </p>
4003
+ </xsl:for-each>
4004
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
3961
4005
  <fo:inline font-style="italic">
3962
4006
  <xsl:apply-templates/>
3963
4007
  </fo:inline>
@@ -3988,7 +4032,7 @@
3988
4032
 
3989
4033
 
3990
4034
 
3991
-
4035
+ <!-- 10 -->
3992
4036
 
3993
4037
 
3994
4038
 
@@ -6008,7 +6052,7 @@
6008
6052
 
6009
6053
 
6010
6054
 
6011
-
6055
+ <!-- 9 -->
6012
6056
 
6013
6057
 
6014
6058
 
@@ -6092,7 +6136,7 @@
6092
6136
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6093
6137
  <xsl:choose>
6094
6138
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6095
- <xsl:call-template name="interspers">
6139
+ <xsl:call-template name="interspers-java">
6096
6140
  <xsl:with-param name="str" select="."/>
6097
6141
  </xsl:call-template>
6098
6142
  </xsl:when>
@@ -6142,6 +6186,10 @@
6142
6186
  <xsl:with-param name="char" select="$char"/>
6143
6187
  </xsl:call-template>
6144
6188
  </xsl:if>
6189
+ </xsl:template><xsl:template name="interspers-java">
6190
+ <xsl:param name="str"/>
6191
+ <xsl:param name="char" select="$zero_width_space"/>
6192
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
6145
6193
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6146
6194
  <xsl:apply-templates mode="syntax_highlight"/>
6147
6195
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -7083,6 +7131,11 @@
7083
7131
  </xsl:otherwise>
7084
7132
  </xsl:choose>
7085
7133
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7134
+
7135
+ <xsl:apply-templates select="*[local-name() = 'name']">
7136
+ <xsl:with-param name="process">true</xsl:with-param>
7137
+ </xsl:apply-templates>
7138
+
7086
7139
  <fo:list-block xsl:use-attribute-sets="list-style">
7087
7140
 
7088
7141
 
@@ -7097,12 +7150,23 @@
7097
7150
 
7098
7151
 
7099
7152
 
7153
+ <xsl:if test="*[local-name() = 'name']">
7154
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7155
+ </xsl:if>
7156
+
7100
7157
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7101
7158
  </fo:list-block>
7102
7159
  <!-- <xsl:for-each select="./iho:note">
7103
7160
  <xsl:call-template name="note"/>
7104
7161
  </xsl:for-each> -->
7105
7162
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
7163
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
7164
+ <xsl:param name="process">false</xsl:param>
7165
+ <xsl:if test="$process = 'true'">
7166
+ <fo:block xsl:use-attribute-sets="list-name-style">
7167
+ <xsl:apply-templates/>
7168
+ </fo:block>
7169
+ </xsl:if>
7106
7170
  </xsl:template><xsl:template match="*[local-name()='li']">
7107
7171
  <fo:list-item xsl:use-attribute-sets="list-item-style">
7108
7172
  <xsl:copy-of select="@id"/>
@@ -7406,26 +7470,23 @@
7406
7470
  <xsl:if test=".//*[local-name() = 'fn']">
7407
7471
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
7408
7472
  </xsl:if>
7473
+
7474
+ <!-- display document identifier, not number [1] -->
7409
7475
  <xsl:variable name="docidentifier">
7410
7476
  <xsl:choose>
7411
7477
  <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
7412
7478
  <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
7413
7479
  </xsl:choose>
7414
7480
  </xsl:variable>
7415
- <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
7481
+ <xsl:value-of select="$docidentifier"/>
7482
+
7416
7483
  <xsl:apply-templates select="*[local-name() = 'note']"/>
7417
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
7418
- <xsl:choose>
7419
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]">
7420
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/>
7421
- </xsl:when>
7422
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
7423
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
7424
- </xsl:when>
7425
- <xsl:otherwise>
7426
- <xsl:apply-templates select="*[local-name() = 'title']"/>
7427
- </xsl:otherwise>
7428
- </xsl:choose>
7484
+
7485
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
7486
+ <xsl:text>,</xsl:text>
7487
+ <xsl:text> </xsl:text>
7488
+ </xsl:if>
7489
+
7429
7490
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
7430
7491
  <!-- end bibitem processing -->
7431
7492
 
@@ -7747,25 +7808,32 @@
7747
7808
  </fo:block-container>
7748
7809
 
7749
7810
  </xsl:template><xsl:template name="displayAdmonitionName">
7750
-
7811
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
7812
+ <!-- <xsl:choose>
7813
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
7814
+ <xsl:choose>
7815
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
7816
+ <xsl:otherwise>
7817
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7818
+ </xsl:otherwise>
7819
+ </xsl:choose>
7820
+ </xsl:when>
7821
+ <xsl:otherwise>
7751
7822
  <xsl:apply-templates select="*[local-name() = 'name']"/>
7752
7823
  <xsl:if test="not(*[local-name() = 'name'])">
7753
7824
  <xsl:apply-templates select="@type"/>
7754
7825
  </xsl:if>
7755
-
7756
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7757
- <xsl:apply-templates/>
7758
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
7759
- <xsl:variable name="admonition_type_">
7760
- <xsl:call-template name="getLocalizedString">
7761
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
7762
- </xsl:call-template>
7826
+ </xsl:otherwise>
7827
+ </xsl:choose> -->
7828
+ <xsl:variable name="name">
7829
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
7763
7830
  </xsl:variable>
7764
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
7765
- <xsl:value-of select="$admonition_type"/>
7766
- <xsl:if test="$admonition_type = ''">
7767
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
7831
+ <xsl:copy-of select="$name"/>
7832
+ <xsl:if test="normalize-space($name) != ''">
7833
+ <xsl:value-of select="$sep"/>
7768
7834
  </xsl:if>
7835
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
7836
+ <xsl:apply-templates/>
7769
7837
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
7770
7838
  <!-- processing for admonition/p found in the template for 'p' -->
7771
7839
  <xsl:call-template name="paragraph"/>