metanorma-itu 2.8.6 → 2.8.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c90902604bc7595629aab447f819c8aa365b2d88bcfdd916c75f249f29b0a8c
4
- data.tar.gz: b0c8ce84b486a5edb5a3ffff29b9289c25caebaf49cd258faeef98a42ca8f689
3
+ metadata.gz: 414f0d75b334e15b5591ddd105e48bc8d2394a4b7592244d113ac8940309a092
4
+ data.tar.gz: 5499850f5a63ad6b31ae114629fae5c18e10c465eb4d08fd3a7f91ce66dc447c
5
5
  SHA512:
6
- metadata.gz: ebed4f7693b075eb8121005178f2be913bbda87ac321b6d7d1f78cb3611fd017e21c137e7e3d9e718afdde5f4144b34bd8bb3f4a049be4c127c01ab7dc893886
7
- data.tar.gz: b19909608492c4ec559bbfe5a9cb8933f954110455a22a885bf0b4dbdfdc0718e64f3a7e1e75e98b7e35e5982edcae7609878795a09807f3c82d3a4c6281b84a
6
+ metadata.gz: 68157e69e964af95f7ad9828c71a72b015c071f130a321b669b7c5e8173abd64d5f3525c0c3e27d74252c0478624f227368b36fbe6b3cf35546a0c06b6087b8a
7
+ data.tar.gz: 5a9d44bbcc7a11c3a45d77c8b49956fd20c9f609c14312d4f7a814274a3d7884913a8e07d968e114f67272cd21acffd63d2ceaffe8ab2a42744e7f8ba209c76a
@@ -4,6 +4,8 @@
4
4
 
5
5
  <xsl:key name="kfn" match="mn:fn[not(ancestor::*[self::mn:table or self::mn:figure or self::mn:localized-strings] and not(ancestor::mn:fmt-name))]" use="@reference"/>
6
6
 
7
+ <xsl:key name="kid" match="*" use="@id"/>
8
+
7
9
  <xsl:variable name="debug">false</xsl:variable>
8
10
 
9
11
  <!-- Example:
@@ -577,7 +579,9 @@
577
579
  </xsl:for-each>
578
580
  </xsl:for-each>
579
581
 
580
- <xsl:call-template name="index-pages"/>
582
+ <xsl:call-template name="index-pages">
583
+ <xsl:with-param name="num" select="$num"/>
584
+ </xsl:call-template>
581
585
 
582
586
  </xsl:for-each>
583
587
  </xsl:for-each>
@@ -2102,6 +2106,7 @@
2102
2106
  </fo:block>
2103
2107
  </xsl:otherwise>
2104
2108
  </xsl:choose>
2109
+ <xsl:call-template name="setNamedDestination"/>
2105
2110
  <fo:block>
2106
2111
  <xsl:call-template name="setId"/>
2107
2112
  <xsl:call-template name="addReviewHelper"/>
@@ -2117,6 +2122,7 @@
2117
2122
  <xsl:value-of select="$linebreak"/>
2118
2123
  </fo:block>
2119
2124
  </xsl:if>
2125
+ <xsl:call-template name="setNamedDestination"/>
2120
2126
  <xsl:apply-templates/>
2121
2127
  </xsl:template>
2122
2128
  <!-- ============================= -->
@@ -2135,6 +2141,7 @@
2135
2141
  <xsl:otherwise>fo:block</xsl:otherwise>
2136
2142
  </xsl:choose>
2137
2143
  </xsl:variable>
2144
+ <xsl:call-template name="setNamedDestination"/>
2138
2145
 
2139
2146
  <xsl:variable name="p_styles">
2140
2147
  <styles xsl:use-attribute-sets="p-style">
@@ -2170,10 +2177,12 @@
2170
2177
  <!-- ============================= -->
2171
2178
 
2172
2179
  <xsl:template match="mn:clause[starts-with(@id, 'draft-warning')]/mn:fmt-title" mode="caution">
2180
+ <xsl:call-template name="setNamedDestination"/>
2173
2181
  <fo:block font-size="16pt" font-style="italic" font-weight="bold" text-align="center" space-after="6pt" role="H1">
