metanorma-ogc 2.9.2 → 2.9.4

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.
@@ -4,26 +4,41 @@
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
- <xsl:variable name="docnumber" select="java:toUpperCase(java:java.lang.String.new(/mn:metanorma/mn:bibdata/mn:docnumber))"/>
10
- <xsl:variable name="doctitle" select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']"/>
11
+ <xsl:variable name="variables_">
12
+ <xsl:for-each select="//mn:metanorma">
13
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
11
14
 
12
- <!-- <xsl:variable name="docLatestDate_">
13
- <xsl:for-each select="/*/mn:bibdata/mn:date[normalize-space(mn:on) != '']">
14
- <xsl:sort order="descending" select="mn:on"/>
15
- <xsl:if test="position() = 1"><xsl:value-of select="translate(mn:on, '-', '')"/></xsl:if>
16
- </xsl:for-each>
17
- </xsl:variable>
18
- <xsl:variable name="docLatestDate" select="normalize-space($docLatestDate_)"/>
15
+ <xsl:variable name="current_document">
16
+ <xsl:copy-of select="."/>
17
+ </xsl:variable>
19
18
 
20
- <xsl:variable name="selectedStyle_">
21
- <xsl:choose>
22
- <xsl:when test="$docLatestDate &gt;= '20211108'">2</xsl:when>
23
- <xsl:otherwise>1</xsl:otherwise>
24
- </xsl:choose>
19
+ <xsl:for-each select="xalan:nodeset($current_document)">
20
+ <mnx:doc num="{$num}">
21
+ <xsl:variable name="docnumber" select="java:toUpperCase(java:java.lang.String.new(/mn:metanorma/mn:bibdata/mn:docnumber))"/>
22
+ <docnumber><xsl:value-of select="$docnumber"/></docnumber>
23
+
24
+ <xsl:variable name="doctitle" select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']"/>
25
+ <doctitle><xsl:value-of select="$doctitle"/></doctitle>
26
+
27
+ <xsl:variable name="doctype">
28
+ <xsl:call-template name="capitalizeWords">
29
+ <xsl:with-param name="str"><xsl:call-template name="getDoctype"/></xsl:with-param>
30
+ </xsl:call-template>
31
+ </xsl:variable>
32
+ <doctype><xsl:value-of select="$doctype"/></doctype>
33
+
34
+ <xsl:variable name="copyright-owner" select="java:toUpperCase(java:java.lang.String.new(/mn:metanorma/mn:bibdata/mn:copyright/mn:owner/mn:organization/mn:name))"/>
35
+ <copyright-owner><xsl:value-of select="$copyright-owner"/></copyright-owner>
36
+
37
+ </mnx:doc>
38
+ </xsl:for-each>
39
+ </xsl:for-each>
25
40
  </xsl:variable>
26
- <xsl:variable name="selectedStyle" select="normalize-space($selectedStyle_)"/> -->
41
+ <xsl:variable name="variables" select="xalan:nodeset($variables_)"/>
27
42
 
28
43
  <xsl:variable name="layoutVersion_">
29
44
  <xsl:choose>
@@ -33,15 +48,7 @@
33
48
  </xsl:variable>
34
49
  <xsl:variable name="layoutVersion" select="normalize-space($layoutVersion_)"/>
35
50
 
36
- <xsl:variable name="doctype">
37
- <xsl:call-template name="capitalizeWords">
38
- <xsl:with-param name="str"><xsl:call-template name="getDoctype"/></xsl:with-param>
39
- </xsl:call-template>
40
- </xsl:variable>
41
-
42
- <xsl:variable name="copyright-owner" select="java:toUpperCase(java:java.lang.String.new(/mn:metanorma/mn:bibdata/mn:copyright/mn:owner/mn:organization/mn:name))"/>
43
-
44
- <xsl:variable name="presentation_metadata_color_text" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-text)"/>
51
+ <xsl:variable name="presentation_metadata_color_text" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-text)"/>
45
52
  <xsl:variable name="color_main">
46
53
  <xsl:choose>
47
54
  <xsl:when test="$presentation_metadata_color_text != ''"><xsl:value-of select="$presentation_metadata_color_text"/></xsl:when>
@@ -49,7 +56,7 @@
49
56
  </xsl:choose>
50
57
  </xsl:variable>
51
58
 
52
- <xsl:variable name="presentation_metadata_color_secondary_shade_1" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-secondary-shade-1)"/>
59
+ <xsl:variable name="presentation_metadata_color_secondary_shade_1" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-secondary-shade-1)"/>
53
60
  <xsl:variable name="color_design">
54
61
  <xsl:choose>
55
62
  <xsl:when test="$presentation_metadata_color_secondary_shade_1 != ''"><xsl:value-of select="$presentation_metadata_color_secondary_shade_1"/></xsl:when>
@@ -58,7 +65,7 @@
58
65
  </xsl:choose>
59
66
  </xsl:variable>
60
67
 
61
- <xsl:variable name="presentation_metadata_color_secondary_shade_2" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-secondary-shade-2)"/>
68
+ <xsl:variable name="presentation_metadata_color_secondary_shade_2" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-secondary-shade-2)"/>
62
69
  <xsl:variable name="color_design_light">
63
70
  <xsl:choose>
64
71
  <xsl:when test="$presentation_metadata_color_secondary_shade_2 != ''"><xsl:value-of select="$presentation_metadata_color_secondary_shade_2"/></xsl:when>
@@ -67,7 +74,7 @@
67
74
  </xsl:choose>
68
75
  </xsl:variable>
69
76
 
70
- <xsl:variable name="presentation_metadata_color_background_definition_term" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-definition-term)"/>
77
+ <xsl:variable name="presentation_metadata_color_background_definition_term" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-definition-term)"/>
71
78
  <xsl:variable name="color_dl_dt">
72
79
  <xsl:choose>
73
80
  <xsl:when test="$presentation_metadata_color_background_definition_term != ''"><xsl:value-of select="$presentation_metadata_color_background_definition_term"/></xsl:when>
@@ -75,7 +82,7 @@
75
82
  </xsl:choose>
76
83
  </xsl:variable>
77
84
 
78
- <xsl:variable name="presentation_metadata_color_background_definition_description" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-definition-description)"/>
85
+ <xsl:variable name="presentation_metadata_color_background_definition_description" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-definition-description)"/>
79
86
  <xsl:variable name="color_dl_dd">
80
87
  <xsl:choose>
81
88
  <xsl:when test="$presentation_metadata_color_background_definition_description != ''"><xsl:value-of select="$presentation_metadata_color_background_definition_description"/></xsl:when>
@@ -83,7 +90,7 @@
83
90
  </xsl:choose>
84
91
  </xsl:variable>
85
92
 
86
- <xsl:variable name="presentation_metadata_color_text_title" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-text-title)"/>
93
+ <xsl:variable name="presentation_metadata_color_text_title" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-text-title)"/>
87
94
  <xsl:variable name="color_text_title">
88
95
  <xsl:choose>
89
96
  <xsl:when test="$presentation_metadata_color_text_title != ''"><xsl:value-of select="$presentation_metadata_color_text_title"/></xsl:when>
@@ -91,7 +98,7 @@
91
98
  </xsl:choose>
92
99
  </xsl:variable>
93
100
 
94
- <xsl:variable name="presentation_metadata_color_background_page" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-page)"/>
101
+ <xsl:variable name="presentation_metadata_color_background_page" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-page)"/>
95
102
  <xsl:variable name="color-background-page">
96
103
  <xsl:choose>
97
104
  <xsl:when test="$presentation_metadata_color_background_page != ''"><xsl:value-of select="$presentation_metadata_color_background_page"/></xsl:when>
@@ -99,7 +106,7 @@
99
106
  </xsl:choose>
100
107
  </xsl:variable>
101
108
 
102
- <xsl:variable name="presentation_metadata_color_background_text_label_legacy" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-text-label-legacy)"/>
109
+ <xsl:variable name="presentation_metadata_color_background_text_label_legacy" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-text-label-legacy)"/>
103
110
  <xsl:variable name="color_background_blue">
104
111
  <xsl:choose>
105
112
  <xsl:when test="$presentation_metadata_color_background_text_label_legacy != ''"><xsl:value-of select="$presentation_metadata_color_background_text_label_legacy"/></xsl:when>
@@ -107,7 +114,7 @@
107
114
  </xsl:choose>
108
115
  </xsl:variable>
109
116
 
110
- <xsl:variable name="presentation_metadata_color_background_term_preferred_label" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-term-preferred-label)"/>
117
+ <xsl:variable name="presentation_metadata_color_background_term_preferred_label" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-term-preferred-label)"/>
111
118
  <xsl:variable name="color_term_preferred">
112
119
  <xsl:choose>
113
120
  <xsl:when test="$presentation_metadata_color_background_term_preferred_label != ''"><xsl:value-of select="$presentation_metadata_color_background_term_preferred_label"/></xsl:when>
@@ -115,7 +122,7 @@
115
122
  </xsl:choose>
116
123
  </xsl:variable>
117
124
 
118
- <xsl:variable name="presentation_metadata_color_background_term_deprecated_label" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-term-deprecated-label)"/>
125
+ <xsl:variable name="presentation_metadata_color_background_term_deprecated_label" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-term-deprecated-label)"/>
119
126
  <xsl:variable name="color_term_deprecated">
