metanorma-nist 1.2.9 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,8 +73,7 @@ module IsoDoc
73
73
 
74
74
  def docid(ixml, _out)
75
75
  docid = ixml.at(ns("//bibdata/docidentifier[@type = 'NIST']"))&.text
76
- docid_long = ixml.at(ns("//bibdata/docidentifier"\
77
- "[@type = 'nist-long']"))&.text
76
+ docid_long = ixml.at(ns("//bibdata/docidentifier[@type = 'nist-long']"))&.text
78
77
  set(:docidentifier, docid)
79
78
  set(:docidentifier_long, docid_long)
80
79
  set(:docidentifier_undated, stripdate(docid))
@@ -86,8 +85,7 @@ module IsoDoc
86
85
 
87
86
  def stripdate(id)
88
87
  return if id.nil?
89
- id.sub(/ \((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^)]+\)$/,
90
- "")
88
+ id.sub(/ \((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^)]+\)$/, "")
91
89
  end
92
90
 
93
91
  def draft_prefix(ixml)
@@ -117,9 +115,7 @@ module IsoDoc
117
115
 
118
116
  def draftinfo(draft, revdate)
119
117
  draftinfo = ""
120
- if draft
121
- draftinfo = " #{@labels["draft_label"]} #{draft}"
122
- end
118
+ draft and draftinfo = " #{@labels["draft_label"]} #{draft}"
123
119
  @i18n.l10n(draftinfo, @lang, @script)
124
120
  end
125
121
  end
@@ -151,9 +151,20 @@
151
151
  <xsl:for-each select="/nist:nist-standard/nist:bibdata/nist:contributor[nist:role/@type = 'author']">
152
152
  <xsl:value-of select="nist:person/nist:name/nist:completename"/>
153
153
  <xsl:variable name="org-name" select="nist:person/nist:affiliation/nist:organization/nist:name"/>
154
+ <xsl:variable name="subdivision">
155
+ <xsl:for-each select="nist:person/nist:affiliation/nist:organization/nist:subdivision">
156
+ <xsl:value-of select="."/>
157
+ <xsl:if test="position() != last()">, </xsl:if>
158
+ </xsl:for-each>
159
+ </xsl:variable>
160
+ <xsl:variable name="following_subdivision">
161
+ <xsl:for-each select="following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:subdivision">
162
+ <xsl:value-of select="."/>
163
+ <xsl:if test="position() != last()">, </xsl:if>
164
+ </xsl:for-each>
165
+ </xsl:variable>
154
166
  <xsl:variable name="org-address" select="nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress"/>
155
- <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $org-address)">
156
-
167
+ <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, $following_subdivision, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $subdivision, $org-address)">
157
168
  <!-- <xsl:for-each select="xalan:tokenize($org-name, ',')">
158
169
  <fo:block>
159
170
  <fo:inline font-style="italic">
@@ -161,11 +172,15 @@
161
172
  </fo:inline>
162
173
  </fo:block>
163
174
  </xsl:for-each> -->
164
- <fo:block>
165
- <fo:inline font-style="italic">
166
- <xsl:value-of select="$org-name"/>
167
- </fo:inline>
175
+ <fo:block font-style="italic">
176
+ <xsl:value-of select="$org-name"/>
168
177
  </fo:block>
178
+ <xsl:if test="normalize-space($subdivision) != ''">
179
+ <fo:block font-style="italic">
180
+ <xsl:value-of select="$subdivision"/>
181
+ </fo:block>
182
+ </xsl:if>
183
+
169
184
  <xsl:if test="normalize-space($org-address) != ''">
170
185
  <fo:block>
171
186
  <fo:inline font-style="italic">
@@ -559,30 +574,23 @@
559
574
  <!-- Bibliography -->
560
575
  <!-- ============================= -->
561
576
 
