metanorma-iso 2.7.7 → 2.7.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,7 @@
21
21
  </xsl:variable>
22
22
  <xsl:variable name="column_gap">8.5mm</xsl:variable>
23
23
 
24
- <xsl:variable name="docidentifierISO_undated"><xsl:if test="not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM')"><xsl:value-of select="normalize-space(/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-undated'])"/></xsl:if></xsl:variable>
24
+ <xsl:variable name="docidentifierISO_undated"><xsl:if test="not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM')"><xsl:value-of select="normalize-space(/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso-undated'])"/></xsl:if></xsl:variable>
25
25
  <xsl:variable name="docidentifierISO_">
26
26
  <xsl:value-of select="$docidentifierISO_undated"/>
27
27
  <xsl:if test="$docidentifierISO_undated = ''">
@@ -155,11 +155,12 @@
155
155
  <xsl:variable name="stagename_abbreviation" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:ext/iso:stagename/@abbreviation)"/>
156
156
  <xsl:variable name="stagename_localized" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage[@language = $lang])"/>
157
157
  <xsl:variable name="abbreviation" select="normalize-space(/iso:iso-standard/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
158
+ <xsl:variable name="abbreviation_uppercased" select="java:toUpperCase(java:java.lang.String.new($abbreviation))"/>
158
159
 
159
160
  <xsl:variable name="stage-abbreviation">
160
161
  <xsl:choose>
161
- <xsl:when test="$abbreviation != ''">
162
- <xsl:value-of select="$abbreviation"/>
162
+ <xsl:when test="$abbreviation_uppercased != ''">
163
+ <xsl:value-of select="$abbreviation_uppercased"/>
163
164
  </xsl:when>
164
165
  <xsl:when test="$stage = 0 and $substage = 0">PWI</xsl:when>
165
166
  <xsl:when test="$stage = 0">NWIP</xsl:when> <!-- NWIP (NP) -->
@@ -212,8 +213,8 @@
212
213
 
213
214
  <xsl:variable name="stagename-header-coverpage">
214
215
  <xsl:choose>
215
- <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or starts-with($stage-abbreviation, 'DTS') or starts-with($stage-abbreviation, 'DTR') or $stagename_abbreviation = 'DIS'">DRAFT</xsl:when>
216
- <xsl:when test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or starts-with($stage-abbreviation, 'FDTS') or starts-with($stage-abbreviation, 'FDTR') or $stagename_abbreviation = 'FDIS'">FINAL DRAFT</xsl:when>
216
+ <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or starts-with($stage-abbreviation, 'DTS') or starts-with($stage-abbreviation, 'DTR') or $stagename_abbreviation = 'DIS'">DRAFT</xsl:when>
217
+ <xsl:when test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or starts-with($stage-abbreviation, 'FDTS') or starts-with($stage-abbreviation, 'FDTR') or $stagename_abbreviation = 'FDIS'">FINAL DRAFT</xsl:when>
217
218
  <xsl:when test="$stage-abbreviation = 'PRF'"/>
218
219
  <xsl:when test="$stage-abbreviation = 'IS'"/>
219
220
  <xsl:otherwise>
@@ -1116,7 +1117,7 @@
1116
1117
  </xsl:variable>
1117
1118
 
1118
1119
  <xsl:choose>
1119
- <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
1120
+ <xsl:when test="$stage-abbreviation = 'DIS'"> <!-- or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' -->
1120
1121
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
1121
1122
  <xsl:value-of select="$linebreak"/>
1122
1123
  <xsl:value-of select="$doctype_localized"/>
@@ -1190,7 +1191,7 @@
1190
1191
  <xsl:call-template name="insertTitlesLangMain"/>
1191
1192
  </fo:block>
1192
1193
 
1193
- <xsl:if test="not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
1194
+ <xsl:if test="not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')">
1194
1195
  <xsl:for-each select="xalan:nodeset($lang_other)/lang">
1195
1196
  <xsl:variable name="lang_other" select="."/>
1196
1197
  <fo:block font-size="12pt" role="SKIP"><xsl:value-of select="$linebreak"/></fo:block>
@@ -1203,7 +1204,7 @@
1203
1204
  </xsl:for-each>
1204
1205
  </xsl:if>
1205
1206
 
1206
- <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'FDIS' or $stagename_abbreviation = 'FDIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS'">
1207
+ <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'FDIS' or $stagename_abbreviation = 'FDIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS'">
1207
1208
  <fo:block margin-top="20mm">
1208
1209
  <xsl:copy-of select="$ics"/>
1209
1210
  </fo:block>
@@ -1215,7 +1216,7 @@
1215
1216
  <fo:table-cell number-columns-spanned="2" padding-left="6mm">
1216
1217
  <fo:block margin-top="2.5mm" line-height="1.1">
1217
1218
 
1218
- <xsl:if test="not($stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM')">
1219
+ <xsl:if test="not($stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM')">
1219
1220
  <xsl:variable name="edition_and_date">
1220
1221
  <xsl:call-template name="insertEditionAndDate"/>
1221
1222
  </xsl:variable>
@@ -1226,7 +1227,7 @@
1226
1227
  </xsl:if>
1227
1228
  </xsl:if>
1228
1229
 
1229
- <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
1230
+ <xsl:if test="$doctype = 'amendment'"> <!-- and not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM') -->
1230
1231
  <fo:block font-size="18pt" font-weight="bold" margin-bottom="3mm">
1231
1232
  <xsl:value-of select="$doctype_uppercased"/>
1232
1233
  <xsl:text> </xsl:text>
@@ -1235,9 +1236,9 @@
1235
1236
  <xsl:value-of select="$amendment-number"/><xsl:text> </xsl:text>
1236
1237
  </xsl:if>
1237
1238
  </fo:block>