2174
2182
  <xsl:if test="$lang = 'ar'"> <!-- to prevent rendering `###` due the missing Arabic glyphs in the italic font (Times New Roman) -->
2175
2183
  <xsl:attribute name="font-style">normal</xsl:attribute>
2176
2184
  </xsl:if>
2185
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
2177
2186
  <xsl:apply-templates/>
2178
2187
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
2179
2188
  </fo:block>
@@ -2203,6 +2212,8 @@
2203
2212
  </xsl:choose>
2204
2213
  </xsl:variable>
2205
2214
 
2215
+ <xsl:call-template name="setNamedDestination"/>
2216
+
2206
2217
  <xsl:variable name="title_styles">
2207
2218
  <styles xsl:use-attribute-sets="title-style"><xsl:call-template name="refine_title-style"><xsl:with-param name="element-name" select="$element-name"/></xsl:call-template></styles>
2208
2219
  </xsl:variable>
@@ -2210,6 +2221,8 @@
2210
2221
  <xsl:element name="{$element-name}">
2211
2222
  <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*"/>
2212
2223
 
2224
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
2225
+
2213
2226
  <xsl:apply-templates/>
2214
2227
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
2215
2228
 
@@ -2261,12 +2274,17 @@
2261
2274
  </xsl:template>
2262
2275
 
2263
2276
  <xsl:template match="mn:fmt-preferred" priority="2">
2277
+ <xsl:call-template name="setNamedDestination"/>
2264
2278
  <fo:block xsl:use-attribute-sets="term-preferred-block-style">
2265
2279
  <xsl:call-template name="refine_term-preferred-block-style"/>
2266
2280
 
2267
2281
  <fo:inline xsl:use-attribute-sets="term-number-style">
2268
2282
  <xsl:call-template name="refine_term-number-style"/>
2269
2283
 
2284
+ <xsl:for-each select="ancestor::mn:term[1]/mn:fmt-name">
2285
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
2286
+ </xsl:for-each>
2287
+
2270
2288
  <xsl:apply-templates select="ancestor::mn:term[1]/mn:fmt-name"/>
2271
2289
  </fo:inline>
2272
2290
  <fo:inline xsl:use-attribute-sets="term-preferred-style">
@@ -3822,6 +3840,46 @@
3822
3840
  </xsl:template>
3823
3841
 
3824
3842
  <xsl:template name="addNamedDestinationAttribute">
3843
+ <xsl:variable name="docnum"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
3844
+ <xsl:variable name="caption_label" select="translate(normalize-space(.//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
3845
+
3846
+ <xsl:variable name="named_dest_">
3847
+ <xsl:choose>
3848
+ <xsl:when test="count(ancestor::mn:figure) &gt; 1"/> <!-- prevent id 'a)' -->
3849
+ <xsl:when test="ancestor::mn:note or ancestor::mn:example or ancestor::mn:termnote or ancestor::mn:termexample or ancestor::mn:admonition"/>
3850
+ <xsl:when test="$caption_label = '' and parent::mn:foreword">
3851
+ <xsl:variable name="foreword_number"><xsl:number count="mn:foreword" level="any"/></xsl:variable>
3852
+ <xsl:if test="$foreword_number = 1">Foreword</xsl:if>
3853
+ </xsl:when>
3854
+ <xsl:when test="$caption_label = '' and parent::mn:introduction">
3855
+ <xsl:variable name="introduction_number"><xsl:number count="mn:introduction" level="any"/></xsl:variable>
3856
+ <xsl:if test="$introduction_number = 1">Introduction</xsl:if>
3857
+ </xsl:when>
3858
+ <xsl:when test="$caption_label = ''"/>
3859
+ <xsl:when test="../@unnumbered = 'true'"/>
3860
+ <xsl:when test="normalize-space(java:matches(java:java.lang.String.new($caption_label), '[\x21-\xFF]+')) = 'false'"/>
3861
+ <!-- 1.1 in Appendix 1 -->
3862
+ <xsl:otherwise>
3863
+ <xsl:if test="ancestor::mn:annex and string(number(substring($caption_label, 1, 1))) != 'NaN'">
3864
+ <xsl:variable name="annex_caption_label" select="translate(normalize-space(ancestor::mn:annex[1]/mn:fmt-title//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
3865
+ <xsl:value-of select="concat($annex_caption_label, '_')"/>
3866
+ </xsl:if>
3867
+ <xsl:if test="parent::mn:formula">Formula</xsl:if>
3868
+ <xsl:value-of select="$caption_label"/>
3869
+ </xsl:otherwise>
3870
+ </xsl:choose>
3871
+ </xsl:variable>
3872
+ <xsl:variable name="named_dest" select="normalize-space($named_dest_)"/>
3873
+ <xsl:if test="$named_dest != ''">
3874
+ <xsl:variable name="named_dest_doc_">
3875
+ <xsl:value-of select="$named_dest"/>
3876
+ <xsl:if test="$docnum != '1'">_<xsl:value-of select="$docnum"/></xsl:if>
3877
+ </xsl:variable>
3878
+ <xsl:variable name="named_dest_doc" select="normalize-space($named_dest_doc_)"/>
3879
+ <xsl:if test="not(key('kid', $named_dest_doc))"> <!-- if element with id '$named_dest_doc' doesn't exist in the document -->
3880
+ <xsl:attribute name="named_dest"><xsl:value-of select="normalize-space($named_dest_doc)"/></xsl:attribute>
3881
+ </xsl:if>
3882
+ </xsl:if>
3825
3883
  </xsl:template>