562
-
563
- <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. -->
577
+ <!-- Examples:
578
+ [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
579
+ [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
580
+ -->
564
581
  <xsl:template match="nist:bibitem">
565
-
566
582
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
567
583
  <fo:list-item>
568
584
  <fo:list-item-label end-indent="label-end()">
569
585
  <fo:block>
570
586
  <fo:inline id="{@id}">
571
587
  <!-- <xsl:number format="[1]"/> -->
572
- <xsl:value-of select="nist:docidentifier"/>
588
+ <xsl:value-of select="nist:docidentifier[@display = 'true']"/>
573
589
  </fo:inline>
574
590
  </fo:block>
575
591
  </fo:list-item-label>
576
592
  <fo:list-item-body start-indent="body-start()">
577
593
  <fo:block>
578
- <xsl:choose>
579
- <xsl:when test="nist:title[@type = 'main' and @language = 'en']">
580
- <xsl:apply-templates select="nist:title[@type = 'main' and @language = 'en']"/>
581
- </xsl:when>
582
- <xsl:otherwise>
583
- <xsl:apply-templates select="nist:title"/>
584
- </xsl:otherwise>
585
- </xsl:choose>
586
594
  <xsl:apply-templates select="nist:formattedref"/>
587
595
  </fo:block>
588
596
  </fo:list-item-body>
@@ -590,6 +598,9 @@
590
598
  </fo:list-block>
591
599
  </xsl:template>
592
600
 
601
+ <xsl:template match="nist:formattedref">
602
+ <xsl:apply-templates/>
603
+ </xsl:template>
593
604
  <!-- ============================= -->
594
605
  <!-- ============================= -->
595
606
 
@@ -619,6 +630,11 @@
619
630
  </fo:block>
620
631
  </xsl:template>
621
632
 
633
+ <xsl:template match="nist:references">
634
+ <fo:block id="{@id}">
635
+ <xsl:apply-templates/>
636
+ </fo:block>
637
+ </xsl:template>
622
638
  <xsl:template match="nist:references/nist:title">
623
639
  <fo:block-container color="white" background-color="{$color}" margin-bottom="12pt" keep-with-next="always" height="5mm" margin-left="-0.5mm" margin-right="-0.5mm">
624
640
  <fo:block font-family="Arial" font-size="12pt" font-weight="bold" margin-left="1mm" padding-top="0.3mm">
@@ -686,14 +702,14 @@
686
702
  </xsl:variable>
687
703
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
688
704
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
689
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
705
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
690
706
  </fo:basic-link>
691
707
  </fo:inline>
692
708
  <fo:footnote-body>
693
709
  <fo:block-container margin-left="3mm">
694
710
  <fo:block font-size="9pt" font-family="Times New Roman" font-style="normal" font-weight="normal" margin-left="-3mm" margin-top="6pt" margin-bottom="12pt" start-indent="0mm" text-indent="-2mm" line-height="10pt" page-break-inside="avoid">
695
711
  <fo:inline id="footnote_{@reference}_{$number}" font-size="75%" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm"> <!-- alignment-baseline="hanging" -->
696
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
712
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
697
713
  </fo:inline>
698
714
  <xsl:for-each select="nist:p">
699
715
  <xsl:apply-templates/>
@@ -726,78 +742,6 @@
726
742
  </xsl:template>
727
743
 
728
744
 
729
- <!-- Examples:
730
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
731
- [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
732
- -->
733
- <xsl:template match="nist:annex//nist:bibitem">
734
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
735
- <xsl:if test="nist:formattedref">
736
- <xsl:choose>
737
- <xsl:when test="nist:docidentifier[@type = 'metanorma']">
738
- <xsl:attribute name="margin-left">0</xsl:attribute>
739
- <xsl:attribute name="text-indent">0</xsl:attribute>
740
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
741
- <!-- create list -->
742
- <fo:list-block>
743
- <fo:list-item>
744
- <fo:list-item-label end-indent="label-end()">
745
- <fo:block>
746
- <xsl:apply-templates select="nist:docidentifier[@type = 'metanorma']" mode="process"/>
747
- </fo:block>
748
- </fo:list-item-label>
749
- <fo:list-item-body start-indent="body-start()">
750
- <fo:block margin-left="3mm">
751
- <xsl:apply-templates select="nist:formattedref"/>
752
- </fo:block>
753
- </fo:list-item-body>
754
- </fo:list-item>
755
- </fo:list-block>
756
- </xsl:when>
757
- <xsl:otherwise>
758
- <xsl:apply-templates select="nist:formattedref"/>
759
- <xsl:apply-templates select="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
760
- </xsl:otherwise>
761
- </xsl:choose>
762
-
763
-
764
- </xsl:if>
765
- <xsl:if test="nist:title">
766
- <xsl:for-each select="nist:contributor">
767
- <xsl:value-of select="nist:organization/nist:name"/>
768
- <xsl:if test="position() != last()">, </xsl:if>
769
- </xsl:for-each>
770
- <xsl:text> (</xsl:text>
771
-
772
- <xsl:value-of select="$date"/>
773
- <xsl:text>) </xsl:text>
774
- <fo:inline font-style="italic"><xsl:value-of select="nist:title"/></fo:inline>
775
- <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
776
- <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
777
- </xsl:if>
778
- <xsl:text>, </xsl:text>
779
- <xsl:value-of select="$date"/>
780
- <xsl:text>. </xsl:text>
781
- <xsl:value-of select="nist:docidentifier"/>
782
- <xsl:value-of select="$linebreak"/>
783
- <xsl:value-of select="nist:uri"/>
784
- </xsl:if>
785
- </fo:block>
786
- </xsl:template>
787
-
788
- <xsl:template match="nist:annex//nist:bibitem//nist:formattedref">
789
- <xsl:apply-templates/>
790
- </xsl:template>
791
-
792
- <xsl:template match="nist:docidentifier[@type = 'metanorma']" mode="process">
793
- <xsl:apply-templates/>
794
- </xsl:template>
795
- <xsl:template match="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
796
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
797
- </xsl:template>
798
- <xsl:template match="nist:docidentifier"/>
799
-
800
-
801
745
  <xsl:template match="nist:ul | nist:ol" mode="ul_ol">
802
746
  <fo:list-block>
803
747
  <xsl:apply-templates/>
@@ -1458,6 +1402,7 @@
1458
1402
 
1459
1403
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1460
1404
 
1405
+
1461
1406
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1462
1407
 
1463
1408
 
@@ -2483,7 +2428,9 @@
2483
2428
  </xsl:template><xsl:template match="*[local-name()='dl']">
2484
2429
  <fo:block-container>
2485
2430
 
2486
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2431
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2432
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2433
+ </xsl:if>
2487
2434
 
2488
2435
 
2489
2436
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -2498,6 +2445,7 @@
2498
2445
  <fo:block-container>
2499
2446
 
2500
2447
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2448
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2501
2449
 
2502
2450
 
2503
2451
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -2689,12 +2637,32 @@
2689
2637
  </xsl:otherwise>
2690
2638
  </xsl:choose>
2691
2639
  </xsl:template><xsl:template name="getMaxLength_dt">
2692
- <xsl:for-each select="*[local-name()='dt']">
2693
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2694
- <xsl:if test="position() = 1">
2695
- <xsl:value-of select="string-length(normalize-space(.))"/>
2696
- </xsl:if>
2697
- </xsl:for-each>
2640
+ <xsl:variable name="lengths">
2641
+ <xsl:for-each select="*[local-name()='dt']">
2642
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2643
+ <xsl:variable name="attributes">
2644
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2645
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2646
+ </xsl:variable>
2647
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2648
+ </xsl:for-each>
2649
+ </xsl:variable>
2650
+ <xsl:variable name="maxLength">
2651
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2652
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2653
+ <xsl:if test="position() = 1">
2654
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2655
+ </xsl:if>
2656
+ </xsl:for-each> -->
2657
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2658
+ <xsl:sort select="." data-type="number" order="descending"/>
2659
+ <xsl:if test="position() = 1">
2660
+ <xsl:value-of select="."/>
2661
+ </xsl:if>
2662
+ </xsl:for-each>
2663
+ </xsl:variable>
2664
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2665
+ <xsl:value-of select="$maxLength"/>
2698
2666
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2699
2667
  <xsl:param name="key_iso"/>
2700
2668
 
@@ -3511,6 +3479,8 @@
3511
3479
  <xsl:variable name="bookmark-title_">
3512
3480
  <xsl:call-template name="getLangVersion">
3513
3481
  <xsl:with-param name="lang" select="@lang"/>
3482
+ <xsl:with-param name="doctype" select="@doctype"/>
3483
+ <xsl:with-param name="title" select="@title-part"/>
3514
3484
  </xsl:call-template>
3515
3485
  </xsl:variable>
3516
3486
  <xsl:choose>
@@ -3528,13 +3498,34 @@
3528
3498
  </xsl:choose>
3529
3499
  </fo:bookmark-title>
3530
3500
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3501
+
3502
+ <xsl:call-template name="insertFigureBookmarks">
3503
+ <xsl:with-param name="contents" select="contents"/>
3504
+ </xsl:call-template>
3505
+
3506
+ <xsl:call-template name="insertTableBookmarks">
3507
+ <xsl:with-param name="contents" select="contents"/>
3508
+ <xsl:with-param name="lang" select="@lang"/>
3509
+ </xsl:call-template>
3510
+
3531
3511
  </fo:bookmark>
3532
3512
 
3533
3513
  </xsl:for-each>
3534
3514
  </xsl:when>
3535
3515
  <xsl:otherwise>
3536
3516
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3517
+
3537
3518
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3519
+
3520
+ <xsl:call-template name="insertFigureBookmarks">
3521
+ <xsl:with-param name="contents" select="contents"/>
3522
+ </xsl:call-template>
3523
+
3524
+ <xsl:call-template name="insertTableBookmarks">
3525
+ <xsl:with-param name="contents" select="contents"/>
3526
+ <xsl:with-param name="lang" select="@lang"/>
3527
+ </xsl:call-template>
3528
+
3538
3529
  </xsl:for-each>
3539
3530
  </xsl:otherwise>
3540
3531
  </xsl:choose>
@@ -3553,8 +3544,44 @@
3553
3544
 
3554
3545
  </fo:bookmark-tree>
3555
3546
  </xsl:if>
3547
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3548
+ <xsl:param name="contents"/>
3549
+ <xsl:if test="xalan:nodeset($contents)/figure">
3550
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3551
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3552
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3553
+ <fo:bookmark internal-destination="{@id}">
3554
+ <fo:bookmark-title>
3555
+ <xsl:value-of select="normalize-space(title)"/>
3556
+ </fo:bookmark-title>
3557
+ </fo:bookmark>
3558
+ </xsl:for-each>
3559
+ </fo:bookmark>
3560
+ </xsl:if>
3561
+ </xsl:template><xsl:template name="insertTableBookmarks">
3562
+ <xsl:param name="contents"/>
3563
+ <xsl:param name="lang"/>
3564
+ <xsl:if test="xalan:nodeset($contents)/table">
3565
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3566
+ <fo:bookmark-title>
3567
+ <xsl:choose>
3568
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3569
+ <xsl:otherwise>Tables</xsl:otherwise>
3570
+ </xsl:choose>
3571
+ </fo:bookmark-title>
3572
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3573
+ <fo:bookmark internal-destination="{@id}">
3574
+ <fo:bookmark-title>
3575
+ <xsl:value-of select="normalize-space(title)"/>
3576
+ </fo:bookmark-title>
3577
+ </fo:bookmark>
3578
+ </xsl:for-each>
3579
+ </fo:bookmark>
3580
+ </xsl:if>
3556
3581
  </xsl:template><xsl:template name="getLangVersion">
3557
3582
  <xsl:param name="lang"/>
3583
+ <xsl:param name="doctype" select="''"/>
3584
+ <xsl:param name="title" select="''"/>
3558
3585
  <xsl:choose>
3559
3586
  <xsl:when test="$lang = 'en'">
3560
3587
 
@@ -4046,7 +4073,8 @@
4046
4073
  <fo:block-container margin-left="0mm">
4047
4074
 
4048
4075
  <fo:block xsl:use-attribute-sets="quote-style">
4049
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4076
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4077
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4050
4078
  </fo:block>
4051
4079
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4052
4080
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -808,10 +808,25 @@
808
808
  <fo:block>
809
809
  <fo:block><xsl:value-of select="nist:person/nist:name/nist:completename"/></fo:block>
810
810
  <xsl:variable name="org-name" select="nist:person/nist:affiliation/nist:organization/nist:name"/>
811
+ <xsl:variable name="subdivision">
812
+ <xsl:for-each select="nist:person/nist:affiliation/nist:organization/nist:subdivision">
813
+ <xsl:value-of select="."/>
814
+ <xsl:if test="position() != last()">, </xsl:if>
815
+ </xsl:for-each>
816
+ </xsl:variable>
817
+ <xsl:variable name="following_subdivision">
818
+ <xsl:for-each select="following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:subdivision">
819
+ <xsl:value-of select="."/>
820
+ <xsl:if test="position() != last()">, </xsl:if>
821
+ </xsl:for-each>
822
+ </xsl:variable>
811
823
  <xsl:variable name="org-address" select="nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress"/>
812
- <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $org-address)">
824
+ <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, $following_subdivision, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $subdivision, $org-address)">
813
825
  <fo:block font-style="italic" margin-bottom="12pt">
814
826
  <xsl:value-of select="$org-name"/>
827
+ <xsl:if test="normalize-space($subdivision) != ''">
828
+ <fo:inline>, <xsl:value-of select="$subdivision"/></fo:inline>
829
+ </xsl:if>
815
830
  <xsl:if test="normalize-space($org-address) != ''">
816
831
  <fo:inline>, <xsl:value-of select="$org-address"/></fo:inline>
817
832
  </xsl:if>
@@ -915,7 +930,7 @@
915
930
  <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt"><xsl:value-of select="$title-list-figures"/></fo:block>
916
931
  <xsl:for-each select="//nist:figure[@id and nist:name]">
917
932
  <fo:block text-align-last="justify" margin-top="6pt" margin-bottom="6pt">
918
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
933
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{nist:name}">
919
934
  <xsl:apply-templates select="nist:name" mode="contents"/>
920
935
  <fo:inline keep-together.within-line="always">
921
936
  <fo:leader leader-pattern="dots"/>
@@ -941,7 +956,7 @@
941
956
  <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt"><xsl:value-of select="$title-list-tables"/></fo:block>
942
957
  <xsl:for-each select="//nist:table[@id and nist:name]">
943
958
  <fo:block text-align-last="justify" margin-top="6pt" margin-bottom="6pt">
944
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
959
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{nist:name}">
945
960
  <xsl:apply-templates select="nist:name" mode="contents"/>
946
961
  <fo:inline keep-together.within-line="always">
947
962
  <fo:leader leader-pattern="dots"/>
@@ -1340,35 +1355,24 @@
1340
1355
  <!-- Bibliography -->
1341
1356
  <!-- ============================= -->
1342
1357
 
1343
- <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. -->
1358
+ <!-- Examples:
1359
+ [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
1360
+ [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
1361
+ -->
1344
1362
  <xsl:template match="nist:bibitem">
1345
- <fo:block id="{@id}" margin-top="6pt" margin-left="14mm" text-indent="-14mm">
1346
- <fo:inline padding-right="5mm">[<xsl:value-of select="nist:docidentifier"/>]</fo:inline><xsl:value-of select="nist:docidentifier"/>
1347
- <xsl:if test="nist:title">
1348
- <fo:inline font-style="italic">
1349
- <xsl:text>, </xsl:text>
1350
- <xsl:choose>
1351
- <xsl:when test="nist:title[@type = 'main' and @language = 'en']">
1352
- <xsl:value-of select="nist:title[@type = 'main' and @language = 'en']"/>
1353
- </xsl:when>
1354
- <xsl:otherwise>
1355
- <xsl:value-of select="nist:title"/>
1356
- </xsl:otherwise>
1357
- </xsl:choose>
1358
- </fo:inline>
1359
- </xsl:if>
1360
- <xsl:apply-templates select="nist:formattedref"/>
1361
- </fo:block>
1363
+ <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
1364
+ <xsl:variable name="docidentifier" select="normalize-space(nist:docidentifier[@display = 'true'])"/>
1365
+ <xsl:if test="$docidentifier != ''">
1366
+ <fo:inline padding-right="5mm"><xsl:value-of select="$docidentifier"/></fo:inline>
1367
+ </xsl:if>
1368
+ <xsl:apply-templates select="nist:formattedref"/>
1369
+ </fo:block>
1362
1370
  </xsl:template>
1363
- <xsl:template match="nist:bibitem/nist:docidentifier"/>
1364
-
1365
- <xsl:template match="nist:bibitem/nist:title"/>
1366
1371
 
1367
1372
  <xsl:template match="nist:formattedref">
1368
- <xsl:text>, </xsl:text><xsl:apply-templates/>
1373
+ <xsl:apply-templates/>
1369
1374
  </xsl:template>
1370
1375
 
1371
-
1372
1376
  <!-- ============================= -->
1373
1377
  <!-- ============================= -->
1374
1378
 
@@ -1488,21 +1492,21 @@
1488
1492
  <!-- ====== -->
1489
1493
 
1490
1494
 
1491
- <xsl:template match="nist:p/nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn" priority="2">
1495
+ <xsl:template match="nist:p//nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn" priority="2">
1492
1496
  <fo:footnote>
1493
1497
  <xsl:variable name="number">
1494
- <xsl:number level="any" count="nist:p/nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn"/>
1498
+ <xsl:number level="any" count="nist:p//nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn"/>
1495
1499
  </xsl:variable>
1496
1500
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1497
1501
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1498
1502
  <!-- <xsl:value-of select="@reference"/> -->
1499
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
1503
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
1500
1504
  </fo:basic-link>
1501
1505
  </fo:inline>
1502
1506
  <fo:footnote-body>
1503
1507
  <fo:block font-size="10pt" font-family="Times New Roman" font-style="normal" font-weight="normal" text-align="justify" margin-bottom="12pt" start-indent="0">
1504
1508
  <fo:inline id="footnote_{@reference}_{$number}" font-size="75%" keep-with-next.within-line="always" vertical-align="super"> <!-- alignment-baseline="hanging" -->
1505
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
1509
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
1506
1510
  </fo:inline>
1507
1511
  <xsl:for-each select="nist:p">
1508
1512
  <xsl:apply-templates/>
@@ -1536,104 +1540,6 @@
1536
1540
  </xsl:element>
1537
1541
  </xsl:template>
1538
1542
 
1539
-
1540
-
1541
- <!-- Examples:
1542
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
1543
- [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
1544
- -->
1545
- <xsl:template match="nist:annex//nist:bibitem">
1546
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
1547
- <xsl:if test="nist:formattedref">
1548
- <xsl:choose>
1549
- <xsl:when test="nist:docidentifier[@type = 'metanorma']">
1550
- <xsl:attribute name="margin-left">0</xsl:attribute>
1551
- <xsl:attribute name="text-indent">0</xsl:attribute>
1552
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1553
- <!-- create list -->
1554
- <fo:list-block>
1555
- <fo:list-item>
1556
- <fo:list-item-label end-indent="label-end()">
1557
- <fo:block>
1558
- <xsl:apply-templates select="nist:docidentifier[@type = 'metanorma']" mode="process"/>
1559
- </fo:block>
1560
- </fo:list-item-label>
1561
- <fo:list-item-body start-indent="body-start()">
1562
- <fo:block margin-left="3mm">
1563
- <xsl:apply-templates select="nist:formattedref"/>
1564
- </fo:block>
1565
- </fo:list-item-body>
1566
- </fo:list-item>
1567
- </fo:list-block>
1568
- </xsl:when>
1569
- <xsl:otherwise>
1570
- <xsl:apply-templates select="nist:formattedref"/>
1571
- <xsl:apply-templates select="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
1572
- </xsl:otherwise>
1573
- </xsl:choose>
1574
-
1575
-
1576
- </xsl:if>
1577
- <xsl:if test="nist:title">
1578
- <xsl:for-each select="nist:contributor">
1579
- <xsl:choose>
1580
- <xsl:when test="nist:person/nist:name/nist:completename">
1581
- <xsl:apply-templates select="nist:person/nist:name/nist:completename"/>
1582
- </xsl:when>
1583
- <xsl:otherwise>
1584
- <xsl:apply-templates select="nist:organization/nist:name"/>
1585
- </xsl:otherwise>
1586
- </xsl:choose>
1587
- <xsl:if test="position() != last()">, </xsl:if>
1588
- </xsl:for-each>
1589
- <xsl:text> (</xsl:text>
1590
- <xsl:variable name="date">
1591
- <xsl:choose>
1592
- <xsl:when test="nist:date[@type='issued']">
1593
- <xsl:call-template name="formatDate">
1594
- <xsl:with-param name="date" select="nist:date[@type='issued']/nist:on"/>
1595
- </xsl:call-template>
1596
- </xsl:when>
1597
- <xsl:otherwise>
1598
- <xsl:call-template name="formatDate">
1599
- <xsl:with-param name="date" select="nist:date/nist:on"/>
1600
- </xsl:call-template>
1601
- </xsl:otherwise>
1602
- </xsl:choose>
1603
- </xsl:variable>
1604
- <xsl:value-of select="$date"/>
1605
- <xsl:text>) </xsl:text>
1606
- <fo:inline font-style="italic"><xsl:value-of select="nist:title"/></fo:inline>
1607
- <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
1608
- <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
1609
- </xsl:if>
1610
- <xsl:if test="nist:place">
1611
- <xsl:text> (</xsl:text><xsl:value-of select="nist:place"/><xsl:text>)</xsl:text>
1612
- </xsl:if>
1613
- <xsl:text>, </xsl:text>
1614
- <xsl:value-of select="$date"/>
1615
- <xsl:text>. </xsl:text>
1616
- <xsl:value-of select="nist:docidentifier"/>
1617
- <xsl:value-of select="$linebreak"/>
1618
- <xsl:value-of select="nist:uri"/>
1619
- </xsl:if>
1620
- </fo:block>
1621
- </xsl:template>
1622
-
1623
- <xsl:template match="nist:annex//nist:bibitem//nist:formattedref">
1624
- <xsl:apply-templates/>
1625
- </xsl:template>
1626
-
1627
- <xsl:template match="nist:docidentifier[@type = 'metanorma']" mode="process">
1628
- <xsl:apply-templates/>
1629
- </xsl:template>
1630
- <xsl:template match="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
1631
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
1632
- </xsl:template>
1633
- <xsl:template match="nist:docidentifier"/>
1634
-
1635
-
1636
-
1637
1543
  <xsl:template match="nist:ul | nist:ol" mode="ul_ol">
1638
1544
  <xsl:param name="margin"/>
1639
1545
  <fo:list-block>
@@ -2543,6 +2449,7 @@
2543
2449
 
2544
2450
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2545
2451
 
2452
+
2546
2453
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2547
2454
 
2548
2455
 
@@ -3569,7 +3476,9 @@
3569
3476
  </xsl:template><xsl:template match="*[local-name()='dl']">
3570
3477
  <fo:block-container>
3571
3478
 
3572
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
3479
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3480
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3481
+ </xsl:if>
3573
3482
 
3574
3483
 
3575
3484
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -3584,6 +3493,7 @@
3584
3493
  <fo:block-container>
3585
3494
 
3586
3495
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3496
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3587
3497
 
3588
3498
 
3589
3499
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -3775,12 +3685,32 @@
3775
3685
  </xsl:otherwise>
3776
3686
  </xsl:choose>
3777
3687
  </xsl:template><xsl:template name="getMaxLength_dt">
3778
- <xsl:for-each select="*[local-name()='dt']">
3779
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3780
- <xsl:if test="position() = 1">
3781
- <xsl:value-of select="string-length(normalize-space(.))"/>
3782
- </xsl:if>
3783
- </xsl:for-each>
3688
+ <xsl:variable name="lengths">
3689
+ <xsl:for-each select="*[local-name()='dt']">
3690
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
3691
+ <xsl:variable name="attributes">
3692
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
3693
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
3694
+ </xsl:variable>
3695
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
3696
+ </xsl:for-each>
3697
+ </xsl:variable>
3698
+ <xsl:variable name="maxLength">
3699
+ <!-- <xsl:for-each select="*[local-name()='dt']">
3700
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3701
+ <xsl:if test="position() = 1">
3702
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3703
+ </xsl:if>
3704
+ </xsl:for-each> -->
3705
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
3706
+ <xsl:sort select="." data-type="number" order="descending"/>
3707
+ <xsl:if test="position() = 1">
3708
+ <xsl:value-of select="."/>
3709
+ </xsl:if>
3710
+ </xsl:for-each>
3711
+ </xsl:variable>
3712
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
3713
+ <xsl:value-of select="$maxLength"/>
3784
3714
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3785
3715
  <xsl:param name="key_iso"/>
3786
3716
 
@@ -4597,6 +4527,8 @@
4597
4527
  <xsl:variable name="bookmark-title_">
4598
4528
  <xsl:call-template name="getLangVersion">
4599
4529
  <xsl:with-param name="lang" select="@lang"/>
4530
+ <xsl:with-param name="doctype" select="@doctype"/>
4531
+ <xsl:with-param name="title" select="@title-part"/>
4600
4532
  </xsl:call-template>
4601
4533
  </xsl:variable>
4602
4534
  <xsl:choose>
@@ -4614,13 +4546,34 @@
4614
4546
  </xsl:choose>
4615
4547
  </fo:bookmark-title>
4616
4548
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4549
+
4550
+ <xsl:call-template name="insertFigureBookmarks">
4551
+ <xsl:with-param name="contents" select="contents"/>
4552
+ </xsl:call-template>
4553
+
4554
+ <xsl:call-template name="insertTableBookmarks">
4555
+ <xsl:with-param name="contents" select="contents"/>
4556
+ <xsl:with-param name="lang" select="@lang"/>
4557
+ </xsl:call-template>
4558
+
4617
4559
  </fo:bookmark>
4618
4560
 
4619
4561
  </xsl:for-each>
4620
4562
  </xsl:when>
4621
4563
  <xsl:otherwise>
4622
4564
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4565
+
4623
4566
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4567
+
4568
+ <xsl:call-template name="insertFigureBookmarks">
4569
+ <xsl:with-param name="contents" select="contents"/>
4570
+ </xsl:call-template>
4571
+
4572
+ <xsl:call-template name="insertTableBookmarks">
4573
+ <xsl:with-param name="contents" select="contents"/>
4574
+ <xsl:with-param name="lang" select="@lang"/>
4575
+ </xsl:call-template>
4576
+
4624
4577
  </xsl:for-each>
4625
4578
  </xsl:otherwise>
4626
4579
  </xsl:choose>
@@ -4666,8 +4619,44 @@
4666
4619
 
4667
4620
  </fo:bookmark-tree>
4668
4621
  </xsl:if>
4622
+ </xsl:template><xsl:template name="insertFigureBookmarks">
4623
+ <xsl:param name="contents"/>
4624
+ <xsl:if test="xalan:nodeset($contents)/figure">
4625
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
4626
+ <fo:bookmark-title>Figures</fo:bookmark-title>
4627
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
4628
+ <fo:bookmark internal-destination="{@id}">
4629
+ <fo:bookmark-title>
4630
+ <xsl:value-of select="normalize-space(title)"/>
4631
+ </fo:bookmark-title>
4632
+ </fo:bookmark>
4633
+ </xsl:for-each>
4634
+ </fo:bookmark>
4635
+ </xsl:if>
4636
+ </xsl:template><xsl:template name="insertTableBookmarks">
4637
+ <xsl:param name="contents"/>
4638
+ <xsl:param name="lang"/>
4639
+ <xsl:if test="xalan:nodeset($contents)/table">
4640
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
4641
+ <fo:bookmark-title>
4642
+ <xsl:choose>
4643
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4644
+ <xsl:otherwise>Tables</xsl:otherwise>
4645
+ </xsl:choose>
4646
+ </fo:bookmark-title>
4647
+ <xsl:for-each select="xalan:nodeset($contents)/table">
4648
+ <fo:bookmark internal-destination="{@id}">
4649
+ <fo:bookmark-title>
4650
+ <xsl:value-of select="normalize-space(title)"/>
4651
+ </fo:bookmark-title>
4652
+ </fo:bookmark>
4653
+ </xsl:for-each>
4654
+ </fo:bookmark>
4655
+ </xsl:if>
4669
4656
  </xsl:template><xsl:template name="getLangVersion">
4670
4657
  <xsl:param name="lang"/>
4658
+ <xsl:param name="doctype" select="''"/>
4659
+ <xsl:param name="title" select="''"/>
4671
4660
  <xsl:choose>
4672
4661
  <xsl:when test="$lang = 'en'">
4673
4662
 
@@ -5156,7 +5145,8 @@
5156
5145
  <fo:block-container margin-left="0mm">
5157
5146
 
5158
5147
  <fo:block xsl:use-attribute-sets="quote-style">
5159
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
5148
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5149
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5160
5150
  </fo:block>
5161
5151
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5162
5152
  <fo:block xsl:use-attribute-sets="quote-source-style">