1238
- </xsl:if>
1239
-
1240
- <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
1239
+ <!-- </xsl:if>
1240
+
1241
+ <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')"> -->
1241
1242
  <xsl:if test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'updated']">
1242
1243
  <fo:block font-size="18pt" font-weight="bold" margin-bottom="3mm">
1243
1244
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'updated']"/>
@@ -1254,7 +1255,7 @@
1254
1255
  </fo:block>
1255
1256
  </xsl:if>
1256
1257
 
1257
- <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stagename_abbreviation = 'FDIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
1258
+ <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or $stagename_abbreviation = 'FDIS' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
1258
1259
  <xsl:if test="normalize-space($editorialgroup) != ''">
1259
1260
  <fo:block margin-bottom="3mm">
1260
1261
  <xsl:copy-of select="$editorialgroup"/>
@@ -1267,7 +1268,7 @@
1267
1268
  </xsl:if>
1268
1269
  </xsl:if>
1269
1270
 
1270
- <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stagename_abbreviation = 'FDIS'">
1271
+ <xsl:if test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or $stagename_abbreviation = 'FDIS'">
1271
1272
 
1272
1273
  <fo:block margin-bottom="3mm">
1273
1274
  <!-- Voting begins on: -->
@@ -1398,7 +1399,7 @@
1398
1399
  <fo:table-body role="SKIP">
1399
1400
  <fo:table-row role="SKIP">
1400
1401
  <fo:table-cell font-size="6.5pt" text-align="justify" display-align="after" padding-bottom="8mm" role="SKIP">
1401
- <xsl:if test="$stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
1402
+ <xsl:if test="$stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM'">
1402
1403
  <xsl:attribute name="font-size">7pt</xsl:attribute>
1403
1404
  </xsl:if>
1404
1405
  <!-- margin-top="-30mm" -->
@@ -1523,7 +1524,7 @@
1523
1524
 
1524
1525
  <xsl:choose>
1525
1526
  <!-- COVER PAGE for DIS document only -->
1526
- <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS'">
1527
+ <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS'">
1527
1528
  <fo:flow flow-name="xsl-region-body">
1528
1529
  <fo:block-container role="SKIP">
1529
1530
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
@@ -1623,10 +1624,10 @@
1623
1624
  </fo:block-container>
1624
1625
  </fo:flow>
1625
1626
 
1626
- </xsl:when> <!-- END: $stage-abbreviation = 'DIS' 'DAmd' 'DAM'-->
1627
+ </xsl:when> <!-- END: $stage-abbreviation = 'DIS' 'DAMD' 'DAM'-->
1627
1628
  <xsl:otherwise>
1628
1629
 
1629
- <!-- COVER PAGE for all documents except DIS, DAmd and DAM -->
1630
+ <!-- COVER PAGE for all documents except DIS, DAMD and DAM -->
1630
1631
  <fo:flow flow-name="xsl-region-body">
1631
1632
  <fo:block-container role="SKIP">
1632
1633
  <fo:table table-layout="fixed" width="100%" font-size="24pt" line-height="1" role="SKIP"> <!-- margin-bottom="35mm" -->
@@ -1668,7 +1669,7 @@
1668
1669
  <fo:table-cell role="SKIP">
1669
1670
  <fo:block text-align="left">
1670
1671
  <xsl:choose>
1671
- <xsl:when test="$stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM'"><xsl:value-of select="$doctype_uppercased"/></xsl:when>
1672
+ <xsl:when test="$stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM'"><xsl:value-of select="$doctype_uppercased"/></xsl:when>
1672
1673
  <xsl:when test="$doctype = 'amendment'">
1673
1674
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:updates-document-type,'-',' ')))"/>
1674
1675
  </xsl:when>
@@ -1701,7 +1702,7 @@
1701
1702
  </fo:block>
1702
1703
  <!-- <xsl:value-of select="$linebreak"/>
1703
1704
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
1704
- <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
1705
+ <xsl:if test="$doctype = 'amendment' and not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')">
1705
1706
  <fo:block text-align="right" margin-right="0.5mm" role="SKIP">
1706
1707
  <fo:block font-weight="bold" margin-top="4pt" role="H1">
1707
1708
  <xsl:value-of select="$doctype_uppercased"/>
@@ -1734,7 +1735,7 @@
1734
1735
  <fo:table-cell role="SKIP"><fo:block role="SKIP"/></fo:table-cell>
1735
1736
  <fo:table-cell number-columns-spanned="2" font-size="10pt" line-height="1.2" display-align="center" role="SKIP">
1736
1737
  <fo:block role="SKIP">
1737
- <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'FDIS' or $stagename_abbreviation = 'FDIS'">
1738
+ <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
1738
1739
  <fo:table table-layout="fixed" width="100%" role="SKIP">
1739
1740
  <fo:table-column column-width="50%"/>
1740
1741
  <fo:table-column column-width="50%"/>
@@ -1769,7 +1770,7 @@
1769
1770
  <fo:table-row role="SKIP"> <!-- border="1pt solid black" height="150mm" -->
1770
1771
  <fo:table-cell font-size="11pt" role="SKIP">
1771
1772
  <fo:block role="SKIP">
1772
- <xsl:if test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stagename_abbreviation = 'FDIS'">
1773
+ <xsl:if test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or $stagename_abbreviation = 'FDIS'">
1773
1774
  <fo:block-container border="0.5mm solid black" width="51mm" role="SKIP">
1774
1775
  <fo:block margin="2mm" role="SKIP">
1775
1776
  <fo:block margin-bottom="8pt"><xsl:copy-of select="$editorialgroup"/></fo:block>
@@ -1809,7 +1810,7 @@
1809
1810
  <xsl:call-template name="insertTitlesLangMain"/>
1810
1811
  </fo:block>
1811
1812
 