3826
3884
 
3827
3885
  <xsl:template match="mn:fmt-name" mode="update_xml_step1">
@@ -4777,9 +4835,11 @@
4777
4835
  </xsl:template>
4778
4836
 
4779
4837
  <xsl:template match="mn:feedback-statement//mn:p">
4838
+ <xsl:param name="skip_id">false</xsl:param>
4780
4839
  <xsl:param name="margin"/>
4781
4840
  <!-- process in the template 'paragraph' -->
4782
4841
  <xsl:call-template name="paragraph">
4842
+ <xsl:with-param name="skip_id" select="$skip_id"/>
4783
4843
  <xsl:with-param name="margin" select="$margin"/>
4784
4844
  </xsl:call-template>
4785
4845
  </xsl:template>
@@ -11263,7 +11323,12 @@
11263
11323
  <xsl:template match="mn:figure[@class = 'pseudocode']">
11264
11324
  <xsl:call-template name="setNamedDestination"/>
11265
11325
  <fo:block id="{@id}">
11266
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
11326
+ <fo:block role="SKIP">
11327
+ <xsl:for-each select="mn:fmt-name"> <!-- set context -->
11328
+ <xsl:call-template name="setIDforNamedDestination"/>
11329
+ </xsl:for-each>
11330
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
11331
+ </fo:block>
11267
11332
  </fo:block>
11268
11333
  <xsl:apply-templates select="mn:fmt-name"/>
11269
11334
  </xsl:template>
@@ -13879,7 +13944,7 @@
13879
13944
  </xsl:variable>
13880
13945
 
13881
13946
  <xsl:template name="index-pages">
13882
- <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
13947
+ <xsl:param name="num"/>
13883
13948
 
13884
13949
  <xsl:variable name="docid">
13885
13950
  <xsl:call-template name="getDocumentId"/>
@@ -13899,10 +13964,17 @@
13899
13964
  </xsl:apply-templates>
13900
13965
  </xsl:template>
13901
13966
  <xsl:template match="mn:indexsect"/>
13967
+ <xsl:template match="/" mode="index">
13968
+ <xsl:param name="num"/>
13969
+ <xsl:apply-templates mode="index">
13970
+ <xsl:with-param name="num" select="$num"/>
13971
+ </xsl:apply-templates>
13972
+ </xsl:template>
13902
13973
  <xsl:template match="mn:indexsect" mode="index">
13903
13974
  <xsl:param name="num"/>
13904
13975
  <fo:page-sequence master-reference="index" force-page-count="no-force">