120
127
  <xsl:choose>
121
128
  <xsl:when test="$presentation_metadata_color_background_term_deprecated_label != ''"><xsl:value-of select="$presentation_metadata_color_background_term_deprecated_label"/></xsl:when>
@@ -123,7 +130,7 @@
123
130
  </xsl:choose>
124
131
  </xsl:variable>
125
132
 
126
- <xsl:variable name="presentation_metadata_color_background_term_admitted_label" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-term-admitted-label)"/>
133
+ <xsl:variable name="presentation_metadata_color_background_term_admitted_label" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-term-admitted-label)"/>
127
134
  <xsl:variable name="color_term_admitted">
128
135
  <xsl:choose>
129
136
  <xsl:when test="$presentation_metadata_color_background_term_admitted_label != ''"><xsl:value-of select="$presentation_metadata_color_background_term_admitted_label"/></xsl:when>
@@ -131,7 +138,7 @@
131
138
  </xsl:choose>
132
139
  </xsl:variable>
133
140
 
134
- <xsl:variable name="presentation_metadata_color_background_table_header" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-table-header)"/>
141
+ <xsl:variable name="presentation_metadata_color_background_table_header" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-table-header)"/>
135
142
  <xsl:variable name="color_table_header_row">
136
143
  <xsl:choose>
137
144
  <xsl:when test="$presentation_metadata_color_background_table_header != ''"><xsl:value-of select="$presentation_metadata_color_background_table_header"/></xsl:when>
@@ -139,7 +146,7 @@
139
146
  </xsl:choose>
140
147
  </xsl:variable>
141
148
 
142
- <xsl:variable name="presentation_metadata_color_background_table_row_even" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-table-row-even)"/>
149
+ <xsl:variable name="presentation_metadata_color_background_table_row_even" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-table-row-even)"/>
143
150
  <xsl:variable name="color_table_row_even">
144
151
  <xsl:choose>
145
152
  <xsl:when test="$presentation_metadata_color_background_table_row_even != ''"><xsl:value-of select="$presentation_metadata_color_background_table_row_even"/></xsl:when>
@@ -147,7 +154,7 @@
147
154
  </xsl:choose>
148
155
  </xsl:variable>
149
156
 
150
- <xsl:variable name="presentation_metadata_color_background_table_row_odd" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-table-row-odd)"/>
157
+ <xsl:variable name="presentation_metadata_color_background_table_row_odd" select="normalize-space(//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:color-background-table-row-odd)"/>
151
158
  <xsl:variable name="color_table_row_odd">
152
159
  <xsl:choose>
153
160
  <xsl:when test="$presentation_metadata_color_background_table_row_odd != ''"><xsl:value-of select="$presentation_metadata_color_background_table_row_odd"/></xsl:when>
@@ -156,83 +163,113 @@
156
163
  </xsl:variable>
157
164
 
158
165
  <xsl:variable name="toc_recommendations_">
159
- <xsl:if test="//mn:metanorma/mn:metanorma-extension/mn:toc[@type='recommendation']/mn:title">
160
- <xsl:for-each select="//mn:table[.//mn:p[@class = 'RecommendationTitle']]">
161
- <xsl:variable name="table_id" select="@id"/>
162
- <recommendation alt-text="{.//mn:p[@class = 'RecommendationTitle'][1]}">
163
- <xsl:copy-of select="@id"/>
164
- <xsl:variable name="title">
165
- <xsl:apply-templates select=".//mn:p[@class = 'RecommendationTitle'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name/node()"/>
166
- <xsl:if test=".//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/node()">
167
- <xsl:text>: </xsl:text>
168
- <xsl:variable name="recommendationLabel">
169
- <tt><xsl:copy-of select=".//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name/node()"/></tt>
170
- </xsl:variable>
171
- <xsl:apply-templates select="xalan:nodeset($recommendationLabel)/node()"/>
172
- </xsl:if>
173
- </xsl:variable>
174
- <xsl:variable name="bookmark">
175
- <xsl:value-of select="normalize-space(.//mn:p[@class = 'RecommendationTitle'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name)"/>
176
- <xsl:if test=".//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/node()">
177
- <xsl:text>: </xsl:text>
178
- <xsl:value-of select="normalize-space(.//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name)"/>
179
- </xsl:if>
180
- </xsl:variable>
181
- <xsl:variable name="regex_str" select="'^([^0-9]+) (\d+).*'"/>
182
- <xsl:variable name="class" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$1')"/>
183
- <xsl:variable name="num" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$2')"/>
184
- <xsl:variable name="class_lc" select="java:toLowerCase(java:java.lang.String.new($class))"/>
185
- <!-- <xsl:attribute name="class_str">
186
- <xsl:value-of select="$class"/>
187
- </xsl:attribute> -->
188
- <xsl:attribute name="class">
189
- <xsl:choose>
190
- <xsl:when test="$class_lc = 'requirements class'">1</xsl:when>
191
- <xsl:when test="$class_lc = 'requirement'">2</xsl:when>
192
- <xsl:when test="$class_lc = 'recommendation'">3</xsl:when>
193
- <xsl:when test="$class_lc = 'permission'">4</xsl:when>
194
- <xsl:when test="$class_lc = 'conformance class'">5</xsl:when>
195
- <xsl:when test="$class_lc = 'abstract test'">6</xsl:when>
196
- <xsl:when test="$class_lc = 'requirement test'">7</xsl:when>
197
- <xsl:when test="$class_lc = 'recommendation test'">8</xsl:when>
198
- <xsl:when test="$class_lc = 'permission test'">9</xsl:when>
199
- <xsl:otherwise>9999</xsl:otherwise>
200
- </xsl:choose>
201
- </xsl:attribute>
202
- <xsl:attribute name="num">
203
- <xsl:value-of select="$num"/>
204
- </xsl:attribute>
205
- <title>
206
- <xsl:copy-of select="$title"/>
207
- </title>
208
- <bookmark>
209
- <xsl:value-of select="$bookmark"/>
210
- </bookmark>
211
- </recommendation>
166
+ <xsl:for-each select="//mn:metanorma">
167
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
168
+
169
+ <xsl:variable name="current_document">
170
+ <xsl:copy-of select="."/>
171
+ </xsl:variable>
172
+
173
+ <xsl:for-each select="xalan:nodeset($current_document)">
174
+ <mnx:doc num="{$num}">
175
+
176
+ <xsl:if test="//mn:metanorma/mn:metanorma-extension/mn:toc[@type='recommendation']/mn:title">
177
+ <xsl:for-each select="//mn:table[.//mn:p[@class = 'RecommendationTitle']]">
178
+ <xsl:variable name="table_id" select="@id"/>
179
+ <recommendation alt-text="{.//mn:p[@class = 'RecommendationTitle'][1]}">
180
+ <xsl:copy-of select="@id"/>
181
+ <xsl:variable name="title">
182
+ <xsl:apply-templates select=".//mn:p[@class = 'RecommendationTitle'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name/node()"/>
183
+ <xsl:if test=".//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/node()">
184
+ <xsl:text>: </xsl:text>
185
+ <xsl:variable name="recommendationLabel">
186
+ <tt><xsl:copy-of select=".//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name/node()"/></tt>
187
+ </xsl:variable>
188
+ <xsl:apply-templates select="xalan:nodeset($recommendationLabel)/node()"/>
189
+ </xsl:if>
190
+ </xsl:variable>
191
+ <xsl:variable name="bookmark">
192
+ <xsl:value-of select="normalize-space(.//mn:p[@class = 'RecommendationTitle'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name)"/>
193
+ <xsl:if test=".//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/node()">
194
+ <xsl:text>: </xsl:text>
195
+ <xsl:value-of select="normalize-space(.//mn:p[@class = 'RecommendationLabel'][ancestor::mn:table[1][@id= $table_id]]/mn:fmt-name)"/>
196
+ </xsl:if>
197
+ </xsl:variable>
198
+ <xsl:variable name="regex_str" select="'^([^0-9]+) (\d+).*'"/>
199
+ <xsl:variable name="class" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$1')"/>
200
+ <xsl:variable name="number" select="java:replaceAll(java:java.lang.String.new($bookmark), $regex_str, '$2')"/>
201
+ <xsl:variable name="class_lc" select="java:toLowerCase(java:java.lang.String.new($class))"/>
202
+ <!-- <xsl:attribute name="class_str">
203
+ <xsl:value-of select="$class"/>
204
+ </xsl:attribute> -->
205
+ <xsl:attribute name="class">
206
+ <xsl:choose>
207
+ <xsl:when test="$class_lc = 'requirements class'">1</xsl:when>
208
+ <xsl:when test="$class_lc = 'requirement'">2</xsl:when>
209
+ <xsl:when test="$class_lc = 'recommendation'">3</xsl:when>
210
+ <xsl:when test="$class_lc = 'permission'">4</xsl:when>
211
+ <xsl:when test="$class_lc = 'conformance class'">5</xsl:when>
212
+ <xsl:when test="$class_lc = 'abstract test'">6</xsl:when>
213
+ <xsl:when test="$class_lc = 'requirement test'">7</xsl:when>
214
+ <xsl:when test="$class_lc = 'recommendation test'">8</xsl:when>
215
+ <xsl:when test="$class_lc = 'permission test'">9</xsl:when>
216
+ <xsl:otherwise>9999</xsl:otherwise>
217
+ </xsl:choose>
218
+ </xsl:attribute>
219
+ <xsl:attribute name="num">
220
+ <xsl:value-of select="$number"/>
221
+ </xsl:attribute>
222
+ <title>
223
+ <xsl:copy-of select="$title"/>
224
+ </title>
225
+ <bookmark>
226
+ <xsl:value-of select="$bookmark"/>
227
+ </bookmark>
228
+ </recommendation>
229
+ </xsl:for-each>
230
+ </xsl:if>
231
+ </mnx:doc>
212
232
  </xsl:for-each>