1812
- <xsl:if test="not($stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM')">
1813
+ <xsl:if test="not($stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM')">
1813
1814
  <xsl:for-each select="xalan:nodeset($lang_other)/lang">
1814
1815
  <xsl:variable name="lang_other" select="."/>
1815
1816
 
@@ -2102,7 +2103,7 @@
2102
2103
  <xsl:apply-templates select="xalan:nodeset($updated_xml_step2)" mode="update_xml_enclose_keep-together_within-line"/>
2103
2104
  </xsl:when>
2104
2105
  <xsl:otherwise>
2105
- <xsl:copy-of select="."/>
2106
+ <xsl:apply-templates select="." mode="update_xml_enclose_keep-together_within-line"/>
2106
2107
  </xsl:otherwise>
2107
2108
  </xsl:choose>
2108
2109
  </xsl:variable>
@@ -2701,12 +2702,12 @@
2701
2702
  </xsl:template>
2702
2703
 
2703
2704
  <xsl:template name="insertDraftComments">
2704
- <xsl:if test="$stagename_abbreviation = 'DIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
2705
+ <xsl:if test="$stagename_abbreviation = 'DIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
2705
2706
  <fo:block margin-bottom="1.5mm">
2706
2707
  <xsl:text>THIS DOCUMENT IS A DRAFT CIRCULATED FOR COMMENT AND APPROVAL. IT IS THEREFORE SUBJECT TO CHANGE AND MAY NOT BE REFERRED TO AS AN INTERNATIONAL STANDARD UNTIL PUBLISHED AS SUCH.</xsl:text>
2707
2708
  </fo:block>
2708
2709
  </xsl:if>
2709
- <xsl:if test="$stagename_abbreviation = 'DIS' or $stagename_abbreviation = 'FDIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
2710
+ <xsl:if test="$stagename_abbreviation = 'DIS' or $stagename_abbreviation = 'FDIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD'">
2710
2711
  <fo:block margin-bottom="1.5mm">
2711
2712
  <xsl:text>RECIPIENTS OF THIS DRAFT ARE INVITED TO
2712
2713
  SUBMIT, WITH THEIR COMMENTS, NOTIFICATION
@@ -2747,7 +2748,7 @@
2747
2748
  </xsl:template>
2748
2749
 
2749
2750
  <xsl:template name="insertCoverPageAdditionalNotes">
2750
- <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'FCD' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS' or $stagename_abbreviation = 'FDIS'">
2751
+ <xsl:if test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP' or $stage-abbreviation = 'PWI' or $stage-abbreviation = 'AWI' or $stage-abbreviation = 'WD' or $stage-abbreviation = 'CD' or $stage-abbreviation = 'FCD' or $stage-abbreviation = 'DIS' or $stage-abbreviation = 'FDIS' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' or $stagename_abbreviation = 'DIS' or $stagename_abbreviation = 'FDIS'">
2751
2752
  <xsl:variable name="text">
2752
2753
  <xsl:for-each select="/iso:iso-standard/iso:preface/iso:note[@coverpage='true']/iso:p">
2753
2754
  <fo:block>
@@ -3100,7 +3101,7 @@
3100
3101
  <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
3101
3102
  </xsl:if>
3102
3103
 
3103
- <xsl:if test="not($stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM')">
3104
+ <xsl:if test="not($stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM')">
3104
3105
  <xsl:text>: </xsl:text>
3105
3106
  <xsl:apply-templates/>
3106
3107
  </xsl:if>
@@ -4075,7 +4076,7 @@
4075
4076
  <xsl:template name="insertHeaderFirst">
4076
4077
  <fo:static-content flow-name="header-first" role="artifact">
4077
4078
  <xsl:choose>
4078
- <xsl:when test="$stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">
4079
+ <xsl:when test="$stage-abbreviation = 'FDAMD' or $stage-abbreviation = 'FDAM' or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM'">
4079
4080
  <fo:block-container height="24mm" display-align="before">
4080
4081
  <fo:block font-size="{$font-size_header}" font-weight="bold" text-align="right" padding-top="12.5mm" line-height="1.1">
4081
4082
  <xsl:call-template name="insertLayoutVersionAttributesTop"/>
@@ -4825,6 +4826,9 @@
4825
4826
 
4826
4827
  <xsl:strip-space elements="iso:xref"/>
4827
4828
 
4829
+ <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
4830
+ <xsl:variable name="root_element" select="local-name(/*)"/>
4831
+
4828
4832
  <!-- external parameters -->
4829
4833
 
4830
4834
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -4832,6 +4836,7 @@
4832
4836
  <xsl:param name="basepath"/> <!-- base path for images -->
4833
4837
  <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
4834
4838
  <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
4839
+ <xsl:param name="output_path"/> <!-- output PDF file name -->
4835
4840
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
4836
4841
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
4837
4842
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -5007,6 +5012,15 @@
5007
5012
  </xsl:variable>
5008
5013
  <xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/>
5009
5014
 
5015
+ <xsl:variable name="layout_columns_default">1</xsl:variable>
5016
+ <xsl:variable name="layout_columns_" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'layout-columns'])"/>
5017
+ <xsl:variable name="layout_columns">
5018
+ <xsl:choose>
5019
+ <xsl:when test="$layout_columns_ != ''"><xsl:value-of select="$layout_columns_"/></xsl:when>
5020
+ <xsl:otherwise><xsl:value-of select="$layout_columns_default"/></xsl:otherwise>
5021
+ </xsl:choose>
5022
+ </xsl:variable>
5023
+
5010
5024
  <!-- Note 2: almost all localized string determined in the element //localized-strings in metanorma xml, but there are a few cases when:
5011
5025
  - string didn't determined yet
5012
5026
  - we need to put the string on two-languages (for instance, on English and French both), but xml contains only localized strings for one language
@@ -5500,11 +5514,13 @@
5500
5514
 
5501
5515
  1pt solid black