13905
13976
  <xsl:call-template name="insertHeaderFooter">
13977
+ <xsl:with-param name="num" select="$num"/>
13906
13978
  <xsl:with-param name="section">main</xsl:with-param>
13907
13979
  </xsl:call-template>
13908
13980
  <fo:flow flow-name="xsl-region-body">
@@ -15691,6 +15763,7 @@
15691
15763
  <xsl:otherwise>justify</xsl:otherwise>
15692
15764
  </xsl:choose>
15693
15765
  </xsl:attribute>
15766
+ <xsl:call-template name="copyParagraphId"/>
15694
15767
  <!-- $namespace = 'itu' -->
15695
15768
 
15696
15769
  </xsl:template> <!-- refine_p-style -->
@@ -15816,6 +15889,15 @@
15816
15889
  </xsl:if>
15817
15890
  </xsl:template>
15818
15891
 
15892
+ <!-- debug templates -->
15893
+ <xsl:template name="debug_contents">
15894
+ <xsl:if test="$debug = 'true'">
15895
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
15896
+ <xsl:copy-of select="$contents"/>
15897
+ </redirect:write>
15898
+ </xsl:if>
15899
+ </xsl:template>
15900
+
15819
15901
  <xsl:template name="processPrefaceSectionsDefault">
15820
15902
  <xsl:param name="num"/>
15821
15903
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
@@ -17032,14 +17114,18 @@
17032
17114
  </xsl:template>
17033
17115
 
17034
17116
  <xsl:template name="setIDforNamedDestination">
17035
- <xsl:if test="@named_dest">
17036
- <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
17117
+ <xsl:if test="$isGenerateTableIF = 'false'">
17118
+ <xsl:if test="@named_dest">
17119
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
17120
+ </xsl:if>
17037
17121
  </xsl:if>
17038
17122
  </xsl:template>
17039
17123
 
17040
17124
  <xsl:template name="setIDforNamedDestinationInline">
17041
- <xsl:if test="@named_dest">
17042
- <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
17125
+ <xsl:if test="$isGenerateTableIF = 'false'">
17126
+ <xsl:if test="@named_dest">
17127
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
17128
+ </xsl:if>
17043
17129
  </xsl:if>
17044
17130
  </xsl:template>
17045
17131
 
@@ -17049,7 +17135,7 @@
17049
17135
  <xsl:if test="@id and normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}.*')) = 'false'">
17050
17136
  <fox:destination internal-destination="{@id}"/>
17051
17137
  </xsl:if>
17052
- <xsl:for-each select=". | mn:fmt-title | mn:fmt-name">
17138
+ <xsl:for-each select=". | mn:fmt-title[1] | mn:fmt-name[1]">
17053
17139
  <xsl:if test="@named_dest">
17054
17140
  <fox:destination internal-destination="{@named_dest}"/>
17055
17141
  </xsl:if>
@@ -17057,6 +17143,12 @@
17057
17143
  </xsl:if>
17058
17144
  </xsl:template>
17059
17145
 
17146
+ <xsl:template name="copyParagraphId">
17147
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}.*')) = 'false'">
17148
+ <xsl:copy-of select="@id"/>
17149
+ </xsl:if>
17150
+ </xsl:template>
17151
+
17060
17152
  <xsl:template name="add-letter-spacing">
17061
17153
  <xsl:param name="text"/>
17062
17154
  <xsl:param name="letter-spacing" select="'0.15'"/>
@@ -17279,7 +17371,7 @@
17279
17371
  <xsl:template name="insertCoverPageFullImage">
17280
17372
  <xsl:param name="name">coverpage-image</xsl:param>
17281
17373
  <xsl:for-each select="//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/*[local-name() = $name][1]/mn:image">
17282
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
17374
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
17283
17375
  <fo:flow flow-name="xsl-region-body">
17284
17376
  <xsl:call-template name="insertBackgroundPageImage">
17285
17377
  <xsl:with-param name="number" select="position()"/>
@@ -17743,6 +17835,18 @@
17743
17835
  </xsl:attribute>