213
- </xsl:if>
233
+ </xsl:for-each>
214
234
  </xsl:variable>
215
235
  <xsl:variable name="toc_recommendations__">
216
- <xsl:for-each select="xalan:nodeset($toc_recommendations_)/*">
217
- <xsl:sort select="@class" data-type="number"/>
218
- <xsl:sort select="@num" data-type="number"/>
219
- <xsl:copy-of select="."/>
236
+ <xsl:for-each select="xalan:nodeset($toc_recommendations_)/mnx:doc">
237
+ <xsl:copy>
238
+ <xsl:copy-of select="@*"/>
239
+ <xsl:for-each select="*">
240
+ <xsl:sort select="@class" data-type="number"/>
241
+ <xsl:sort select="@num" data-type="number"/>
242
+ <xsl:copy-of select="."/>
243
+ </xsl:for-each>
244
+ </xsl:copy>
220
245
  </xsl:for-each>
221
246
  </xsl:variable>
222
247
  <xsl:variable name="toc_recommendations" select="xalan:nodeset($toc_recommendations__)"/>
223
248
 
224
249
  <xsl:variable name="contents_">
225
- <mnx:contents>
226
- <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
227
- <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
228
-
229
- <xsl:call-template name="processMainSectionsDefault_Contents"/>
230
- <xsl:apply-templates select="//mn:indexsect" mode="contents"/>
231
-
232
- <xsl:call-template name="processTablesFigures_Contents"/>
233
- <!-- <xsl:with-param name="always">true</xsl:with-param>
234
- </xsl:call-template> -->
235
- </mnx:contents>
250
+ <xsl:variable name="bundle" select="count(//mn:metanorma) &gt; 1"/>
251
+ <xsl:for-each select="//mn:metanorma">
252
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
253
+ <xsl:variable name="docnumber"><xsl:value-of select="mn:bibdata/mn:docidentifier[@primary = 'true']"/></xsl:variable>
254
+ <xsl:variable name="current_document">
255
+ <xsl:copy-of select="."/>
256
+ </xsl:variable>
257
+ <xsl:for-each select="xalan:nodeset($current_document)">
258
+ <mnx:doc num="{$num}" firstpage_id="firstpage_id_{$num}" title-part="{$docnumber}" bundle="{$bundle}">
259
+ <mnx:contents>
260
+ <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
261
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
262
+
263
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
264
+ <xsl:apply-templates select="//mn:indexsect" mode="contents"/>
265
+
266
+ <xsl:call-template name="processTablesFigures_Contents"/>
267
+ <!-- <xsl:with-param name="always">true</xsl:with-param>
268
+ </xsl:call-template> -->
269
+ </mnx:contents>
270
+ </mnx:doc>
271
+ </xsl:for-each>
272
+ </xsl:for-each>
236
273
  </xsl:variable>
237
274
  <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
238
275
 
@@ -298,261 +335,267 @@
298
335
  <xsl:call-template name="addPDFUAmeta"/>
299
336
  </fo:declarations>
300
337
 
338
+ <xsl:call-template name="debug_contents"/>
339
+
301
340
  <xsl:call-template name="addBookmarks">
302
341
  <xsl:with-param name="contents" select="$contents"/>
303
342
  <xsl:with-param name="contents_addon">
304
- <xsl:if test="$contents//mnx:tables/mnx:table or $contents//mnx:figures/mnx:figure or $toc_recommendations/*[normalize-space(@id) != '']">
305
- <fo:bookmark internal-destination="empty_bookmark">
306
- <fo:bookmark-title>—————</fo:bookmark-title>
307
- </fo:bookmark>
308
- </xsl:if>
343
+ <xsl:if test="$contents//mnx:tables/mnx:table or $contents//mnx:figures/mnx:figure or $toc_recommendations//*[normalize-space(@id) != '']">
344
+ <fo:bookmark internal-destination="empty_bookmark">
345
+ <fo:bookmark-title>—————</fo:bookmark-title>
346
+ </fo:bookmark>
347
+ </xsl:if>
309
348
 
310
- <xsl:if test="$contents//mnx:tables/mnx:table">
311
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
312
- <fo:bookmark-title>
313
- <xsl:value-of select="$title-list-tables"/>
314
- </fo:bookmark-title>
315
- <xsl:for-each select="$contents//mnx:tables/mnx:table">
316
- <fo:bookmark internal-destination="{@id}">
317
- <xsl:variable name="title">
318
- <xsl:apply-templates select="mn:name | mn:fmt-name" mode="bookmarks"/>
319
- </xsl:variable>
320
- <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
321
- </fo:bookmark>
322
- </xsl:for-each>
323
- </fo:bookmark>
324
- </xsl:if>
349
+ <xsl:if test="$contents//mnx:tables/mnx:table">
350
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
351
+ <fo:bookmark-title>
352
+ <xsl:value-of select="$title-list-tables"/>
353
+ </fo:bookmark-title>
354
+ <xsl:for-each select="$contents//mnx:tables/mnx:table">
355
+ <fo:bookmark internal-destination="{@id}">
356
+ <xsl:variable name="title">
357
+ <xsl:apply-templates select="mn:name | mn:fmt-name" mode="bookmarks"/>
358
+ </xsl:variable>
359
+ <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
360
+ </fo:bookmark>
361
+ </xsl:for-each>
362
+ </fo:bookmark>
363
+ </xsl:if>
325
364
 
326
- <xsl:if test="$contents//mnx:figures/mnx:figure">
327
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
328
- <fo:bookmark-title>
329
- <xsl:value-of select="$title-list-figures"/>
330
- </fo:bookmark-title>
331
- <xsl:for-each select="$contents//mnx:figures/mnx:figure">
332
- <fo:bookmark internal-destination="{@id}">
333
- <xsl:variable name="title">
334
- <xsl:apply-templates select="mn:name | mn:fmt-name" mode="bookmarks"/>
335
- </xsl:variable>
336
- <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
337
- </fo:bookmark>
338
- </xsl:for-each>
339
- </fo:bookmark>
340
- </xsl:if>
365
+ <xsl:if test="$contents//mnx:figures/mnx:figure">
366
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
367
+ <fo:bookmark-title>
368
+ <xsl:value-of select="$title-list-figures"/>
369
+ </fo:bookmark-title>
370
+ <xsl:for-each select="$contents//mnx:figures/mnx:figure">
371
+ <fo:bookmark internal-destination="{@id}">
372
+ <xsl:variable name="title">
373
+ <xsl:apply-templates select="mn:name | mn:fmt-name" mode="bookmarks"/>
374
+ </xsl:variable>
375
+ <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
376
+ </fo:bookmark>
377
+ </xsl:for-each>
378
+ </fo:bookmark>
379
+ </xsl:if>
341
380
 
342
- <xsl:if test="$toc_recommendations/*[normalize-space(@id) != '']">
343
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
344
- <fo:bookmark-title>
345
- <xsl:value-of select="$title-list-recommendations"/>
346
- </fo:bookmark-title>
347
- <xsl:for-each select="$toc_recommendations/*[normalize-space(@id) != '']">
348
- <fo:bookmark internal-destination="{@id}">
349
- <fo:bookmark-title><xsl:value-of select="bookmark"/></fo:bookmark-title>
350
- </fo:bookmark>
351
- </xsl:for-each>
352
- </fo:bookmark>
353
- </xsl:if>
381
+ <xsl:if test="$toc_recommendations//*[normalize-space(@id) != '']">
382
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
383
+ <fo:bookmark-title>
384
+ <xsl:value-of select="$title-list-recommendations"/>
385
+ </fo:bookmark-title>
386
+ <xsl:for-each select="$toc_recommendations//*[normalize-space(@id) != '']">
387
+ <fo:bookmark internal-destination="{@id}">
388
+ <fo:bookmark-title><xsl:value-of select="bookmark"/></fo:bookmark-title>
389
+ </fo:bookmark>
390
+ </xsl:for-each>
391
+ </fo:bookmark>
392
+ </xsl:if>
354
393
  </xsl:with-param>
355
394
  </xsl:call-template>
356
395
 
357
- <xsl:call-template name="cover-page"/>
396
+ <xsl:variable name="updated_xml_step1">
397
+ <xsl:apply-templates mode="update_xml_step1"/>
398
+ </xsl:variable>
358
399
 
359
- <xsl:call-template name="inner-cover-page"/>
400
+ <xsl:for-each select="xalan:nodeset($updated_xml_step1)//mn:metanorma">
401
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
360
402
 
361
- <!-- Copyright, Content, Foreword, etc. pages -->
362
- <fo:page-sequence xsl:use-attribute-sets="page-sequence-preface">
363
- <xsl:call-template name="refine_page-sequence-preface"/>
364
- <xsl:attribute name="initial-page-number">2</xsl:attribute>
403
+ <xsl:variable name="current_document">
404
+ <xsl:copy-of select="."/>
405
+ </xsl:variable>
365
406
 