5502
5516
 
5517
+
5503
5518
  </xsl:variable>
5504
5519
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
5505
5520
 
5506
5521
  <xsl:variable name="table-cell-border_">
5507
5522
  0.5pt solid black
5523
+
5508
5524
  </xsl:variable>
5509
5525
  <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
5510
5526
 
@@ -6724,6 +6740,43 @@
6724
6740
  </xsl:for-each>
6725
6741
  </xsl:template>
6726
6742
 
6743
+ <xsl:template name="processPrefaceSectionsDefault_items">
6744
+
6745
+ <xsl:variable name="updated_xml_step_move_pagebreak_">
6746
+
6747
+ <xsl:element name="{$root_element}" namespace="{$namespace_full}">
6748
+
6749
+ <xsl:call-template name="copyCommonElements"/>
6750
+
6751
+ <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
6752
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
6753
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
6754
+ <xsl:sort select="@displayorder" data-type="number"/>
6755
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
6756
+ </xsl:for-each>
6757
+ </xsl:element>
6758
+ </xsl:element>
6759
+ </xsl:element>
6760
+ </xsl:variable>
6761
+
6762
+ <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
6763
+
6764
+ <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
6765
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
6766
+ </redirect:write>
6767
+
6768
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
6769
+
6770
+ <xsl:call-template name="deleteFile">
6771
+ <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
6772
+ </xsl:call-template>
6773
+ </xsl:template>
6774
+
6775
+ <xsl:template name="copyCommonElements">
6776
+ <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
6777
+ <xsl:copy-of select="/*/*[local-name() != 'preface' and local-name() != 'sections' and local-name() != 'annex' and local-name() != 'bibliography']"/>
6778
+ </xsl:template>
6779
+
6727
6780
  <xsl:template name="processMainSectionsDefault">
6728
6781
  <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
6729
6782
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -6740,7 +6793,7 @@
6740
6793
  <xsl:sort select="@displayorder" data-type="number"/>
6741
6794
  <xsl:apply-templates select="."/>
6742
6795
  </xsl:for-each>
6743
- </xsl:template>
6796
+ </xsl:template><!-- END: processMainSectionsDefault -->
6744
6797
 
6745
6798
  <xsl:template name="processMainSectionsDefault_flatxml">
6746
6799
  <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
@@ -6772,6 +6825,80 @@
6772
6825
  </xsl:for-each>
6773
6826
  </xsl:template>
6774
6827
 
6828
+ <!-- Example:
6829
+ <iso-standard>
6830
+ <sections>
6831
+ <page_sequence>
6832
+ <clause...
6833
+ </page_sequence>
6834
+ <page_sequence>
6835
+ <clause...
6836
+ </page_sequence>
6837
+ </sections>
6838
+ <page_sequence>
6839
+ <annex ..
6840
+ </page_sequence>
6841
+ <page_sequence>
6842
+ <annex ..
6843
+ </page_sequence>
6844
+ </iso-standard>
6845
+ -->
6846
+ <xsl:template name="processMainSectionsDefault_items">
6847
+
6848
+ <xsl:variable name="updated_xml_step_move_pagebreak_">
6849
+
6850
+ <xsl:element name="{$root_element}" namespace="{$namespace_full}">
6851
+
6852
+ <xsl:call-template name="copyCommonElements"/>
6853
+
6854
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
6855
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
6856
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
6857
+ <xsl:sort select="@displayorder" data-type="number"/>
6858
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
6859
+
6860
+ </xsl:for-each>
6861
+ </xsl:element>
6862
+ </xsl:element>
6863
+
6864
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
6865
+ <xsl:for-each select="/*/*[local-name()='annex']">
6866
+ <xsl:sort select="@displayorder" data-type="number"/>
6867
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
6868
+ </xsl:for-each>
6869
+ </xsl:element>
6870
+
6871
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
6872
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
6873
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
6874
+ <xsl:sort select="@displayorder" data-type="number"/>
6875
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
6876
+ </xsl:for-each>
6877
+ </xsl:element>
6878
+ </xsl:element>
6879
+ </xsl:element>
6880
+ </xsl:variable>
6881
+
6882
+ <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
6883
+
6884
+ <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
6885
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak_"/>
6886
+ </redirect:write>
6887
+
6888
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
6889
+
6890
+ <xsl:call-template name="deleteFile">
6891
+ <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
6892
+ </xsl:call-template>
6893
+ </xsl:template> <!-- END: processMainSectionsDefault_items -->
6894
+
6895
+ <xsl:template name="deleteFile">
6896
+ <xsl:param name="filepath"/>
6897
+ <xsl:variable name="xml_file" select="java:java.io.File.new($filepath)"/>
6898
+ <xsl:variable name="xml_file_path" select="java:toPath($xml_file)"/>
6899
+ <xsl:variable name="deletefile" select="java:java.nio.file.Files.deleteIfExists($xml_file_path)"/>
6900
+ </xsl:template>
6901
+
6775
6902
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
6776
6903
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
6777
6904
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -6971,7 +7098,9 @@
6971
7098
  </xsl:for-each>
6972
7099
  </xsl:template>
6973
7100
 
6974
- <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
7101
+ <!-- for table auto-layout algorithm -->
7102
+ <xsl:param name="table_only_with_id"/> <!-- Example: 'table1' -->
7103
+ <xsl:param name="table_only_with_ids"/> <!-- Example: 'table1 table2 table3 ' -->
6975
7104
 
6976
7105
  <xsl:template match="*[local-name()='table']" priority="2">
6977
7106
  <xsl:choose>
@@ -6979,6 +7108,10 @@
6979
7108
  <xsl:call-template name="table"/>
6980
7109
  </xsl:when>
6981
7110
  <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7111