17744
17836
  </xsl:template>
17745
17837
 
17838
+ <xsl:template name="insert_firstpage_id">
17839
+ <xsl:param name="num"/>
17840
+ <fo:wrapper role="artifact">
17841
+ <fo:block-container absolute-position="fixed" top="1mm">
17842
+ <xsl:if test="$num = 1">
17843
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
17844
+ </xsl:if>
17845
+ <fo:block id="firstpage_id_{$num}" role="SKIP"> </fo:block>
17846
+ </fo:block-container>
17847
+ </fo:wrapper>
17848
+ </xsl:template>
17849
+
17746
17850
  <xsl:template name="getCharByCodePoint">
17747
17851
  <xsl:param name="codepoint"/>
17748
17852
  <xsl:param name="radix">16</xsl:param>
@@ -4,6 +4,8 @@
4
4
 
5
5
  <xsl:key name="kfn" match="mn:fn[not(ancestor::*[self::mn:table or self::mn:figure or self::mn:localized-strings] and not(ancestor::mn:fmt-name))]" use="@reference"/>
6
6
 
7
+ <xsl:key name="kid" match="*" use="@id"/>
8
+
7
9
  <xsl:variable name="debug">false</xsl:variable>
8
10
 
9
11
  <!-- Example:
@@ -577,7 +579,9 @@
577
579
  </xsl:for-each>
578
580
  </xsl:for-each>
579
581
 
580
- <xsl:call-template name="index-pages"/>
582
+ <xsl:call-template name="index-pages">
583
+ <xsl:with-param name="num" select="$num"/>
584
+ </xsl:call-template>
581
585
 
582
586
  </xsl:for-each>
583
587
  </xsl:for-each>
@@ -2102,6 +2106,7 @@
2102
2106
  </fo:block>
2103
2107
  </xsl:otherwise>
2104
2108
  </xsl:choose>
2109
+ <xsl:call-template name="setNamedDestination"/>
2105
2110
  <fo:block>
2106
2111
  <xsl:call-template name="setId"/>
2107
2112
  <xsl:call-template name="addReviewHelper"/>
@@ -2117,6 +2122,7 @@
2117
2122
  <xsl:value-of select="$linebreak"/>
2118
2123
  </fo:block>
2119
2124
  </xsl:if>
2125
+ <xsl:call-template name="setNamedDestination"/>
2120
2126
  <xsl:apply-templates/>
2121
2127
  </xsl:template>
2122
2128
  <!-- ============================= -->
@@ -2135,6 +2141,7 @@
2135
2141
  <xsl:otherwise>fo:block</xsl:otherwise>
2136
2142
  </xsl:choose>
2137
2143
  </xsl:variable>
2144
+ <xsl:call-template name="setNamedDestination"/>
2138
2145
 
2139
2146
  <xsl:variable name="p_styles">
2140
2147
  <styles xsl:use-attribute-sets="p-style">
@@ -2170,10 +2177,12 @@
2170
2177
  <!-- ============================= -->
2171
2178
 
2172
2179
  <xsl:template match="mn:clause[starts-with(@id, 'draft-warning')]/mn:fmt-title" mode="caution">
2180
+ <xsl:call-template name="setNamedDestination"/>
2173
2181
  <fo:block font-size="16pt" font-style="italic" font-weight="bold" text-align="center" space-after="6pt" role="H1">
2174
2182
  <xsl:if test="$lang = 'ar'"> <!-- to prevent rendering `###` due the missing Arabic glyphs in the italic font (Times New Roman) -->
2175
2183
  <xsl:attribute name="font-style">normal</xsl:attribute>
2176
2184
  </xsl:if>
2185
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
2177
2186
  <xsl:apply-templates/>
2178
2187
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
2179
2188
  </fo:block>
@@ -2203,6 +2212,8 @@
2203
2212
  </xsl:choose>
2204
2213
  </xsl:variable>
2205
2214
 
2215
+ <xsl:call-template name="setNamedDestination"/>
2216
+
2206
2217
  <xsl:variable name="title_styles">