366
- <xsl:call-template name="insertFootnoteSeparator"/>
367
- <xsl:call-template name="insertHeaderFooter"/>
368
- <fo:flow flow-name="xsl-region-body">
407
+ <xsl:for-each select="xalan:nodeset($current_document)">
369
408
 
370
- <xsl:if test="$debug = 'true'">
371
- <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
372
- <xsl:copy-of select="$contents"/>
373
- </redirect:write>
374
- </xsl:if>
409
+ <xsl:call-template name="cover-page">
410
+ <xsl:with-param name="num" select="$num"/>
411
+ </xsl:call-template>
375
412
 
376
- <!-- crossing lines -->
377
- <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
378
- <fo:block>
379
- <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
380
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
381
- <line x1="230" y1="0" x2="2159" y2="490" stroke="{$color_design_light}"/>
382
- <line x1="0" y1="395" x2="820" y2="0" stroke="{$color_design_light}"/>
383
- <circle style="fill:{$color_design_light};" cx="614" cy="100" r="15"/>
384
- </svg>
385
- </fo:instream-foreign-object>
386
- </fo:block>
387
- </fo:block-container>
413
+ <xsl:call-template name="inner-cover-page"/>
388
414
 
389
- <xsl:call-template name="insertLogoPreface"/>
415
+ <!-- Copyright, Content, Foreword, etc. pages -->
416
+ <fo:page-sequence xsl:use-attribute-sets="page-sequence-preface">
417
+ <xsl:call-template name="refine_page-sequence-preface"/>
418
+ <xsl:attribute name="initial-page-number">2</xsl:attribute>
390
419
 
391
- <xsl:variable name="license_statement">
392
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:license-statement" mode="update_xml_step1"/>
393
- </xsl:variable>
394
- <xsl:apply-templates select="xalan:nodeset($license_statement)/*"/>
420
+ <xsl:call-template name="insertFootnoteSeparator"/>
421
+ <xsl:call-template name="insertHeaderFooter">
422
+ <xsl:with-param name="num" select="$num"/>
423
+ </xsl:call-template>
424
+ <fo:flow flow-name="xsl-region-body">
395
425
 
396
- <xsl:variable name="feedback_statement">
397
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement" mode="update_xml_step1"/>
398
- </xsl:variable>
399
- <xsl:apply-templates select="xalan:nodeset($feedback_statement)/*"/>
426
+ <!-- crossing lines -->
427
+ <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
428
+ <fo:block>
429
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
430
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
431
+ <line x1="230" y1="0" x2="2159" y2="490" stroke="{$color_design_light}"/>
432
+ <line x1="0" y1="395" x2="820" y2="0" stroke="{$color_design_light}"/>
433
+ <circle style="fill:{$color_design_light};" cx="614" cy="100" r="15"/>
434
+ </svg>
435
+ </fo:instream-foreign-object>
436
+ </fo:block>
437
+ </fo:block-container>
400
438
 
401
- <!-- Copyright notice -->
402
- <xsl:variable name="copyright_statement">
403
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:copyright-statement" mode="update_xml_step1"/>
404
- </xsl:variable>
405
- <xsl:apply-templates select="xalan:nodeset($copyright_statement)/*"/>
439
+ <xsl:call-template name="insertLogoPreface"/>
406
440
 
407
- </fo:flow>
408
- </fo:page-sequence>
441
+ <xsl:variable name="license_statement">
442
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:license-statement" mode="update_xml_step1"/>
443
+ </xsl:variable>
444
+ <xsl:apply-templates select="xalan:nodeset($license_statement)/*"/>
409
445
 
410
- <!-- <xsl:variable name="updated_xml"> -->
411
- <!-- <xsl:call-template name="updateXML"/> --> <!-- commented, because update_xml_step1 applied above already -->
412
- <!-- <xsl:copy-of select="."/>
413
- </xsl:variable>
414
-
415
- <xsl:for-each select="xalan:nodeset($updated_xml)/*"> -->
446
+ <xsl:variable name="feedback_statement">
447
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:feedback-statement" mode="update_xml_step1"/>
448
+ </xsl:variable>
449
+ <xsl:apply-templates select="xalan:nodeset($feedback_statement)/*"/>
416
450
 
417
- <xsl:variable name="updated_xml_step1">
418
- <xsl:apply-templates mode="update_xml_step1"/>
419
- </xsl:variable>
451
+ <!-- Copyright notice -->
452
+ <xsl:variable name="copyright_statement">
453
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/mn:copyright-statement" mode="update_xml_step1"/>
454
+ </xsl:variable>
455
+ <xsl:apply-templates select="xalan:nodeset($copyright_statement)/*"/>
420
456
 
421
- <xsl:for-each select="xalan:nodeset($updated_xml_step1)">
457
+ </fo:flow>
458
+ </fo:page-sequence>
422
459
 
423
- <xsl:variable name="updated_xml_with_pages">
424
- <xsl:call-template name="processPrefaceAndMainSectionsOGC_items"/>
425
- </xsl:variable>
460
+ <xsl:variable name="updated_xml_with_pages">
461
+ <xsl:call-template name="processPrefaceAndMainSectionsOGC_items"/>
462
+ </xsl:variable>
426
463
 
427
- <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
464
+ <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
428
465
 
429
- <xsl:for-each select=".//mn:page_sequence[parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
430
- <!-- Copyright, Content, Foreword, etc. pages -->
431
- <fo:page-sequence xsl:use-attribute-sets="page-sequence-preface">
432
- <xsl:call-template name="refine_page-sequence-preface"/>
466
+ <xsl:for-each select=".//mn:page_sequence[parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
467
+ <!-- Copyright, Content, Foreword, etc. pages -->
468
+ <fo:page-sequence xsl:use-attribute-sets="page-sequence-preface">
469
+ <xsl:call-template name="refine_page-sequence-preface"/>
433
470
 
434
- <xsl:attribute name="master-reference">
435
- <xsl:text>document</xsl:text>
436
- <xsl:call-template name="getPageSequenceOrientation"/>
437
- </xsl:attribute>
471
+ <xsl:attribute name="master-reference">
472
+ <xsl:text>document</xsl:text>
473
+ <xsl:call-template name="getPageSequenceOrientation"/>
474
+ </xsl:attribute>
438
475
 
439
- <xsl:call-template name="insertFootnoteSeparator"/>
440
- <xsl:call-template name="insertHeaderFooter"/>
441
- <fo:flow flow-name="xsl-region-body">
476
+ <xsl:call-template name="insertFootnoteSeparator"/>
477
+ <xsl:call-template name="insertHeaderFooter">
478
+ <xsl:with-param name="num" select="$num"/>
479
+ </xsl:call-template>
480
+ <fo:flow flow-name="xsl-region-body">
442
481
 
443
- <xsl:if test="position() = 1">
444
- <!-- crossing lines -->
445
- <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
446
- <fo:block>
447
- <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
448
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
449
- <line x1="0" y1="545" x2="2084" y2="0" stroke="{$color_design_light}"/>
450
- <line x1="0" y1="1374" x2="355" y2="0" stroke="{$color_design_light}"/>
451
- <circle style="fill:{$color_design_light};" cx="227" cy="487" r="15"/>
452
- </svg>
453
- </fo:instream-foreign-object>
454
- </fo:block>
455
- </fo:block-container>
456
- </xsl:if>
482
+ <xsl:if test="position() = 1">
483
+ <!-- crossing lines -->
484
+ <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
485
+ <fo:block>
486
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
487
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
488
+ <line x1="0" y1="545" x2="2084" y2="0" stroke="{$color_design_light}"/>
489
+ <line x1="0" y1="1374" x2="355" y2="0" stroke="{$color_design_light}"/>
490
+ <circle style="fill:{$color_design_light};" cx="227" cy="487" r="15"/>
491
+ </svg>
492
+ </fo:instream-foreign-object>
493
+ </fo:block>
494
+ </fo:block-container>
495
+ </xsl:if>
457
496
 
458
- <!-- Contents, Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
497
+ <!-- Contents, Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
459
498
 
460
- <!-- <xsl:for-each select="/*/mn:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
461
- <xsl:sort select="@displayorder" data-type="number"/>
462
-
463
- <xsl:if test="local-name() = 'foreword' or
464
- (local-name() = 'clause' and @type = 'security') or
465
- (local-name() = 'clause' and @type = 'submitting_orgs') or
466
- local-name() = 'introduction'">
467
- <fo:block break-after="page"/>
468
- </xsl:if>
469
-
470
- <fo:block>
471
- <xsl:if test="not(local-name() = 'clause' and @type = 'toc')">
472
- <xsl:attribute name="line-height">125%</xsl:attribute>
499
+ <!-- <xsl:for-each select="/*/mn:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
500
+ <xsl:sort select="@displayorder" data-type="number"/>
501
+
502
+ <xsl:if test="local-name() = 'foreword' or
503
+ (local-name() = 'clause' and @type = 'security') or
504
+ (local-name() = 'clause' and @type = 'submitting_orgs') or
505
+ local-name() = 'introduction'">
506
+ <fo:block break-after="page"/>
473
507
  </xsl:if>
474
508
 