+ <xsl:when test="$table_only_with_ids != '' and contains($table_only_with_ids, concat(@id, ' '))">
7112
+ <xsl:call-template name="table"/>
7113
+ </xsl:when>
7114
+ <xsl:when test="$table_only_with_ids != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
6982
7115
  <xsl:otherwise>
6983
7116
  <xsl:call-template name="table"/>
6984
7117
  </xsl:otherwise>
@@ -7038,6 +7171,7 @@
7038
7171
  <xsl:variable name="margin-side">
7039
7172
  <xsl:choose>
7040
7173
  <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
7174
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'skip'">0</xsl:when>
7041
7175
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
7042
7176
  <xsl:otherwise>0</xsl:otherwise>
7043
7177
  </xsl:choose>
@@ -7309,6 +7443,7 @@
7309
7443
  <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
7310
7444
  <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
7311
7445
  </xsl:when>
7446
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'skip'"/>
7312
7447
  <xsl:otherwise>
7313
7448
  <xsl:call-template name="calculate-column-widths-proportional">
7314
7449
  <xsl:with-param name="cols-count" select="$cols-count"/>
@@ -8269,7 +8404,7 @@
8269
8404
  <xsl:copy-of select="node()"/>
8270
8405
  </fn>
8271
8406
  </xsl:for-each>