2207
2218
  <styles xsl:use-attribute-sets="title-style"><xsl:call-template name="refine_title-style"><xsl:with-param name="element-name" select="$element-name"/></xsl:call-template></styles>
2208
2219
  </xsl:variable>
@@ -2210,6 +2221,8 @@
2210
2221
  <xsl:element name="{$element-name}">
2211
2222
  <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*"/>
2212
2223
 
2224
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
2225
+
2213
2226
  <xsl:apply-templates/>
2214
2227
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
2215
2228
 
@@ -2261,12 +2274,17 @@
2261
2274
  </xsl:template>
2262
2275
 
2263
2276
  <xsl:template match="mn:fmt-preferred" priority="2">
2277
+ <xsl:call-template name="setNamedDestination"/>
2264
2278
  <fo:block xsl:use-attribute-sets="term-preferred-block-style">
2265
2279
  <xsl:call-template name="refine_term-preferred-block-style"/>
2266
2280
 
2267
2281
  <fo:inline xsl:use-attribute-sets="term-number-style">
2268
2282
  <xsl:call-template name="refine_term-number-style"/>
2269
2283
 
2284
+ <xsl:for-each select="ancestor::mn:term[1]/mn:fmt-name">
2285
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
2286
+ </xsl:for-each>
2287
+
2270
2288
  <xsl:apply-templates select="ancestor::mn:term[1]/mn:fmt-name"/>
2271
2289
  </fo:inline>
2272
2290
  <fo:inline xsl:use-attribute-sets="term-preferred-style">
@@ -3822,6 +3840,46 @@
3822
3840
  </xsl:template>
3823
3841
 
3824
3842
  <xsl:template name="addNamedDestinationAttribute">
3843
+ <xsl:variable name="docnum"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
3844
+ <xsl:variable name="caption_label" select="translate(normalize-space(.//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
3845
+
3846
+ <xsl:variable name="named_dest_">
3847
+ <xsl:choose>
3848
+ <xsl:when test="count(ancestor::mn:figure) &gt; 1"/> <!-- prevent id 'a)' -->
3849
+ <xsl:when test="ancestor::mn:note or ancestor::mn:example or ancestor::mn:termnote or ancestor::mn:termexample or ancestor::mn:admonition"/>
3850
+ <xsl:when test="$caption_label = '' and parent::mn:foreword">
3851
+ <xsl:variable name="foreword_number"><xsl:number count="mn:foreword" level="any"/></xsl:variable>
3852
+ <xsl:if test="$foreword_number = 1">Foreword</xsl:if>
3853
+ </xsl:when>
3854
+ <xsl:when test="$caption_label = '' and parent::mn:introduction">
3855
+ <xsl:variable name="introduction_number"><xsl:number count="mn:introduction" level="any"/></xsl:variable>
3856
+ <xsl:if test="$introduction_number = 1">Introduction</xsl:if>
3857
+ </xsl:when>
3858
+ <xsl:when test="$caption_label = ''"/>
3859
+ <xsl:when test="../@unnumbered = 'true'"/>
3860
+ <xsl:when test="normalize-space(java:matches(java:java.lang.String.new($caption_label), '[\x21-\xFF]+')) = 'false'"/>
3861
+ <!-- 1.1 in Appendix 1 -->
3862
+ <xsl:otherwise>
3863
+ <xsl:if test="ancestor::mn:annex and string(number(substring($caption_label, 1, 1))) != 'NaN'">
3864
+ <xsl:variable name="annex_caption_label" select="translate(normalize-space(ancestor::mn:annex[1]/mn:fmt-title//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
3865
+ <xsl:value-of select="concat($annex_caption_label, '_')"/>
3866
+ </xsl:if>
3867
+ <xsl:if test="parent::mn:formula">Formula</xsl:if>
3868
+ <xsl:value-of select="$caption_label"/>
3869
+ </xsl:otherwise>
3870
+ </xsl:choose>
3871
+ </xsl:variable>
3872
+ <xsl:variable name="named_dest" select="normalize-space($named_dest_)"/>
3873
+ <xsl:if test="$named_dest != ''">
3874
+ <xsl:variable name="named_dest_doc_">
3875
+ <xsl:value-of select="$named_dest"/>
3876
+ <xsl:if test="$docnum != '1'">_<xsl:value-of select="$docnum"/></xsl:if>
3877
+ </xsl:variable>
3878
+ <xsl:variable name="named_dest_doc" select="normalize-space($named_dest_doc_)"/>
3879
+ <xsl:if test="not(key('kid', $named_dest_doc))"> <!-- if element with id '$named_dest_doc' doesn't exist in the document -->
3880
+ <xsl:attribute name="named_dest"><xsl:value-of select="normalize-space($named_dest_doc)"/></xsl:attribute>
3881
+ </xsl:if>
3882
+ </xsl:if>
3825
3883
  </xsl:template>