475
- <xsl:apply-templates select="."/>
476
- </fo:block>
477
- </xsl:for-each> -->
478
-
479
- <!-- <fo:block line-height="100%"> -->
480
- <!-- <xsl:if test="not(local-name() = 'clause' and @type = 'toc')">
481
- <xsl:attribute name="line-height">125%</xsl:attribute>
482
- </xsl:if> -->
483
- <fo:block>
484
- <xsl:apply-templates/>
485
- </fo:block>
486
-
487
- </fo:flow>
488
- </fo:page-sequence>
509
+ <fo:block>
510
+ <xsl:if test="not(local-name() = 'clause' and @type = 'toc')">
511
+ <xsl:attribute name="line-height">125%</xsl:attribute>
512
+ </xsl:if>
513
+
514
+ <xsl:apply-templates select="."/>
515
+ </fo:block>
516
+ </xsl:for-each> -->
489
517
 
490
- </xsl:for-each>
518
+ <!-- <fo:block line-height="100%"> -->
519
+ <!-- <xsl:if test="not(local-name() = 'clause' and @type = 'toc')">
520
+ <xsl:attribute name="line-height">125%</xsl:attribute>
521
+ </xsl:if> -->
522
+ <fo:block>
523
+ <xsl:apply-templates>
524
+ <xsl:with-param name="num" select="$num"/>
525
+ </xsl:apply-templates>
526
+ </fo:block>
491
527
 
492
- <xsl:for-each select=".//mn:page_sequence[not(parent::mn:preface or parent::mn:boilerplate)][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
528
+ </fo:flow>
529
+ </fo:page-sequence>
493
530
 
494
- <!-- Document Pages -->
495
- <!-- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
496
- <xsl:sort select="@displayorder" data-type="number"/>
497
- <xsl:choose>
498
- <xsl:when test="local-name() = 'clause' and @type='scope'">
499
- <xsl:apply-templates select="." mode="sections">
500
- <xsl:with-param name="initial-page-number" select="1"/>
501
- </xsl:apply-templates>
502
- </xsl:when>
503
- <xsl:otherwise>
504
- <xsl:apply-templates select="." mode="sections"/>
505
- </xsl:otherwise>
506
- </xsl:choose>
507
- </xsl:for-each> -->
508
-
509
- <!-- <xsl:for-each select="/*/*[local-name()='annex']">
510
- <xsl:sort select="@displayorder" data-type="number"/>
511
- <xsl:apply-templates select="." mode="sections"/>
512
- </xsl:for-each> -->
531
+ </xsl:for-each>
513
532
 
514
- <!-- Bibliography -->
515
- <!-- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] |
516
- /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
517
- <xsl:sort select="@displayorder" data-type="number"/>
518
- <xsl:apply-templates select="." mode="sections"/>
519
- </xsl:for-each> -->
533
+ <xsl:for-each select=".//mn:page_sequence[not(parent::mn:preface or parent::mn:boilerplate)][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
520
534
 
521
- <xsl:variable name="initial_page_number">
522
- <xsl:if test="position() = 1">1</xsl:if>
523
- </xsl:variable>
535
+ <!-- Document Pages -->
536
+ <!-- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
537
+ <xsl:sort select="@displayorder" data-type="number"/>
538
+ <xsl:choose>
539
+ <xsl:when test="local-name() = 'clause' and @type='scope'">
540
+ <xsl:apply-templates select="." mode="sections">
541
+ <xsl:with-param name="initial-page-number" select="1"/>
542
+ </xsl:apply-templates>
543
+ </xsl:when>
544
+ <xsl:otherwise>
545
+ <xsl:apply-templates select="." mode="sections"/>
546
+ </xsl:otherwise>
547
+ </xsl:choose>
548
+ </xsl:for-each> -->
549
+
550
+ <!-- <xsl:for-each select="/*/*[local-name()='annex']">
551
+ <xsl:sort select="@displayorder" data-type="number"/>
552
+ <xsl:apply-templates select="." mode="sections"/>
553
+ </xsl:for-each> -->
554
+
555
+ <!-- Bibliography -->
556
+ <!-- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] |
557
+ /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
558
+ <xsl:sort select="@displayorder" data-type="number"/>
559
+ <xsl:apply-templates select="." mode="sections"/>
560
+ </xsl:for-each> -->
561
+
562
+ <xsl:variable name="initial_page_number">
563
+ <xsl:if test="position() = 1">1</xsl:if>
564
+ </xsl:variable>
524
565
 
525
- <xsl:apply-templates select="." mode="sections">
526
- <xsl:with-param name="initial-page-number" select="$initial_page_number"/>
527
- </xsl:apply-templates>
566
+ <xsl:apply-templates select="." mode="sections">
567
+ <xsl:with-param name="num" select="$num"/>
568
+ <xsl:with-param name="initial-page-number" select="$initial_page_number"/>
569
+ </xsl:apply-templates>
528
570
 
529
- <!-- End Document Pages -->
571
+ <!-- End Document Pages -->
530
572
 
531
- </xsl:for-each>
573
+ </xsl:for-each>
532
574
  </xsl:for-each>
533
- <!-- </xsl:for-each> -->
534
575
 
535
576
  <!-- <xsl:apply-templates select="//mn:indexsect" mode="sections"/> -->
536
577
 
578
+ </xsl:for-each>
537
579
  </xsl:for-each>
538
580
 
539
581
  <xsl:call-template name="back-page"/>
540
582
 
541
583
  </fo:root>
542
-
543
584
  </xsl:template>
544
585
 
545
586
  <xsl:template name="cover-page">
587
+ <xsl:param name="num"/>
546
588
  <!-- Cover Page -->
547
589
  <xsl:choose>
548
590
  <xsl:when test="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:coverpage-image/mn:image and normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/mn:full-coverpage-replacement) = 'true'">
549
591
  <xsl:call-template name="insertCoverPageFullImage"/>
550
592
  </xsl:when>
551
593
  <xsl:otherwise>
552
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
594
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
553
595
  <xsl:call-template name="insertFootnoteSeparatorCommon"/>
554
596
 
555
597
  <fo:flow flow-name="xsl-region-body" color="white">
598
+ <xsl:call-template name="insert_firstpage_id"><xsl:with-param name="num" select="$num"/></xsl:call-template>
556
599
 
557
600
  <xsl:variable name="curr_lang" select="/mn:metanorma/mn:bibdata/mn:language[@current = 'true']"/>
558
601
  <xsl:variable name="stage" select="/mn:metanorma/mn:bibdata/mn:status/mn:stage[@language = $curr_lang] | /mn:metanorma/mn:bibdata/mn:status/mn:stage[not(@language)]"/>
@@ -580,7 +623,7 @@
580
623
  <fo:table-row>
581
624
  <fo:table-cell font-weight="bold">
582
625
  <fo:block font-size="16pt" color="{$color_design}" margin-bottom="4pt">
583
- <xsl:variable name="ogc_document" select="concat('OGC® DOCUMENT: ', $docnumber)"/>
626
+ <xsl:variable name="ogc_document" select="concat('OGC® DOCUMENT: ', $variables/mnx:doc[@num = $num]/docnumber)"/>
584
627
  <xsl:call-template name="addLetterSpacing">
585
628
  <xsl:with-param name="text" select="$ogc_document"/>
586
629
  <xsl:with-param name="letter-spacing" select="0.3"/>
@@ -601,6 +644,8 @@
601
644
  </fo:table>
602
645
  </fo:block>
603
646
 
647
+ <xsl:variable name="doctitle" select="$variables/mnx:doc[@num = $num]/doctitle"/>
648
+
604
649
  <!-- <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm"> -->
605
650
  <fo:block-container absolute-position="fixed" left="16.5mm" top="40mm" height="170mm">
606
651
  <fo:block-container width="155mm" height="99%" display-align="center">
@@ -628,7 +673,7 @@
628
673
  <fo:block color="{$color_design}">
629
674
  <fo:block font-size="17pt">
630
675
  <xsl:call-template name="addLetterSpacing">
631
- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctype))"/>
676
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($variables/mnx:doc[@num = $num]/doctype))"/>
632
677
  </xsl:call-template>
633
678
  <xsl:value-of select="$linebreak"/>
634
679
  <xsl:variable name="docsubtype" select="normalize-space(/mn:metanorma/mn:bibdata/mn:ext/mn:subdoctype)"/>
@@ -888,6 +933,7 @@
888
933
  </xsl:template>
889
934
 
890
935
  <xsl:template match="mn:preface//mn:clause[@type = 'toc']" name="toc" priority="4">
936
+ <xsl:param name="num"/>
891
937
  <fo:block color="{$color_text_title}">
892
938
 
893
939
  <xsl:apply-templates/>
@@ -897,7 +943,8 @@
897
943
  <fo:block-container xsl:use-attribute-sets="toc-style">
898
944
  <xsl:call-template name="refine_toc-style"/>
899
945
  <fo:block role="TOC">
900
- <xsl:for-each select="$contents//mnx:item[@display = 'true' and normalize-space(@id) != '']">
946
+
947
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:item[@display = 'true' and normalize-space(@id) != '']">
901
948
 
902
949
  <fo:block xsl:use-attribute-sets="toc-item-style">
903
950
 
@@ -967,36 +1014,38 @@
967
1014
  </fo:block-container>
968
1015
 
969
1016
  <!-- List of Tables -->
970
- <xsl:if test="$contents//mnx:tables/mnx:table">
1017
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
971
1018
  <xsl:call-template name="insertListOf_Title">