8272
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
8407
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='bibliography']/*">
8273
8408
  <xsl:sort select="@displayorder" data-type="number"/>
8274
8409
  <!-- commented:
8275
8410
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
@@ -8517,6 +8652,10 @@
8517
8652
  <xsl:call-template name="dl"/>
8518
8653
  </xsl:when>
8519
8654
  <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
8655
+ <xsl:when test="$table_only_with_ids != '' and contains($table_only_with_ids, concat(@id, ' '))">
8656
+ <xsl:call-template name="dl"/>
8657
+ </xsl:when>
8658
+ <xsl:when test="$table_only_with_ids != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
8520
8659
  <xsl:otherwise>
8521
8660
  <xsl:call-template name="dl"/>
8522
8661
  </xsl:otherwise>
@@ -8686,7 +8825,7 @@
8686
8825
 
8687
8826
  <!-- create virtual html table for dl/[dt and dd] -->
8688
8827
  <xsl:variable name="simple-table">
8689
-
8828
+ <!-- initial='<xsl:copy-of select="."/>' -->
8690
8829
  <xsl:variable name="dl_table">
8691
8830
  <tbody>
8692
8831
  <xsl:apply-templates mode="dl_if">
@@ -11518,17 +11657,19 @@
11518
11657
  </xsl:variable>
11519
11658
  <xsl:value-of select="concat('scale=', $scale,', indent=', $indent)"/>
11520
11659
  </fo:block> -->
11521
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
11522
- <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
11523
11660
 
11524
- <xsl:call-template name="setImageWidthHeight"/>
11661
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}">
11525
11662
 
11526
- <xsl:choose>
11527
- <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
11528
- <xsl:attribute name="scaling">non-uniform</xsl:attribute>
11529
- </xsl:when>
11530
- <xsl:otherwise>
11663
+ <xsl:choose>
11664
+ <!-- default -->
11665
+ <xsl:when test="((@width = 'auto' or @width = 'text-width' or @width = 'full-page-width' or @width = 'narrow') and @height = 'auto') or (normalize-space(@width) = '' and normalize-space(@height) = '') ">
11666
+ <!-- add attribute for automatic scaling -->
11667
+ <xsl:variable name="image-graphic-style_attributes">
11668
+ <attributes xsl:use-attribute-sets="image-graphic-style"/>
11669
+ </xsl:variable>
11670
+ <xsl:copy-of select="xalan:nodeset($image-graphic-style_attributes)/attributes/@*"/>
11531
11671
 
11672
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and not(ancestor::*[local-name() = 'table'])">
11532
11673
  <xsl:variable name="scale">
11533
11674
  <xsl:call-template name="getImageScale">
11534
11675
  <xsl:with-param name="indent" select="$indent"/>
@@ -11542,10 +11683,30 @@
11542
11683
  <xsl:if test="number($scale) &lt; 100">
11543
11684
  <xsl:attribute name="content-width"><xsl:value-of select="number($scale) * number($scaleRatio)"/>%</xsl:attribute>
11544
11685
  </xsl:if>
11545
- </xsl:otherwise>
11546
- </xsl:choose>
11686
+ </xsl:if>
11547
11687
 
11548
- </xsl:if>
11688
+ </xsl:when> <!-- default -->
11689
+ <xsl:otherwise>
11690
+
11691
+ <xsl:variable name="width_height_">
11692
+ <attributes>
11693
+ <xsl:call-template name="setImageWidthHeight"/>
11694
+ </attributes>
11695
+ </xsl:variable>
11696
+ <xsl:variable name="width_height" select="xalan:nodeset($width_height_)"/>
11697
+
11698
+ <xsl:copy-of select="$width_height/attributes/@*"/>
11699
+
11700
+ <xsl:if test="$width_height/attributes/@content-width != '' and $width_height/attributes/@content-height != ''">
11701
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
11702
+ </xsl:if>
11703
+
11704
+ </xsl:otherwise>
11705
+ </xsl:choose>
11706
+
11707
+ <!--
11708
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
11709
+ -->
11549
11710
 
11550
11711
  </fo:external-graphic>
11551
11712
  </xsl:otherwise>
@@ -11571,7 +11732,7 @@
11571
11732
  <xsl:call-template name="setImageWidth"/>
11572
11733
  </xsl:variable>
11573
11734
  <xsl:if test="$width != ''">
11574
- <xsl:attribute name="width">
11735
+ <xsl:attribute name="content-width">
11575
11736
  <xsl:value-of select="$width"/>
11576
11737
  </xsl:attribute>
11577
11738
  </xsl:if>
@@ -11579,7 +11740,7 @@
11579
11740
  <xsl:call-template name="setImageHeight"/>
11580
11741
  </xsl:variable>
11581
11742
  <xsl:if test="$height != ''">
11582
- <xsl:attribute name="height">
11743
+ <xsl:attribute name="content-height">
11583
11744
  <xsl:value-of select="$height"/>
11584
11745
  </xsl:attribute>
11585
11746
  </xsl:if>
@@ -14014,7 +14175,7 @@
14014
14175
  <!-- ========== -->
14015
14176
 
14016
14177
  <!-- main sections -->
14017
- <xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
14178
+ <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
14018
14179
 
14019
14180
  <fo:block>
14020
14181
  <xsl:call-template name="setId"/>
@@ -14026,6 +14187,11 @@
14026
14187
 
14027
14188
  </xsl:template>
14028
14189
 
14190
+ <!-- note: @top-level added in mode=" update_xml_step_move_pagebreak" -->
14191
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'page_sequence']/*[not(@top-level)]" priority="2">
14192
+ <xsl:call-template name="sections_node"/>
14193
+ </xsl:template>
14194
+
14029
14195
  <xsl:template name="sections_element_style">
14030
14196
 
14031
14197
  <xsl:variable name="pos"><xsl:number count="*"/></xsl:variable>
@@ -14035,7 +14201,7 @@
14035
14201
 
14036
14202
  </xsl:template> <!-- sections_element_style -->
14037
14203
 
14038
- <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
14204
+ <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2" name="preface_node"> <!-- /*/*[local-name() = 'preface']/* -->
14039
14205
 
14040
14206
  <xsl:choose>
14041
14207
  <xsl:when test="$layoutVersion = '1951' and (local-name() = 'clause' or local-name() = 'introduction')"/>
@@ -14051,7 +14217,11 @@
14051
14217
  </fo:block>
14052
14218
  </xsl:template>
14053
14219
 
14054
- <xsl:template match="*[local-name() = 'clause']">
14220
+ <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
14221
+ <xsl:call-template name="preface_node"/>
14222
+ </xsl:template>
14223
+
14224
+ <xsl:template match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
14055
14225
  <fo:block>
14056
14226
  <xsl:if test="parent::*[local-name() = 'copyright-statement']">
14057
14227
  <xsl:attribute name="role">SKIP</xsl:attribute>
@@ -14077,18 +14247,31 @@
14077
14247
  </fo:block>
14078
14248
  </xsl:template>
14079
14249
 
14080
- <xsl:template match="*[local-name() = 'annex']">
14081
- <fo:block break-after="page"/>
14082
- <fo:block>
14250
+ <xsl:template match="*[local-name() = 'annex'][normalize-space() != '']">
14251
+ <xsl:choose>
14252
+ <xsl:when test="@continue = 'true'"> <!-- it's using for figure/table on top level for block span -->
14253
+ <fo:block>
14254
+ <xsl:apply-templates/>
14255
+ </fo:block>
14256
+ </xsl:when>
14257
+ <xsl:otherwise>
14083
14258
 
14084
- <xsl:call-template name="setBlockSpanAll"/>
14259
+ <fo:block break-after="page"/>
14260
+ <fo:block id="{@id}">
14085
14261
 
14086
- <xsl:call-template name="refine_annex_style"/>
14262
+ <xsl:call-template name="setBlockSpanAll"/>
14087
14263
 
14088
- </fo:block>
14089
- <fo:block id="{@id}">
14090
- <xsl:apply-templates/>
14091
- </fo:block>
14264
+ <xsl:call-template name="refine_annex_style"/>
14265
+
14266
+ </fo:block>
14267
+
14268
+ <xsl:apply-templates select="*[local-name() = 'title'][@columns = 1]"/>
14269
+
14270
+ <fo:block>
14271
+ <xsl:apply-templates select="node()[not(local-name() = 'title' and @columns = 1)]"/>
14272
+ </fo:block>
14273
+ </xsl:otherwise>
14274
+ </xsl:choose>
14092
14275
  </xsl:template>
14093
14276
 
14094
14277
  <xsl:template name="refine_annex_style">
@@ -14788,8 +14971,12 @@
14788
14971
  </xsl:if>
14789
14972
  </xsl:if> -->
14790
14973
 
14791
- <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
14792
- <xsl:apply-templates/>
14974
+ <fo:block id="{@id}"/>
14975
+
14976
+ <xsl:apply-templates select="*[local-name() = 'title'][@columns = 1]"/>
14977
+
14978
+ <fo:block xsl:use-attribute-sets="references-non-normative-style">
14979
+ <xsl:apply-templates select="node()[not(local-name() = 'title' and @columns = 1)]"/>
14793
14980
 
14794
14981
  </fo:block>
14795
14982
 
@@ -15286,7 +15473,11 @@
15286
15473
  <!-- =========================================================================== -->
15287
15474
  <!-- STEP1: -->
15288
15475
  <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
15476
+ <!-- - Put Section title in the correct position -->
15289
15477
  <!-- - Ignore 'span' without style -->
15478
+ <!-- - Remove semantic xml part -->
15479
+ <!-- - Remove image/emf (EMF vector image for Word) -->
15480
+ <!-- - add @id, redundant for table auto-layout algorithm -->
15290
15481
  <!-- =========================================================================== -->
15291
15482
  <xsl:template match="@*|node()" mode="update_xml_step1">
15292
15483
  <xsl:copy>
@@ -15393,11 +15584,14 @@
15393
15584
  <!-- remove image/emf -->
15394
15585
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
15395
15586
 
15396
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
15587
+ <!-- remove preprocess-xslt -->
15588
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
15589
+
15590
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
15397
15591
  <xsl:copy-of select="."/>
15398
15592
  </xsl:template>
15399
15593
 
15400
- <!-- add @id, redundant for table auto-layout algorithm -->
15594
+ <!-- add @id, mandatory for table auto-layout algorithm -->
15401
15595
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
15402
15596
  <xsl:copy>
15403
15597
  <xsl:copy-of select="@*"/>
@@ -15416,8 +15610,172 @@
15416
15610
  </xsl:if>
15417
15611
  </xsl:template>
15418
15612
 
15613
+ <!-- optimization: remove clause if table_only_with_id isn't empty and clause doesn't contain table or dl with table_only_with_id -->
15614
+ <xsl:template match="*[local-name() = 'clause' or local-name() = 'p' or local-name() = 'definitions' or local-name() = 'annex']" mode="update_xml_step1">
15615
+ <xsl:choose>
15616
+ <xsl:when test="($table_only_with_id != '' or $table_only_with_ids != '') and local-name() = 'p' and (ancestor::*[local-name() = 'table' or local-name() = 'dl' or local-name() = 'toc'])">
15617
+ <xsl:copy>
15618
+ <xsl:copy-of select="@*"/>
15619
+ <xsl:apply-templates mode="update_xml_step1"/>
15620
+ </xsl:copy>
15621
+ </xsl:when>
15622
+ <!-- for table auto-layout algorithm -->
15623
+ <xsl:when test="$table_only_with_id != '' and not(.//*[local-name() = 'table' or local-name() = 'dl'][@id = $table_only_with_id])">
15624
+ <xsl:copy>
15625
+ <xsl:copy-of select="@*"/>
15626
+ </xsl:copy>
15627
+ </xsl:when>
15628
+ <!-- for table auto-layout algorithm -->
15629
+ <xsl:when test="$table_only_with_ids != '' and not(.//*[local-name() = 'table' or local-name() = 'dl'][contains($table_only_with_ids, concat(@id, ' '))])">
15630
+ <xsl:copy>
15631
+ <xsl:copy-of select="@*"/>
15632
+ </xsl:copy>
15633
+ </xsl:when>
15634
+ <xsl:otherwise>
15635
+ <xsl:copy>
15636
+ <xsl:copy-of select="@*"/>
15637
+ <xsl:apply-templates mode="update_xml_step1"/>
15638
+ </xsl:copy>
15639
+ </xsl:otherwise>
15640
+ </xsl:choose>
15641
+ </xsl:template>
15642
+
15419
15643
  <!-- =========================================================================== -->
15420
15644
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
15645
+ <!-- =========================================================================== -->
15646
+
15647
+ <!-- =========================================================================== -->
15648
+ <!-- STEP MOVE PAGEBREAK: move <pagebreak/> at top level under 'preface' and 'sections' -->
15649
+ <!-- =========================================================================== -->
15650
+ <xsl:template match="@*|node()" mode="update_xml_step_move_pagebreak">
15651
+ <xsl:copy>
15652
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step_move_pagebreak"/>
15653
+ </xsl:copy>
15654
+ </xsl:template>
15655
+
15656
+ <!-- replace 'pagebreak' by closing tags + page_sequence and opening page_sequence + tags -->
15657
+ <xsl:template match="*[local-name() = 'pagebreak'][not(following-sibling::*[1][local-name() = 'pagebreak'])]" mode="update_xml_step_move_pagebreak">
15658
+
15659
+ <!-- <xsl:choose>
15660
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
15661
+
15662
+ </xsl:when>
15663
+ <xsl:when test="ancestor::*[local-name() = 'annex']">
15664
+ </xsl:when>
15665
+ <xsl:otherwise>
15666
+ <xsl:copy-of select="."/>
15667
+ </xsl:otherwise>
15668
+ </xsl:choose> -->
15669
+
15670
+ <!-- determine pagebreak is last element before </fo:flow> or not -->
15671
+ <xsl:variable name="isLast">
15672
+ <xsl:for-each select="ancestor-or-self::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
15673
+ <xsl:if test="following-sibling::*">false</xsl:if>
15674
+ </xsl:for-each>
15675
+ </xsl:variable>
15676
+
15677
+ <xsl:if test="contains($isLast, 'false')">
15678
+
15679
+ <xsl:variable name="orientation" select="normalize-space(@orientation)"/>
15680
+
15681
+ <xsl:variable name="tree_">
15682
+ <xsl:call-template name="makeAncestorsElementsTree"/>
15683
+ </xsl:variable>
15684
+ <xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
15685
+
15686
+ <!-- close fo:page-sequence (closing preceding fo elements) -->
15687
+ <xsl:call-template name="insertClosingElements">
15688
+ <xsl:with-param name="tree" select="$tree"/>
15689
+ </xsl:call-template>
15690
+
15691
+ <xsl:text disable-output-escaping="yes">&lt;/page_sequence&gt;</xsl:text>
15692
+
15693
+ <!-- create a new page_sequence (opening elements) -->
15694
+ <xsl:text disable-output-escaping="yes">&lt;page_sequence namespace="</xsl:text><xsl:value-of select="$namespace_full"/>"<xsl:if test="$orientation != ''"> orientation="<xsl:value-of select="$orientation"/>"</xsl:if><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
15695
+
15696
+ <xsl:call-template name="insertOpeningElements">
15697
+ <xsl:with-param name="tree" select="$tree"/>
15698
+ </xsl:call-template>
15699
+
15700
+ </xsl:if>
15701
+ </xsl:template>
15702
+
15703
+ <xsl:template name="makeAncestorsElementsTree">
15704
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
15705
+ <element pos="{position()}">
15706
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
15707
+ <xsl:value-of select="name()"/>
15708
+ </element>
15709
+ </xsl:for-each>
15710
+ </xsl:template>
15711
+
15712
+ <xsl:template name="insertClosingElements">
15713
+ <xsl:param name="tree"/>
15714
+ <xsl:for-each select="$tree//element">
15715
+ <xsl:sort data-type="number" order="descending" select="@pos"/>
15716
+ <xsl:text disable-output-escaping="yes">&lt;/</xsl:text>
15717
+ <xsl:value-of select="."/>
15718
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
15719
+ <xsl:if test="$debug = 'true'">
15720
+ <xsl:message>&lt;/<xsl:value-of select="."/>&gt;</xsl:message>
15721
+ </xsl:if>
15722
+ </xsl:for-each>
15723
+ </xsl:template>
15724
+
15725
+ <xsl:template name="insertOpeningElements">
15726
+ <xsl:param name="tree"/>
15727
+ <xsl:for-each select="$tree//element">
15728
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
15729
+ <xsl:value-of select="."/>
15730
+ <xsl:for-each select="@*[local-name() != 'pos']">
15731
+ <xsl:text> </xsl:text>
15732
+ <xsl:value-of select="local-name()"/>
15733
+ <xsl:text>="</xsl:text>
15734
+ <xsl:value-of select="."/>
15735
+ <xsl:text>"</xsl:text>
15736
+ </xsl:for-each>
15737
+ <xsl:if test="position() = 1"> continue="true"</xsl:if>
15738
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
15739
+ <xsl:if test="$debug = 'true'">
15740
+ <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
15741
+ </xsl:if>
15742
+ </xsl:for-each>
15743
+ </xsl:template>
15744
+
15745
+ <!-- move full page width figures, tables at top level -->
15746
+ <xsl:template match="*[local-name() = 'figure' or local-name() = 'table'][normalize-space(@width) != 'text-width']" mode="update_xml_step_move_pagebreak">
15747
+ <xsl:choose>
15748
+ <xsl:when test="$layout_columns != 1">
15749
+
15750
+ <xsl:variable name="tree_">
15751
+ <xsl:call-template name="makeAncestorsElementsTree"/>
15752
+ </xsl:variable>
15753
+ <xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
15754
+
15755
+ <xsl:call-template name="insertClosingElements">
15756
+ <xsl:with-param name="tree" select="$tree"/>
15757
+ </xsl:call-template>
15758
+
15759
+ <!-- <xsl:copy-of select="."/> -->
15760
+ <xsl:copy>
15761
+ <xsl:copy-of select="@*"/>
15762
+ <xsl:attribute name="top-level">true</xsl:attribute>
15763
+ <xsl:copy-of select="node()"/>
15764
+ </xsl:copy>
15765
+
15766
+ <xsl:call-template name="insertOpeningElements">
15767
+ <xsl:with-param name="tree" select="$tree"/>
15768
+ </xsl:call-template>
15769
+
15770
+ </xsl:when>
15771
+ <xsl:otherwise>
15772
+ <xsl:copy-of select="."/>
15773
+ </xsl:otherwise>
15774
+ </xsl:choose>
15775
+ </xsl:template>
15776
+
15777
+ <!-- =========================================================================== -->
15778
+ <!-- END STEP MOVE PAGEBREAK: move <pagebreak/> at top level under 'preface' and 'sections' -->
15421
15779
  <!-- =========================================================================== -->
15422
15780
 
15423
15781
  <!-- =========================================================================== -->
@@ -15707,7 +16065,7 @@
15707
16065
  <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
15708
16066
  </xsl:template>
15709
16067
 
15710
- <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
16068
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'preface']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
15711
16069
  <xsl:copy>
15712
16070
  <xsl:apply-templates select="@*" mode="linear_xml"/>
15713
16071
 
@@ -15726,7 +16084,7 @@
15726
16084
  <xsl:copy-of select="../@inline-header"/>
15727
16085
  </xsl:if>
15728
16086
 
15729
- <xsl:attribute name="ancestor">
16087
+ <xsl:variable name="ancestor">
15730
16088
  <xsl:choose>
15731
16089
  <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
15732
16090
  <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
@@ -15734,6 +16092,35 @@
15734
16092
  <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
15735
16093
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
15736
16094
  </xsl:choose>
16095
+ </xsl:variable>
16096
+ <xsl:attribute name="ancestor">
16097
+ <xsl:value-of select="$ancestor"/>
16098
+ </xsl:attribute>
16099
+
16100
+ <xsl:attribute name="parent">
16101
+ <xsl:choose>
16102
+ <xsl:when test="ancestor::*[local-name() = 'preface']">preface</xsl:when>
16103
+ <xsl:otherwise><xsl:value-of select="$ancestor"/></xsl:otherwise>
16104
+ </xsl:choose>
16105
+ </xsl:attribute>
16106
+
16107
+ <xsl:apply-templates mode="linear_xml"/>
16108
+ </xsl:copy>
16109
+ </xsl:template>
16110
+
16111
+ <xsl:template match="*[local-name() = 'li']" mode="linear_xml" priority="2">
16112
+ <xsl:copy>
16113
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
16114
+
16115
+ <xsl:variable name="ancestor">
16116
+ <xsl:choose>
16117
+ <xsl:when test="ancestor::*[local-name() = 'preface']">preface</xsl:when>
16118
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
16119
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
16120
+ </xsl:choose>
16121
+ </xsl:variable>
16122
+ <xsl:attribute name="ancestor">
16123
+ <xsl:value-of select="$ancestor"/>
15737
16124
  </xsl:attribute>
15738
16125
 
15739
16126
  <xsl:apply-templates mode="linear_xml"/>
@@ -16142,7 +16529,7 @@
16142
16529
  <xsl:value-of select="$depth"/>
16143
16530
  </xsl:when>
16144
16531
  <xsl:otherwise>
16145
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
16532
+ <xsl:variable name="level_total" select="count(ancestor::*[local-name() != 'page_sequence'])"/>
16146
16533
  <xsl:variable name="level">
16147
16534
  <xsl:choose>
16148
16535
  <xsl:when test="parent::*[local-name() = 'preface']">