3826
3884
 
3827
3885
  <xsl:template match="mn:fmt-name" mode="update_xml_step1">
@@ -4777,9 +4835,11 @@
4777
4835
  </xsl:template>
4778
4836
 
4779
4837
  <xsl:template match="mn:feedback-statement//mn:p">
4838
+ <xsl:param name="skip_id">false</xsl:param>
4780
4839
  <xsl:param name="margin"/>
4781
4840
  <!-- process in the template 'paragraph' -->
4782
4841
  <xsl:call-template name="paragraph">
4842
+ <xsl:with-param name="skip_id" select="$skip_id"/>
4783
4843
  <xsl:with-param name="margin" select="$margin"/>
4784
4844
  </xsl:call-template>
4785
4845
  </xsl:template>
@@ -11263,7 +11323,12 @@
11263
11323
  <xsl:template match="mn:figure[@class = 'pseudocode']">
11264
11324
  <xsl:call-template name="setNamedDestination"/>
11265
11325
  <fo:block id="{@id}">
11266
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
11326
+ <fo:block role="SKIP">
11327
+ <xsl:for-each select="mn:fmt-name"> <!-- set context -->
11328
+ <xsl:call-template name="setIDforNamedDestination"/>
11329
+ </xsl:for-each>
11330
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
11331
+ </fo:block>
11267
11332
  </fo:block>
11268
11333
  <xsl:apply-templates select="mn:fmt-name"/>
11269
11334
  </xsl:template>
@@ -13879,7 +13944,7 @@
13879
13944
  </xsl:variable>
13880
13945
 
13881
13946
  <xsl:template name="index-pages">
13882
- <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
13947
+ <xsl:param name="num"/>
13883
13948
 
13884
13949
  <xsl:variable name="docid">
13885
13950
  <xsl:call-template name="getDocumentId"/>
@@ -13899,10 +13964,17 @@
13899
13964
  </xsl:apply-templates>
13900
13965
  </xsl:template>
13901
13966
  <xsl:template match="mn:indexsect"/>
13967
+ <xsl:template match="/" mode="index">
13968
+ <xsl:param name="num"/>
13969
+ <xsl:apply-templates mode="index">
13970
+ <xsl:with-param name="num" select="$num"/>
13971
+ </xsl:apply-templates>
13972
+ </xsl:template>
13902
13973
  <xsl:template match="mn:indexsect" mode="index">
13903
13974
  <xsl:param name="num"/>
13904
13975
  <fo:page-sequence master-reference="index" force-page-count="no-force">
13905
13976
  <xsl:call-template name="insertHeaderFooter">
13977
+ <xsl:with-param name="num" select="$num"/>
13906
13978
  <xsl:with-param name="section">main</xsl:with-param>
13907
13979
  </xsl:call-template>
13908
13980
  <fo:flow flow-name="xsl-region-body">
@@ -15691,6 +15763,7 @@
15691
15763
  <xsl:otherwise>justify</xsl:otherwise>
15692
15764
  </xsl:choose>
15693
15765
  </xsl:attribute>
15766
+ <xsl:call-template name="copyParagraphId"/>
15694
15767
  <!-- $namespace = 'itu' -->
15695
15768
 
15696
15769
  </xsl:template> <!-- refine_p-style -->