972
1019
  <xsl:with-param name="title" select="$title-list-tables"/>
973
1020
  </xsl:call-template>
974
1021
  <fo:block-container line-height="130%" role="TOC">
975
- <xsl:for-each select="$contents//mnx:tables/mnx:table">
1022
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:tables/mnx:table">
976
1023
  <xsl:call-template name="insertListOf_Item"/>
977
1024
  </xsl:for-each>
978
1025
  </fo:block-container>
979
1026
  </xsl:if>
980
1027
 
981
1028
  <!-- List of Figures -->
982
- <xsl:if test="$contents//mnx:figures/mnx:figure">
1029
+ <xsl:if test="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
983
1030
  <xsl:call-template name="insertListOf_Title">
984
1031
  <xsl:with-param name="title" select="$title-list-figures"/>
985
1032
  </xsl:call-template>
986
1033
  <fo:block-container line-height="130%" role="TOC">
987
- <xsl:for-each select="$contents//mnx:figures/mnx:figure">
1034
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:figures/mnx:figure">
988
1035
  <xsl:call-template name="insertListOf_Item"/>
989
1036
  </xsl:for-each>
990
1037
  </fo:block-container>
991
1038
  </xsl:if>
992
1039
 
1040
+ <xsl:call-template name="debug_toc_recommendations"/>
1041
+
993
1042
  <!-- List of Recommendations -->
994
- <xsl:if test="$toc_recommendations/*[normalize-space(@id) != '']">
1043
+ <xsl:if test="$toc_recommendations/mnx:doc[@num = $num]/*[normalize-space(@id) != '']">
995
1044
  <xsl:call-template name="insertListOf_Title">
996
1045
  <xsl:with-param name="title" select="$title-list-recommendations"/>
997
1046
  </xsl:call-template>
998
1047
  <fo:block-container line-height="130%" role="TOC">
999
- <xsl:for-each select="$toc_recommendations/*[normalize-space(@id) != '']">
1048
+ <xsl:for-each select="$toc_recommendations/mnx:doc[@num = $num]/*[normalize-space(@id) != '']">
1000
1049
  <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
1001
1050
  <fo:basic-link internal-destination="{@id}">
1002
1051
  <xsl:call-template name="setAltText">
@@ -1115,6 +1164,7 @@
1115
1164
  </xsl:template>
1116
1165
 
1117
1166
  <xsl:template match="node()" mode="sections">
1167
+ <xsl:param name="num"/>
1118
1168
  <xsl:param name="initial-page-number"/>
1119
1169
 
1120
1170
  <xsl:if test="@main_page_sequence or self::mn:indexsect">
@@ -1127,6 +1177,7 @@
1127
1177
 
1128
1178
  <xsl:call-template name="insertHeaderFooter">
1129
1179
  <xsl:with-param name="color">white</xsl:with-param>
1180
+ <xsl:with-param name="num" select="$num"/>
1130
1181
  </xsl:call-template>
1131
1182
  <fo:flow flow-name="xsl-region-body">
1132
1183
 
@@ -1178,7 +1229,9 @@
1178
1229
  <xsl:call-template name="refine_page-sequence-main"/>
1179
1230
 
1180
1231
  <xsl:call-template name="insertFootnoteSeparator"/>
1181
- <xsl:call-template name="insertHeaderFooter"/>
1232
+ <xsl:call-template name="insertHeaderFooter">
1233
+ <xsl:with-param name="num" select="$num"/>
1234
+ </xsl:call-template>
1182
1235
  <fo:flow flow-name="xsl-region-body">
1183
1236
 
1184
1237
  <fo:block line-height="125%">
@@ -1249,6 +1302,9 @@
1249
1302
  <xsl:variable name="title">
1250
1303
  <xsl:call-template name="getName"/>
1251
1304
  </xsl:variable>
1305
+ <xsl:variable name="variant_title">
1306
+ <xsl:copy-of select="mn:variant-title[@type = 'toc']/node()"/>
1307
+ </xsl:variable>
1252
1308
 
1253
1309
  <xsl:variable name="type" select="local-name()"/>
1254
1310
 
@@ -1260,7 +1316,14 @@
1260
1316
  <xsl:attribute name="parent">annex</xsl:attribute>
1261
1317
  </xsl:if>
1262
1318
  <mnx:title>
1263
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1319
+ <xsl:choose>
1320
+ <xsl:when test="normalize-space($variant_title) != ''">
1321
+ <xsl:apply-templates select="xalan:nodeset($variant_title)" mode="contents_item"/>
1322
+ </xsl:when>
1323
+ <xsl:otherwise>
1324
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1325
+ </xsl:otherwise>
1326
+ </xsl:choose>
1264
1327
  </mnx:title>
1265
1328
  <xsl:if test="$type != 'indexsect'">
1266
1329
  <xsl:apply-templates mode="contents"/>
@@ -1352,6 +1415,8 @@
1352
1415
  </xsl:choose>
1353
1416
  </xsl:variable>
1354
1417
 
1418
+ <xsl:call-template name="setNamedDestination"/>
1419
+
1355
1420
  <xsl:variable name="title_styles"><styles xsl:use-attribute-sets="title-style"><xsl:call-template name="refine_title-style"/></styles></xsl:variable>
1356
1421
 
1357
1422
  <xsl:choose>
@@ -1366,6 +1431,7 @@
1366
1431
  <fo:table-body>
1367
1432
  <fo:table-row>
1368
1433
  <fo:table-cell>
1434
+ <xsl:call-template name="setIDforNamedDestination"/>
1369
1435
  <fo:block margin-top="-3mm">
1370
1436
  <xsl:for-each select="..">
1371
1437
  <xsl:call-template name="insertSectionNumInCircle">
@@ -1402,6 +1468,7 @@
1402
1468
  <xsl:when test="$level = 2">
1403
1469
  <fo:block>
1404
1470
  <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*[local-name() = 'space-before' or local-name() = 'margin-bottom' or local-name() = 'keep-with-next' or local-name() = 'role']"/>
1471
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
1405
1472
  <xsl:variable name="title">
1406
1473
  <xsl:choose>
1407
1474
  <xsl:when test="mn:tab">
@@ -1423,6 +1490,7 @@
1423
1490
  <xsl:otherwise>
1424
1491
  <xsl:element name="{$element-name}">
1425
1492
  <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*"/>
1493
+ <xsl:call-template name="setIDforNamedDestinationInline"/>
1426
1494
 
1427
1495
  <xsl:apply-templates/>
1428
1496
  <xsl:apply-templates select="following-sibling::*[1][self::mn:variant-title][@type = 'sub']" mode="subtitle"/>
@@ -1448,6 +1516,7 @@
1448
1516
  <xsl:otherwise>fo:block</xsl:otherwise>
1449
1517
  </xsl:choose>
1450
1518
  </xsl:variable>
1519
+ <xsl:call-template name="setNamedDestination"/>
1451
1520
 
1452
1521
  <xsl:variable name="p_styles">
1453
1522
  <styles xsl:use-attribute-sets="p-style">
@@ -1520,8 +1589,10 @@
1520
1589
  </xsl:template>
1521
1590
 
1522
1591
  <xsl:template match="mn:term/mn:fmt-name" priority="2">
1592
+ <xsl:call-template name="setNamedDestination"/>
1523
1593
  <fo:block xsl:use-attribute-sets="term-number-style">
1524
1594
  <xsl:call-template name="refine_term-number-style"/>
1595
+ <xsl:call-template name="setIDforNamedDestination"/>
1525
1596
  <fo:list-block color="{$color_text_title}" keep-with-next="always" provisional-distance-between-starts="{string-length()*3.25}mm">
1526
1597
  <fo:list-item>
1527
1598
  <fo:list-item-label end-indent="label-end()">
@@ -1612,8 +1683,13 @@
1612
1683
  <xsl:template match="mn:figure" priority="2">
1613
1684
  <xsl:param name="indent"/>
1614
1685
  <!-- <fo:block>debug figure indent=<xsl:value-of select="$indent"/></fo:block> -->
1686
+ <xsl:call-template name="setNamedDestination"/>
1615
1687
  <fo:block-container id="{@id}" margin-top="12pt" margin-bottom="12pt">
1616
1688
  <fo:block>
1689
+ <xsl:for-each select="mn:fmt-name">
1690
+ <xsl:call-template name="setIDforNamedDestination"/>
1691
+ </xsl:for-each>
1692
+
1617
1693
  <xsl:apply-templates select="mn:note[@type = 'units']"/>
1618
1694
  <xsl:apply-templates select="node()[not(self::mn:fmt-name) and not(self::mn:note and @type = 'units')]">
1619
1695
  <xsl:with-param name="indent" select="$indent"/>
@@ -1632,9 +1708,11 @@
1632
1708
  </xsl:template>
1633
1709
 
1634
1710
  <xsl:template name="insertHeaderFooter">
1711
+ <xsl:param name="num"/>
1635
1712
  <xsl:param name="color" select="$color_text_title"/>
1636
1713
  <xsl:call-template name="insertHeader"/>
1637
1714
  <xsl:call-template name="insertFooter">
1715
+ <xsl:with-param name="num" select="$num"/>
1638
1716
  <xsl:with-param name="color" select="$color"/>
1639
1717
  </xsl:call-template>
1640
1718
  </xsl:template>