@@ -15816,6 +15889,15 @@
15816
15889
  </xsl:if>
15817
15890
  </xsl:template>
15818
15891
 
15892
+ <!-- debug templates -->
15893
+ <xsl:template name="debug_contents">
15894
+ <xsl:if test="$debug = 'true'">
15895
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
15896
+ <xsl:copy-of select="$contents"/>
15897
+ </redirect:write>
15898
+ </xsl:if>
15899
+ </xsl:template>
15900
+
15819
15901
  <xsl:template name="processPrefaceSectionsDefault">
15820
15902
  <xsl:param name="num"/>
15821
15903
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
@@ -17032,14 +17114,18 @@
17032
17114
  </xsl:template>
17033
17115
 
17034
17116
  <xsl:template name="setIDforNamedDestination">
17035
- <xsl:if test="@named_dest">
17036
- <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
17117
+ <xsl:if test="$isGenerateTableIF = 'false'">
17118
+ <xsl:if test="@named_dest">
17119
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
17120
+ </xsl:if>
17037
17121
  </xsl:if>
17038
17122
  </xsl:template>
17039
17123
 
17040
17124
  <xsl:template name="setIDforNamedDestinationInline">
17041
- <xsl:if test="@named_dest">
17042
- <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
17125
+ <xsl:if test="$isGenerateTableIF = 'false'">
17126
+ <xsl:if test="@named_dest">
17127
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
17128
+ </xsl:if>
17043
17129
  </xsl:if>
17044
17130
  </xsl:template>
17045
17131
 
@@ -17049,7 +17135,7 @@
17049
17135
  <xsl:if test="@id and normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}.*')) = 'false'">
17050
17136
  <fox:destination internal-destination="{@id}"/>
17051
17137
  </xsl:if>
17052
- <xsl:for-each select=". | mn:fmt-title | mn:fmt-name">
17138
+ <xsl:for-each select=". | mn:fmt-title[1] | mn:fmt-name[1]">
17053
17139
  <xsl:if test="@named_dest">
17054
17140
  <fox:destination internal-destination="{@named_dest}"/>
17055
17141
  </xsl:if>
@@ -17057,6 +17143,12 @@
17057
17143
  </xsl:if>
17058
17144
  </xsl:template>
17059
17145
 
17146
+ <xsl:template name="copyParagraphId">
17147
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}.*')) = 'false'">
17148
+ <xsl:copy-of select="@id"/>
17149
+ </xsl:if>
17150
+ </xsl:template>
17151
+
17060
17152
  <xsl:template name="add-letter-spacing">
17061
17153
  <xsl:param name="text"/>
17062
17154
  <xsl:param name="letter-spacing" select="'0.15'"/>
@@ -17279,7 +17371,7 @@
17279
17371
  <xsl:template name="insertCoverPageFullImage">
17280
17372
  <xsl:param name="name">coverpage-image</xsl:param>
17281
17373
  <xsl:for-each select="//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/*[local-name() = $name][1]/mn:image">
17282
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
17374
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
17283
17375
  <fo:flow flow-name="xsl-region-body">
17284
17376
  <xsl:call-template name="insertBackgroundPageImage">
17285
17377
  <xsl:with-param name="number" select="position()"/>
@@ -17743,6 +17835,18 @@
17743
17835
  </xsl:attribute>
17744
17836
  </xsl:template>
17745
17837
 
17838
+ <xsl:template name="insert_firstpage_id">
17839
+ <xsl:param name="num"/>
17840
+ <fo:wrapper role="artifact">
17841
+ <fo:block-container absolute-position="fixed" top="1mm">
17842
+ <xsl:if test="$num = 1">
17843
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
17844
+ </xsl:if>
17845
+ <fo:block id="firstpage_id_{$num}" role="SKIP"> </fo:block>
17846
+ </fo:block-container>
17847
+ </fo:wrapper>
17848
+ </xsl:template>
17849
+
17746
17850
  <xsl:template name="getCharByCodePoint">
17747
17851
  <xsl:param name="codepoint"/>
17748
17852
  <xsl:param name="radix">16</xsl:param>