@@ -1643,6 +1721,7 @@
1643
1721
  </xsl:template>
1644
1722
 
1645
1723
  <xsl:template name="insertFooter">
1724
+ <xsl:param name="num"/>
1646
1725
  <xsl:param name="color" select="$color_text_title"/>
1647
1726
  <fo:static-content flow-name="footer" role="artifact">
1648
1727
  <fo:block-container font-size="8pt" color="{$color}" padding-top="6mm">
@@ -1655,12 +1734,12 @@
1655
1734
  <fo:block>
1656
1735
  <fo:inline font-weight="bold">
1657
1736
  <xsl:call-template name="addLetterSpacing">
1658
- <xsl:with-param name="text" select="concat($copyright-owner, ' ')"/>
1737
+ <xsl:with-param name="text" select="concat($variables/mnx:doc[@num = $num]/copyright-owner, ' ')"/>
1659
1738
  <xsl:with-param name="letter-spacing" select="0.2"/>
1660
1739
  </xsl:call-template>
1661
1740
  </fo:inline>
1662
1741
  <xsl:call-template name="addLetterSpacing">
1663
- <xsl:with-param name="text" select="$docnumber"/>
1742
+ <xsl:with-param name="text" select="$variables/mnx:doc[@num = $num]/docnumber"/>
1664
1743
  <xsl:with-param name="letter-spacing" select="0.2"/>
1665
1744
  </xsl:call-template>
1666
1745
  </fo:block>
@@ -2575,7 +2654,24 @@
2575
2654
  <xsl:template match="mn:metanorma-extension/*[local-name() = 'UnitsML']" mode="update_xml_step1"/>
2576
2655
 
2577
2656
  <!-- remove image/emf -->
2578
- <xsl:template match="mn:image/mn:emf" mode="update_xml_step1"/>
2657
+ <xsl:template match="mn:image//mn:emf" mode="update_xml_step1"/>
2658
+
2659
+ <!-- https://github.com/metanorma/metanorma/issues/540 -->
2660
+ <xsl:template match="mn:image[mn:altsource]" priority="3" mode="update_xml_step1">
2661
+ <xsl:copy>
2662
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
2663
+ <xsl:choose>
2664
+ <xsl:when test="mn:altsource[contains(@tag, 'pdf')]">
2665
+ <xsl:apply-templates select="mn:altsource[contains(@tag, 'pdf')]/@*" mode="update_xml_step1"/>
2666
+ <xsl:apply-templates select="mn:altsource[contains(@tag, 'pdf')]/node()" mode="update_xml_step1"/>
2667
+ </xsl:when>
2668
+ <xsl:otherwise>
2669
+ <xsl:apply-templates select="mn:altsource[contains(@tag, 'default')]/@*" mode="update_xml_step1"/>
2670
+ <xsl:apply-templates select="mn:altsource[contains(@tag, 'default')]/node()" mode="update_xml_step1"/>
2671
+ </xsl:otherwise>
2672
+ </xsl:choose>
2673
+ </xsl:copy>
2674
+ </xsl:template>
2579
2675
 
2580
2676
  <!-- remove preprocess-xslt -->
2581
2677
  <xsl:template match="mn:preprocess-xslt" mode="update_xml_step1"/>
@@ -2783,6 +2879,46 @@
2783
2879
  </xsl:template>
2784
2880
 
2785
2881
  <xsl:template name="addNamedDestinationAttribute">
2882
+ <xsl:variable name="docnum"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
2883
+ <xsl:variable name="caption_label" select="translate(normalize-space(.//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
2884
+
2885
+ <xsl:variable name="named_dest_">
2886
+ <xsl:choose>
2887
+ <xsl:when test="count(ancestor::mn:figure) &gt; 1"/> <!-- prevent id 'a)' -->
2888
+ <xsl:when test="ancestor::mn:note or ancestor::mn:example or ancestor::mn:termnote or ancestor::mn:termexample or ancestor::mn:admonition"/>
2889
+ <xsl:when test="$caption_label = '' and parent::mn:foreword">
2890
+ <xsl:variable name="foreword_number"><xsl:number count="mn:foreword" level="any"/></xsl:variable>
2891
+ <xsl:if test="$foreword_number = 1">Foreword</xsl:if>
2892
+ </xsl:when>
2893
+ <xsl:when test="$caption_label = '' and parent::mn:introduction">
2894
+ <xsl:variable name="introduction_number"><xsl:number count="mn:introduction" level="any"/></xsl:variable>
2895
+ <xsl:if test="$introduction_number = 1">Introduction</xsl:if>
2896
+ </xsl:when>
2897
+ <xsl:when test="$caption_label = ''"/>
2898
+ <xsl:when test="../@unnumbered = 'true'"/>
2899
+ <xsl:when test="normalize-space(java:matches(java:java.lang.String.new($caption_label), '[\x21-\xFF]+')) = 'false'"/>
2900
+ <!-- 1.1 in Appendix 1 -->
2901
+ <xsl:otherwise>
2902
+ <xsl:if test="ancestor::mn:annex and string(number(substring($caption_label, 1, 1))) != 'NaN'">
2903
+ <xsl:variable name="annex_caption_label" select="translate(normalize-space(ancestor::mn:annex[1]/mn:fmt-title//mn:span[@class = 'fmt-caption-label']), ' ()', '')"/>
2904
+ <xsl:value-of select="concat($annex_caption_label, '_')"/>
2905
+ </xsl:if>
2906
+ <xsl:if test="parent::mn:formula">Formula</xsl:if>
2907
+ <xsl:value-of select="$caption_label"/>
2908
+ </xsl:otherwise>
2909
+ </xsl:choose>
2910
+ </xsl:variable>
2911
+ <xsl:variable name="named_dest" select="normalize-space($named_dest_)"/>
2912
+ <xsl:if test="$named_dest != ''">
2913
+ <xsl:variable name="named_dest_doc_">
2914
+ <xsl:value-of select="$named_dest"/>
2915
+ <xsl:if test="$docnum != '1'">_<xsl:value-of select="$docnum"/></xsl:if>
2916
+ </xsl:variable>
2917
+ <xsl:variable name="named_dest_doc" select="normalize-space($named_dest_doc_)"/>
2918
+ <xsl:if test="not(key('kid', $named_dest_doc))"> <!-- if element with id '$named_dest_doc' doesn't exist in the document -->
2919
+ <xsl:attribute name="named_dest"><xsl:value-of select="normalize-space($named_dest_doc)"/></xsl:attribute>
2920
+ </xsl:if>
2921
+ </xsl:if>
2786
2922
  </xsl:template>
2787
2923
 
2788
2924
  <xsl:template match="mn:fmt-name" mode="update_xml_step1">
@@ -2803,6 +2939,15 @@
2803
2939
  </xsl:choose>
2804
2940
  </xsl:template>
2805
2941
 
2942
+ <!-- https://github.com/metanorma/metanorma-iso/issues/1535 -->
2943
+ <xsl:template match="mn:ol[mn:fmt-ol]" mode="update_xml_step1">
2944
+ <xsl:apply-templates select="mn:fmt-ol" mode="update_xml_step1"/>
2945
+ </xsl:template>
2946
+
2947
+ <xsl:template match="mn:ul[mn:fmt-ul]" mode="update_xml_step1">
2948
+ <xsl:apply-templates select="mn:fmt-ul" mode="update_xml_step1"/>
2949
+ </xsl:template>
2950
+
2806
2951
  <!-- li/fmt-name -->
2807
2952
  <xsl:template match="mn:li/mn:fmt-name" priority="2" mode="update_xml_step1">
2808
2953
  <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
@@ -3747,6 +3892,7 @@
3747
3892
  </xsl:template>
3748
3893
 
3749
3894
  <xsl:template match="mn:feedback-statement//mn:p">
3895
+ <xsl:param name="skip_id">false</xsl:param>
3750
3896
  <xsl:param name="margin"/>
3751
3897
  <fo:block xsl:use-attribute-sets="feedback-statement-p-style">
3752
3898
  <xsl:call-template name="refine_feedback-statement-p-style"/>
@@ -6168,6 +6314,8 @@
6168
6314
  <xsl:param name="margin-side"/>
6169
6315
 
6170
6316
  <xsl:call-template name="setBordersTableArray"/>
6317
+
6318
+ <xsl:call-template name="setNoBordersForTableList"/>
6171
6319
  </xsl:template> <!-- refine_table-style -->
6172
6320
 
6173
6321
  <xsl:attribute-set name="table-number-style">
@@ -6207,12 +6355,16 @@
6207
6355
  <xsl:template name="refine_table-header-row-style">
6208
6356
 
6209
6357
  <xsl:call-template name="setBordersTableArray"/>
6358
+
6359
+ <xsl:call-template name="setNoBordersForTableList"/>
6210
6360
  </xsl:template> <!-- refine_table-header-row-style -->
6211
6361
 
6212
6362
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
6213
6363
  </xsl:attribute-set>
6214
6364
 
6215
6365
  <xsl:template name="refine_table-footer-row-style">
6366
+
6367
+ <xsl:call-template name="setNoBordersForTableList"/>
6216
6368
  </xsl:template> <!-- refine_table-footer-row-style -->
6217
6369
 
6218
6370
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
@@ -6229,6 +6381,8 @@
6229
6381
  <xsl:otherwise><xsl:value-of select="$color_table_row_odd"/></xsl:otherwise>
6230
6382
  </xsl:choose>
6231
6383
  </xsl:attribute>
6384
+
6385
+ <xsl:call-template name="setNoBordersForTableList"/>
6232
6386
  </xsl:template> <!-- refine_table-body-row-style -->
6233
6387
 
6234
6388
  <xsl:attribute-set name="table-header-cell-style">
@@ -6255,6 +6409,16 @@
6255
6409
  </xsl:if>
6256
6410
 
6257
6411
  <xsl:call-template name="setTableCellAttributes"/>
6412
+
6413
+ <xsl:if test="ancestor::mn:fmt-ol or ancestor::mn:fmt-ul">
6414
+ <xsl:attribute name="display-align">before</xsl:attribute>
6415
+ <xsl:attribute name="text-align">left</xsl:attribute>
6416
+ <xsl:if test="following-sibling::*">
6417
+ <xsl:attribute name="padding-right">4mm</xsl:attribute>
6418
+ </xsl:if>
6419
+ <xsl:call-template name="setNoBordersForTableList"/>
6420
+ </xsl:if>
6421
+
6258
6422
  </xsl:template> <!-- refine_table-header-cell-style -->
6259
6423
 
6260
6424
  <xsl:attribute-set name="table-cell-style">
@@ -6274,6 +6438,15 @@
6274
6438
 
6275
6439
  <xsl:call-template name="setBordersTableArray"/>
6276
6440
 
6441
+ <xsl:if test="ancestor::mn:fmt-ol or ancestor::mn:fmt-ul">
6442
+ <xsl:attribute name="display-align">before</xsl:attribute>
6443
+ <xsl:attribute name="text-align">left</xsl:attribute>
6444
+ <xsl:if test="following-sibling::*">
6445
+ <xsl:attribute name="padding-right">4mm</xsl:attribute>
6446
+ </xsl:if>
6447
+ <xsl:call-template name="setNoBordersForTableList"/>
6448
+ </xsl:if>
6449
+
6277
6450
  </xsl:template> <!-- refine_table-cell-style -->
6278
6451
 
6279
6452
  <xsl:attribute-set name="table-footer-cell-style">
@@ -6285,6 +6458,8 @@
6285
6458
  </xsl:attribute-set> <!-- table-footer-cell-style -->
6286
6459
 
6287
6460
  <xsl:template name="refine_table-footer-cell-style">
6461
+
6462
+ <xsl:call-template name="setNoBordersForTableList"/>
6288
6463
  </xsl:template> <!-- refine_table-footer-cell-style -->
6289
6464
 
6290
6465
  <xsl:attribute-set name="table-note-style">
@@ -6323,6 +6498,16 @@
6323
6498
  <xsl:template name="refine_table-fn-body-style">
6324
6499
  </xsl:template>
6325
6500
 
6501
+ <xsl:template name="setNoBordersForTableList">
6502
+ <xsl:if test="ancestor::mn:fmt-ol or ancestor::mn:fmt-ul">
6503
+ <xsl:attribute name="border">none</xsl:attribute>
6504
+ <xsl:attribute name="border-top">none</xsl:attribute>
6505
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
6506
+ <xsl:attribute name="border-left">none</xsl:attribute>
6507
+ <xsl:attribute name="border-right">none</xsl:attribute>
6508
+ </xsl:if>
6509
+ </xsl:template>
6510
+
6326
6511
  <!-- ========================== -->
6327
6512
  <!-- END Table styles -->
6328
6513
  <!-- ========================== -->
@@ -10191,7 +10376,12 @@
10191
10376
  <xsl:template match="mn:figure[@class = 'pseudocode']">
10192
10377
  <xsl:call-template name="setNamedDestination"/>
10193
10378
  <fo:block id="{@id}">
10194
- <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
10379
+ <fo:block role="SKIP">
10380
+ <xsl:for-each select="mn:fmt-name"> <!-- set context -->
10381
+ <xsl:call-template name="setIDforNamedDestination"/>
10382
+ </xsl:for-each>
10383
+ <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
10384
+ </fo:block>
10195
10385
  </fo:block>
10196
10386
  <xsl:apply-templates select="mn:fmt-name"/>
10197
10387
  </xsl:template>
@@ -11926,6 +12116,10 @@
11926
12116
  </fo:list-item>
11927
12117
  </xsl:template>
11928
12118
 
12119
+ <xsl:template match="mn:fmt-ol | mn:fmt-ul">
12120
+ <xsl:apply-templates/>
12121
+ </xsl:template>
12122
+
11929
12123
  <!-- ===================================== -->
11930
12124
  <!-- END Lists processing -->
11931
12125
  <!-- ===================================== -->
@@ -12779,7 +12973,7 @@
12779
12973
  </xsl:variable>
12780
12974
 
12781
12975
  <xsl:template name="index-pages">
12782
- <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
12976
+ <xsl:param name="num"/>
12783
12977
 
12784
12978
  <xsl:variable name="docid">
12785
12979
  <xsl:call-template name="getDocumentId"/>
@@ -14615,6 +14809,22 @@
14615
14809
  </xsl:if>
14616
14810
  </xsl:template>
14617
14811
 
14812
+ <!-- debug templates -->
14813
+ <xsl:template name="debug_contents">
14814
+ <xsl:if test="$debug = 'true'">
14815
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
14816
+ <xsl:copy-of select="$contents"/>
14817
+ </redirect:write>
14818
+ </xsl:if>
14819
+ </xsl:template>
14820
+ <xsl:template name="debug_toc_recommendations">
14821
+ <xsl:if test="$debug = 'true'">
14822
+ <redirect:write file="toc_recommendations.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
14823
+ <xsl:copy-of select="$toc_recommendations"/>
14824
+ </redirect:write>
14825
+ </xsl:if>
14826
+ </xsl:template>
14827
+
14618
14828
  <xsl:template name="processPrefaceSectionsDefault">
14619
14829
  <xsl:param name="num"/>
14620
14830
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
@@ -15827,14 +16037,18 @@
15827
16037
  </xsl:template>
15828
16038
 
15829
16039
  <xsl:template name="setIDforNamedDestination">
15830
- <xsl:if test="@named_dest">
15831
- <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
16040
+ <xsl:if test="$isGenerateTableIF = 'false'">
16041
+ <xsl:if test="@named_dest">
16042
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
16043
+ </xsl:if>
15832
16044
  </xsl:if>
15833
16045
  </xsl:template>
15834
16046
 
15835
16047
  <xsl:template name="setIDforNamedDestinationInline">
15836
- <xsl:if test="@named_dest">
15837
- <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
16048
+ <xsl:if test="$isGenerateTableIF = 'false'">
16049
+ <xsl:if test="@named_dest">
16050
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
16051
+ </xsl:if>
15838
16052
  </xsl:if>
15839
16053
  </xsl:template>
15840
16054
 
@@ -15844,7 +16058,7 @@
15844
16058
  <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'">
15845
16059
  <fox:destination internal-destination="{@id}"/>
15846
16060
  </xsl:if>
15847
- <xsl:for-each select=". | mn:fmt-title | mn:fmt-name">
16061
+ <xsl:for-each select=". | mn:fmt-title[1] | mn:fmt-name[1]">
15848
16062
  <xsl:if test="@named_dest">
15849
16063
  <fox:destination internal-destination="{@named_dest}"/>
15850
16064
  </xsl:if>
@@ -15852,6 +16066,12 @@
15852
16066
  </xsl:if>
15853
16067
  </xsl:template>
15854
16068
 
16069
+ <xsl:template name="copyParagraphId">
16070
+ <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'">
16071
+ <xsl:copy-of select="@id"/>
16072
+ </xsl:if>
16073
+ </xsl:template>
16074
+
15855
16075
  <xsl:template name="add-letter-spacing">
15856
16076
  <xsl:param name="text"/>
15857
16077
  <xsl:param name="letter-spacing" select="'0.15'"/>
@@ -16074,7 +16294,7 @@
16074
16294
  <xsl:template name="insertCoverPageFullImage">
16075
16295
  <xsl:param name="name">coverpage-image</xsl:param>
16076
16296
  <xsl:for-each select="//mn:metanorma/mn:metanorma-extension/mn:presentation-metadata/*[local-name() = $name][1]/mn:image">
16077
- <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
16297
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force" initial-page-number="1">
16078
16298
  <fo:flow flow-name="xsl-region-body">
16079
16299
  <xsl:call-template name="insertBackgroundPageImage">
16080
16300
  <xsl:with-param name="number" select="position()"/>
@@ -16538,6 +16758,18 @@
16538
16758
  </xsl:attribute>
16539
16759
  </xsl:template>
16540
16760
 
16761
+ <xsl:template name="insert_firstpage_id">
16762
+ <xsl:param name="num"/>
16763
+ <fo:wrapper role="artifact">
16764
+ <fo:block-container absolute-position="fixed" top="1mm">
16765
+ <xsl:if test="$num = 1">
16766
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
16767
+ </xsl:if>
16768
+ <fo:block id="firstpage_id_{$num}" role="SKIP"> </fo:block>
16769
+ </fo:block-container>
16770
+ </fo:wrapper>
16771
+ </xsl:template>
16772
+
16541
16773
  <xsl:template name="getCharByCodePoint">
16542
16774
  <xsl:param name="codepoint"/>
16543
16775
  <xsl:param name="radix">16</xsl:param>