metanorma-iso 2.0.4 → 2.0.5

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.
@@ -10,6 +10,8 @@
10
10
 
11
11
 
12
12
 
13
+ <xsl:variable name="namespace_full">https://www.metanorma.org/ns/iso</xsl:variable>
14
+
13
15
  <xsl:variable name="debug">false</xsl:variable>
14
16
 
15
17
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
@@ -160,13 +162,15 @@
160
162
  <item level="1" id="Foreword" display="true">Foreword</item>
161
163
  <item id="term-script" display="false">3.2</item>
162
164
  -->
163
- <xsl:variable name="contents">
165
+ <xsl:variable name="contents_">
164
166
  <contents>
165
167
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
166
168
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
167
169
  <xsl:apply-templates select="//iso:indexsect" mode="contents"/>
170
+ <xsl:call-template name="processTablesFigures_Contents"/>
168
171
  </contents>
169
172
  </xsl:variable>
173
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
170
174
 
171
175
  <xsl:variable name="lang_other">
172
176
  <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:title[@language != $lang]">
@@ -1026,270 +1030,327 @@
1026
1030
  </xsl:otherwise>
1027
1031
  </xsl:choose>
1028
1032
 
1029
- <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="{$force-page-count-preface}">
1030
- <xsl:call-template name="insertHeaderFooter">
1031
- <xsl:with-param name="font-weight">normal</xsl:with-param>
1032
- </xsl:call-template>
1033
- <fo:flow flow-name="xsl-region-body" line-height="115%">
1034
- <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1035
-
1036
- <fo:block-container height="252mm" display-align="after">
1037
- <!-- <fo:block margin-bottom="3mm">
1038
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Attention))}" width="14mm" content-height="13mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1039
- <fo:inline padding-left="6mm" font-size="12pt" font-weight="bold"></fo:inline>
1040
- </fo:block> -->
1041
- <fo:block line-height="90%">
1042
- <fo:block font-size="9pt" text-align="justify">
1043
- <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
1033
+ <xsl:variable name="updated_xml_step1">
1034
+ <xsl:apply-templates mode="update_xml_step1"/>
1035
+ </xsl:variable>
1036
+ <!-- DEBUG: updated_xml_step1=<xsl:copy-of select="$updated_xml_step1"/> -->
1037
+
1038
+ <xsl:variable name="updated_xml_step2">
1039
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
1040
+ </xsl:variable>
1041
+ <!-- DEBUG: updated_xml_step2=<xsl:copy-of select="$updated_xml_step2"/> -->
1042
+
1043
+ <xsl:for-each select="xalan:nodeset($updated_xml_step2)">
1044
+
1045
+ <fo:page-sequence master-reference="preface{$document-master-reference}" format="i" force-page-count="{$force-page-count-preface}">
1046
+ <xsl:call-template name="insertHeaderFooter">
1047
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
1048
+ </xsl:call-template>
1049
+ <fo:flow flow-name="xsl-region-body" line-height="115%">
1050
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1051
+
1052
+ <fo:block-container height="252mm" display-align="after">
1053
+ <!-- <fo:block margin-bottom="3mm">
1054
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Attention))}" width="14mm" content-height="13mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>
1055
+ <fo:inline padding-left="6mm" font-size="12pt" font-weight="bold"></fo:inline>
1056
+ </fo:block> -->
1057
+ <fo:block line-height="90%">
1058
+ <fo:block font-size="9pt" text-align="justify">
1059
+ <xsl:apply-templates select="/iso:iso-standard/iso:boilerplate/iso:copyright-statement"/>
1060
+ </fo:block>
1044
1061
  </fo:block>
1045
- </fo:block>
1046
- </fo:block-container>
1047
- </xsl:if>
1048
-
1049
-
1050
- <xsl:choose>
1051
- <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1062
+ </fo:block-container>
1063
+ </xsl:if>
1052
1064
 
1053
- <xsl:otherwise>
1054
- <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1055
- <fo:block break-after="page"/>
1056
- </xsl:if>
1057
- <fo:block-container font-weight="bold">
1058
- <fo:block role="TOC">
1059
- <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1060
- <fo:inline font-size="16pt" font-weight="bold" role="H1">
1061
- <!-- Contents -->
1062
- <xsl:call-template name="getLocalizedString">
1063
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
1064
- </xsl:call-template>
1065
- </fo:inline>
1066
- <fo:inline keep-together.within-line="always">
1067
- <fo:leader leader-pattern="space"/>
1068
- <fo:inline font-weight="normal" font-size="10pt">
1069
- <!-- Page -->
1065
+
1066
+ <xsl:choose>
1067
+ <xsl:when test="$doctype = 'amendment'"/><!-- ToC shouldn't be generated in amendments. -->
1068
+
1069
+ <xsl:otherwise>
1070
+ <xsl:if test="/iso:iso-standard/iso:boilerplate/iso:copyright-statement">
1071
+ <fo:block break-after="page"/>
1072
+ </xsl:if>
1073
+ <fo:block-container font-weight="bold">
1074
+ <fo:block role="TOC">
1075
+ <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1076
+ <fo:inline font-size="16pt" font-weight="bold" role="H1">
1077
+ <!-- Contents -->
1070
1078
  <xsl:call-template name="getLocalizedString">
1071
- <xsl:with-param name="key">locality.page</xsl:with-param>
1072
- </xsl:call-template>
1079
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1080
+ </xsl:call-template>
1073
1081
  </fo:inline>
1074
- </fo:inline>
1075
- </fo:block>
1076
-
1077
- <xsl:if test="$debug = 'true'">
1078
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1079
- DEBUG
1080
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
1081
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1082
- </xsl:if>
1083
-
1084
- <xsl:variable name="margin-left">12</xsl:variable>
1085
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1082
+ <fo:inline keep-together.within-line="always">
1083
+ <fo:leader leader-pattern="space"/>
1084
+ <fo:inline font-weight="normal" font-size="10pt">
1085
+ <!-- Page -->
1086
+ <xsl:call-template name="getLocalizedString">
1087
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1088
+ </xsl:call-template>
1089
+ </fo:inline>
1090
+ </fo:inline>
1091
+ </fo:block>
1086
1092
 
1087
- <fo:block role="TOCI">
1088
- <xsl:if test="@level = 1">
1089
- <xsl:attribute name="margin-top">5pt</xsl:attribute>
1090
- </xsl:if>
1091
- <xsl:if test="@level = 3">
1092
- <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1093
- </xsl:if>
1094
- <fo:list-block>
1095
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1096
- <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1097
- <xsl:attribute name="font-weight">normal</xsl:attribute>
1093
+ <xsl:if test="$debug = 'true'">
1094
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1095
+ DEBUG
1096
+ contents=<xsl:copy-of select="$contents"/>
1097
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1098
+ </xsl:if>
1099
+
1100
+ <xsl:variable name="margin-left">12</xsl:variable>
1101
+ <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1102
+
1103
+ <fo:block role="TOCI">
1104
+ <xsl:if test="@level = 1">
1105
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
1098
1106
  </xsl:if>
1099
- <xsl:attribute name="provisional-distance-between-starts">
1100
- <xsl:choose>
1101
- <!-- skip 0 section without subsections -->
1102
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1103
- <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1104
- <xsl:otherwise>0mm</xsl:otherwise>
1105
- </xsl:choose>
1106
- </xsl:attribute>
1107
- <fo:list-item>
1108
- <fo:list-item-label end-indent="label-end()">
1109
- <fo:block>
1110
- <xsl:value-of select="@section"/>
1111
- </fo:block>
1112
- </fo:list-item-label>
1113
- <fo:list-item-body start-indent="body-start()">
1114
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1115
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1116
-
1117
- <xsl:apply-templates select="title"/>
1107
+ <xsl:if test="@level = 3">
1108
+ <xsl:attribute name="margin-top">-0.7pt</xsl:attribute>
1109
+ </xsl:if>
1110
+ <fo:list-block>
1111
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-left * (@level - 1)"/>mm</xsl:attribute>
1112
+ <xsl:if test="@level &gt;= 2 or @type = 'annex'">
1113
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1114
+ </xsl:if>
1115
+ <xsl:attribute name="provisional-distance-between-starts">
1116
+ <xsl:choose>
1117
+ <!-- skip 0 section without subsections -->
1118
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="$margin-left * 1.2"/>mm</xsl:when>
1119
+ <xsl:when test="@section != ''"><xsl:value-of select="$margin-left"/>mm</xsl:when>
1120
+ <xsl:otherwise>0mm</xsl:otherwise>
1121
+ </xsl:choose>
1122
+ </xsl:attribute>
1123
+ <fo:list-item>
1124
+ <fo:list-item-label end-indent="label-end()">
1125
+ <fo:block>
1126
+ <xsl:value-of select="@section"/>
1127
+ </fo:block>
1128
+ </fo:list-item-label>
1129
+ <fo:list-item-body start-indent="body-start()">
1130
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
1131
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1118
1132
 
1119
- <fo:inline keep-together.within-line="always">
1120
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1121
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1122
- </fo:inline>
1123
- </fo:basic-link>
1124
- </fo:block>
1125
- </fo:list-item-body>
1126
- </fo:list-item>
1127
- </fo:list-block>
1128
- </fo:block>
1133
+ <xsl:apply-templates select="title"/>
1134
+
1135
+ <fo:inline keep-together.within-line="always">
1136
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1137
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1138
+ </fo:inline>
1139
+ </fo:basic-link>
1140
+ </fo:block>
1141
+ </fo:list-item-body>
1142
+ </fo:list-item>
1143
+ </fo:list-block>
1144
+ </fo:block>
1145
+
1146
+ </xsl:for-each>
1129
1147
 
1130
- </xsl:for-each>
1131
- </fo:block>
1132
- </fo:block-container>
1133
- </xsl:otherwise>
1134
- </xsl:choose>
1135
-
1136
- <!-- Foreword, Introduction -->
1137
- <xsl:call-template name="processPrefaceSectionsDefault"/>
1148
+ <!-- List of Tables -->
1149
+ <xsl:if test="$contents//tables/table">
1150
+ <xsl:call-template name="insertListOf_Title">
1151
+ <xsl:with-param name="title" select="$title-list-tables"/>
1152
+ </xsl:call-template>
1153
+ <xsl:for-each select="$contents//tables/table">
1154
+ <xsl:call-template name="insertListOf_Item"/>
1155
+ </xsl:for-each>
1156
+ </xsl:if>
1157
+
1158
+ <!-- List of Figures -->
1159
+ <xsl:if test="$contents//figures/figure">
1160
+ <xsl:call-template name="insertListOf_Title">
1161
+ <xsl:with-param name="title" select="$title-list-figures"/>
1162
+ </xsl:call-template>
1163
+ <xsl:for-each select="$contents//figures/figure">
1164
+ <xsl:call-template name="insertListOf_Item"/>
1165
+ </xsl:for-each>
1166
+ </xsl:if>
1167
+
1168
+ </fo:block>
1169
+ </fo:block-container>
1170
+ </xsl:otherwise>
1171
+ </xsl:choose>
1138
1172
 
1139
- </fo:flow>
1140
- </fo:page-sequence>
1141
-
1142
- <!-- BODY -->
1143
- <fo:page-sequence master-reference="document{$document-master-reference}" initial-page-number="1" force-page-count="no-force">
1144
- <fo:static-content flow-name="xsl-footnote-separator">
1145
- <fo:block>
1146
- <fo:leader leader-pattern="rule" leader-length="30%"/>
1147
- </fo:block>
1148
- </fo:static-content>
1149
- <xsl:call-template name="insertHeaderFooter"/>
1150
- <fo:flow flow-name="xsl-region-body">
1173
+ <!-- Foreword, Introduction -->
1174
+ <xsl:call-template name="processPrefaceSectionsDefault"/>
1175
+
1176
+ </fo:flow>
1177
+ </fo:page-sequence>
1151
1178
 
1152
-
1153
- <fo:block-container>
1154
- <!-- Information and documentation — Codes for transcription systems -->
1155
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1156
- <xsl:value-of select="$title-en"/>
1179
+ <!-- BODY -->
1180
+ <fo:page-sequence master-reference="document{$document-master-reference}" initial-page-number="1" force-page-count="no-force">
1181
+ <fo:static-content flow-name="xsl-footnote-separator">
1182
+ <fo:block>
1183
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
1157
1184
  </fo:block>
1158
- -->
1159
- <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1185
+ </fo:static-content>
1186
+ <xsl:call-template name="insertHeaderFooter"/>
1187
+ <fo:flow flow-name="xsl-region-body">
1188
+
1160
1189
 
1161
- <fo:block role="H1">
1190
+ <fo:block-container>
1191
+ <!-- Information and documentation — Codes for transcription systems -->
1192
+ <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
1193
+ <xsl:value-of select="$title-en"/>
1194
+ </fo:block>
1195
+ -->
1196
+ <fo:block font-size="18pt" font-weight="bold" margin-top="40pt" margin-bottom="20pt" line-height="1.1">
1162
1197
 
1163
- <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1198
+ <fo:block role="H1">
1164
1199
 
1165
- <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1200
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
1201
+
1202
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
1203
+
1204
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
1205
+ <xsl:with-param name="isMainLang">true</xsl:with-param>
1206
+ <xsl:with-param name="isMainBody">true</xsl:with-param>
1207
+ </xsl:apply-templates>
1208
+
1209
+ </fo:block>
1210
+ <fo:block role="H1">
1211
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1212
+ </fo:block>
1166
1213
 
1167
- <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']">
1214
+ <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
1168
1215
  <xsl:with-param name="isMainLang">true</xsl:with-param>
1169
1216
  <xsl:with-param name="isMainBody">true</xsl:with-param>
1170
1217
  </xsl:apply-templates>
1171
1218
 
1172
1219
  </fo:block>
1173
- <fo:block role="H1">
1174
- <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
1175
- </fo:block>
1220
+
1221
+ </fo:block-container>
1222
+ <!-- Clause(s) -->
1223
+ <fo:block>
1176
1224
 
1177
- <xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']">
1178
- <xsl:with-param name="isMainLang">true</xsl:with-param>
1179
- <xsl:with-param name="isMainBody">true</xsl:with-param>
1180
- </xsl:apply-templates>
1225
+ <xsl:choose>
1226
+ <xsl:when test="$doctype = 'amendment'">
1227
+ <xsl:apply-templates select="/iso:iso-standard/iso:sections/*"/>
1228
+ </xsl:when>
1229
+ <xsl:otherwise>
1230
+ <xsl:call-template name="processMainSectionsDefault"/>
1231
+ </xsl:otherwise>
1232
+ </xsl:choose>
1181
1233
 
1234
+ <fo:block id="lastBlock" font-size="1pt"> </fo:block>
1182
1235
  </fo:block>
1183
-
1184
- </fo:block-container>
1185
- <!-- Clause(s) -->
1186
- <fo:block>
1187
1236
 
1188
- <xsl:choose>
1189
- <xsl:when test="$doctype = 'amendment'">
1190
- <xsl:apply-templates select="/iso:iso-standard/iso:sections/*"/>
1191
- </xsl:when>
1192
- <xsl:otherwise>
1193
- <xsl:call-template name="processMainSectionsDefault"/>
1194
- </xsl:otherwise>
1195
- </xsl:choose>
1196
-
1197
- <fo:block id="lastBlock" font-size="1pt"> </fo:block>
1198
- </fo:block>
1199
-
1200
- </fo:flow>
1201
- </fo:page-sequence>
1202
-
1203
-
1204
- <!-- Index -->
1205
- <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1206
-
1207
- <xsl:if test="$isPublished = 'true'">
1208
- <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1209
- <xsl:call-template name="insertHeaderEven"/>
1210
- <fo:static-content flow-name="last-page-footer" font-size="10pt">
1211
- <fo:table table-layout="fixed" width="100%">
1212
- <fo:table-column column-width="33%"/>
1213
- <fo:table-column column-width="33%"/>
1214
- <fo:table-column column-width="34%"/>
1215
- <fo:table-body>
1216
- <fo:table-row>
1217
- <fo:table-cell display-align="center">
1218
- <fo:block font-size="9pt"><xsl:value-of select="$copyrightText"/></fo:block>
1219
- </fo:table-cell>
1220
- <fo:table-cell>
1221
- <fo:block font-size="11pt" font-weight="bold" text-align="center">
1222
- <xsl:if test="$stage-abbreviation = 'PRF'">
1223
- <xsl:value-of select="$proof-text"/>
1224
- </xsl:if>
1237
+ </fo:flow>
1238
+ </fo:page-sequence>
1239
+
1240
+
1241
+ <!-- Index -->
1242
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1243
+
1244
+ <xsl:if test="$isPublished = 'true'">
1245
+ <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1246
+ <xsl:call-template name="insertHeaderEven"/>
1247
+ <fo:static-content flow-name="last-page-footer" font-size="10pt">
1248
+ <fo:table table-layout="fixed" width="100%">
1249
+ <fo:table-column column-width="33%"/>
1250
+ <fo:table-column column-width="33%"/>
1251
+ <fo:table-column column-width="34%"/>
1252
+ <fo:table-body>
1253
+ <fo:table-row>
1254
+ <fo:table-cell display-align="center">
1255
+ <fo:block font-size="9pt"><xsl:value-of select="$copyrightText"/></fo:block>
1256
+ </fo:table-cell>
1257
+ <fo:table-cell>
1258
+ <fo:block font-size="11pt" font-weight="bold" text-align="center">
1259
+ <xsl:if test="$stage-abbreviation = 'PRF'">
1260
+ <xsl:value-of select="$proof-text"/>
1261
+ </xsl:if>
1262
+ </fo:block>
1263
+ </fo:table-cell>
1264
+ <fo:table-cell>
1265
+ <fo:block> </fo:block>
1266
+ </fo:table-cell>
1267
+ </fo:table-row>
1268
+ </fo:table-body>
1269
+ </fo:table>
1270
+ </fo:static-content>
1271
+ <fo:flow flow-name="xsl-region-body">
1272
+ <fo:block-container height="252mm" display-align="after">
1273
+ <fo:block-container border-top="1mm double black">
1274
+ <fo:block font-size="12pt" font-weight="bold" padding-top="3.5mm" padding-bottom="0.5mm">
1275
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
1276
+ <xsl:if test="position() = 1"><fo:inline>ICS  </fo:inline></xsl:if>
1277
+ <xsl:value-of select="."/>
1278
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
1279
+ </xsl:for-each> 
1280
+ <!-- <xsl:choose>
1281
+ <xsl:when test="$stage-name = 'FDIS'">ICS&#xA0;&#xA0;01.140.30</xsl:when>
1282
+ <xsl:when test="$stage-name = 'PRF'">ICS&#xA0;&#xA0;35.240.63</xsl:when>
1283
+ <xsl:when test="$stage-name = 'published'">ICS&#xA0;&#xA0;35.240.30</xsl:when>
1284
+ <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1285
+ </xsl:choose> -->
1225
1286
  </fo:block>
1226
- </fo:table-cell>
1227
- <fo:table-cell>
1228
- <fo:block> </fo:block>
1229
- </fo:table-cell>
1230
- </fo:table-row>
1231
- </fo:table-body>
1232
- </fo:table>
1233
- </fo:static-content>
1234
- <fo:flow flow-name="xsl-region-body">
1235
- <fo:block-container height="252mm" display-align="after">
1236
- <fo:block-container border-top="1mm double black">
1237
- <fo:block font-size="12pt" font-weight="bold" padding-top="3.5mm" padding-bottom="0.5mm">
1238
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:ics/iso:code">
1239
- <xsl:if test="position() = 1"><fo:inline>ICS  </fo:inline></xsl:if>
1240
- <xsl:value-of select="."/>
1241
- <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
1242
- </xsl:for-each> 
1243
- <!-- <xsl:choose>
1244
- <xsl:when test="$stage-name = 'FDIS'">ICS&#xA0;&#xA0;01.140.30</xsl:when>
1245
- <xsl:when test="$stage-name = 'PRF'">ICS&#xA0;&#xA0;35.240.63</xsl:when>
1246
- <xsl:when test="$stage-name = 'published'">ICS&#xA0;&#xA0;35.240.30</xsl:when>
1247
- <xsl:otherwise>ICS&#xA0;&#xA0;67.060</xsl:otherwise>
1248
- </xsl:choose> -->
1249
- </fo:block>
1250
- <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1251
- <fo:block font-size="9pt" margin-bottom="6pt">
1252
- <xsl:variable name="title-descriptors">
1253
- <xsl:call-template name="getTitle">
1254
- <xsl:with-param name="name" select="'title-descriptors'"/>
1287
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:keyword">
1288
+ <fo:block font-size="9pt" margin-bottom="6pt">
1289
+ <xsl:variable name="title-descriptors">
1290
+ <xsl:call-template name="getTitle">
1291
+ <xsl:with-param name="name" select="'title-descriptors'"/>
1292
+ </xsl:call-template>
1293
+ </xsl:variable>
1294
+ <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1295
+ <xsl:call-template name="insertKeywords">
1296
+ <xsl:with-param name="sorting">no</xsl:with-param>
1255
1297
  </xsl:call-template>
1256
- </xsl:variable>
1257
- <fo:inline font-weight="bold"><xsl:value-of select="$title-descriptors"/>: </fo:inline>
1258
- <xsl:call-template name="insertKeywords">
1259
- <xsl:with-param name="sorting">no</xsl:with-param>
1298
+ </fo:block>
1299
+ </xsl:if>
1300
+ <xsl:variable name="countPages"/>
1301
+ <xsl:variable name="price_based_on">
1302
+ <xsl:call-template name="getLocalizedString">
1303
+ <xsl:with-param name="key">price_based_on</xsl:with-param>
1260
1304
  </xsl:call-template>
1305
+ </xsl:variable>
1306
+ <xsl:variable name="price_based_on_items">
1307
+ <xsl:call-template name="split">
1308
+ <xsl:with-param name="pText" select="$price_based_on"/>
1309
+ <xsl:with-param name="sep" select="'%'"/>
1310
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
1311
+ </xsl:call-template>
1312
+ </xsl:variable>
1313
+ <!-- Price based on ... pages -->
1314
+ <fo:block font-size="9pt">
1315
+ <xsl:for-each select="xalan:nodeset($price_based_on_items)/item">
1316
+ <xsl:value-of select="."/>
1317
+ <xsl:if test="position() != last()">
1318
+ <fo:page-number-citation ref-id="lastBlock"/>
1319
+ </xsl:if>
1320
+ </xsl:for-each>
1261
1321
  </fo:block>
1262
- </xsl:if>
1263
- <xsl:variable name="countPages"/>
1264
- <xsl:variable name="price_based_on">
1265
- <xsl:call-template name="getLocalizedString">
1266
- <xsl:with-param name="key">price_based_on</xsl:with-param>
1267
- </xsl:call-template>
1268
- </xsl:variable>
1269
- <xsl:variable name="price_based_on_items">
1270
- <xsl:call-template name="split">
1271
- <xsl:with-param name="pText" select="$price_based_on"/>
1272
- <xsl:with-param name="sep" select="'%'"/>
1273
- <xsl:with-param name="normalize-space">false</xsl:with-param>
1274
- </xsl:call-template>
1275
- </xsl:variable>
1276
- <!-- Price based on ... pages -->
1277
- <fo:block font-size="9pt">
1278
- <xsl:for-each select="xalan:nodeset($price_based_on_items)/item">
1279
- <xsl:value-of select="."/>
1280
- <xsl:if test="position() != last()">
1281
- <fo:page-number-citation ref-id="lastBlock"/>
1282
- </xsl:if>
1283
- </xsl:for-each>
1284
- </fo:block>
1322
+ </fo:block-container>
1285
1323
  </fo:block-container>
1286
- </fo:block-container>
1287
- </fo:flow>
1288
- </fo:page-sequence>
1289
- </xsl:if>
1324
+ </fo:flow>
1325
+ </fo:page-sequence>
1326
+ </xsl:if>
1327
+ </xsl:for-each>
1290
1328
  </fo:root>
1291
1329
  </xsl:template>
1292
1330
 
1331
+
1332
+ <xsl:template name="insertListOf_Title">
1333
+ <xsl:param name="title"/>
1334
+ <fo:block role="TOCI" margin-top="5pt" keep-with-next="always">
1335
+ <xsl:value-of select="$title"/>
1336
+ </fo:block>
1337
+ </xsl:template>
1338
+
1339
+ <xsl:template name="insertListOf_Item">
1340
+ <fo:block role="TOCI" font-weight="normal" text-align-last="justify" margin-left="12mm">
1341
+ <fo:basic-link internal-destination="{@id}">
1342
+ <xsl:call-template name="setAltText">
1343
+ <xsl:with-param name="value" select="@alt-text"/>
1344
+ </xsl:call-template>
1345
+ <xsl:apply-templates select="." mode="contents"/>
1346
+ <fo:inline keep-together.within-line="always">
1347
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
1348
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1349
+ </fo:inline>
1350
+ </fo:basic-link>
1351
+ </fo:block>
1352
+ </xsl:template>
1353
+
1293
1354
  <!-- ==================== -->
1294
1355
  <!-- display titles -->
1295
1356
  <!-- ==================== -->
@@ -1878,7 +1939,7 @@
1878
1939
  </xsl:template>
1879
1940
 
1880
1941
 
1881
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
1942
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
1882
1943
  <xsl:call-template name="getLang"/>
1883
1944
  </xsl:variable><xsl:variable name="pageWidth_">
1884
1945
  210
@@ -1922,7 +1983,7 @@
1922
1983
  <xsl:text>Contents</xsl:text>
1923
1984
 
1924
1985
  </title-toc>
1925
-
1986
+
1926
1987
  <title-descriptors lang="en">Descriptors</title-descriptors>
1927
1988
 
1928
1989
  <title-part lang="en">
@@ -1964,7 +2025,31 @@
1964
2025
  <title-continued lang="en">(continued)</title-continued>
1965
2026
  <title-continued lang="fr">(continué)</title-continued>
1966
2027
 
1967
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
2028
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
2029
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
2030
+ <xsl:value-of select="$toc_table_title"/>
2031
+ <xsl:if test="normalize-space($toc_table_title) = ''">
2032
+ <xsl:call-template name="getTitle">
2033
+ <xsl:with-param name="name" select="'title-list-tables'"/>
2034
+ </xsl:call-template>
2035
+ </xsl:if>
2036
+ </xsl:variable><xsl:variable name="title-list-figures">
2037
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
2038
+ <xsl:value-of select="$toc_figure_title"/>
2039
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
2040
+ <xsl:call-template name="getTitle">
2041
+ <xsl:with-param name="name" select="'title-list-figures'"/>
2042
+ </xsl:call-template>
2043
+ </xsl:if>
2044
+ </xsl:variable><xsl:variable name="title-list-recommendations">
2045
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
2046
+ <xsl:value-of select="$toc_requirement_title"/>
2047
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
2048
+ <xsl:call-template name="getTitle">
2049
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
2050
+ </xsl:call-template>
2051
+ </xsl:if>
2052
+ </xsl:variable><xsl:variable name="bibdata">
1968
2053
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1969
2054
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1970
2055
  </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
@@ -3217,6 +3302,30 @@
3217
3302
  <xsl:sort select="@displayorder" data-type="number"/>
3218
3303
  <xsl:apply-templates select="." mode="contents"/>
3219
3304
  </xsl:for-each>
3305
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
3306
+ <xsl:param name="always"/>
3307
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3308
+ <xsl:call-template name="processTables_Contents"/>
3309
+ </xsl:if>
3310
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3311
+ <xsl:call-template name="processFigures_Contents"/>
3312
+ </xsl:if>
3313
+ </xsl:template><xsl:template name="processTables_Contents">
3314
+ <tables>
3315
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3316
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3317
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3318
+ </table>
3319
+ </xsl:for-each>
3320
+ </tables>
3321
+ </xsl:template><xsl:template name="processFigures_Contents">
3322
+ <figures>
3323
+ <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
3324
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3325
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3326
+ </figure>
3327
+ </xsl:for-each>
3328
+ </figures>
3220
3329
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3221
3330
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3222
3331
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -4083,37 +4192,7 @@
4083
4192
 
4084
4193
  <!-- list of footnotes to calculate actual footnotes number -->
4085
4194
  <xsl:variable name="p_fn_">
4086
- <xsl:choose>
4087
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4088
- <fn gen_id="{generate-id(.)}">
4089
- <xsl:copy-of select="@*"/>
4090
- <xsl:copy-of select="node()"/>
4091
- </fn>
4092
- </xsl:when>
4093
- <xsl:otherwise>
4094
- <!-- itetation for:
4095
- footnotes in bibdata/title
4096
- footnotes in bibliography
4097
- footnotes in document's body (except table's head/body/foot and figure text)
4098
- -->
4099
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4100
- <fn gen_id="{generate-id(.)}">
4101
- <xsl:copy-of select="@*"/>
4102
- <xsl:copy-of select="node()"/>
4103
- </fn>
4104
- </xsl:for-each>
4105
- <xsl:for-each select="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']/*">
4106
- <xsl:sort select="@displayorder" data-type="number"/>
4107
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4108
- <!-- copy unique fn -->
4109
- <fn gen_id="{generate-id(.)}">
4110
- <xsl:copy-of select="@*"/>
4111
- <xsl:copy-of select="node()"/>
4112
- </fn>
4113
- </xsl:for-each>
4114
- </xsl:for-each>
4115
- </xsl:otherwise>
4116
- </xsl:choose>
4195
+ <xsl:call-template name="get_fn_list"/>
4117
4196
  </xsl:variable>
4118
4197
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4119
4198
 
@@ -4176,6 +4255,38 @@
4176
4255
  <xsl:copy-of select="$footnote_inline"/>
4177
4256
  </xsl:otherwise>
4178
4257
  </xsl:choose>
4258
+ </xsl:template><xsl:template name="get_fn_list">
4259
+ <xsl:choose>
4260
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4261
+ <fn gen_id="{generate-id(.)}">
4262
+ <xsl:copy-of select="@*"/>
4263
+ <xsl:copy-of select="node()"/>
4264
+ </fn>
4265
+ </xsl:when>
4266
+ <xsl:otherwise>
4267
+ <!-- itetation for:
4268
+ footnotes in bibdata/title
4269
+ footnotes in bibliography
4270
+ footnotes in document's body (except table's head/body/foot and figure text)
4271
+ -->
4272
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4273
+ <fn gen_id="{generate-id(.)}">
4274
+ <xsl:copy-of select="@*"/>
4275
+ <xsl:copy-of select="node()"/>
4276
+ </fn>
4277
+ </xsl:for-each>
4278
+ <xsl:for-each select="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']/*">
4279
+ <xsl:sort select="@displayorder" data-type="number"/>
4280
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4281
+ <!-- copy unique fn -->
4282
+ <fn gen_id="{generate-id(.)}">
4283
+ <xsl:copy-of select="@*"/>
4284
+ <xsl:copy-of select="node()"/>
4285
+ </fn>
4286
+ </xsl:for-each>
4287
+ </xsl:for-each>
4288
+ </xsl:otherwise>
4289
+ </xsl:choose>
4179
4290
  </xsl:template><xsl:template name="table_fn_display">
4180
4291
  <xsl:variable name="references">
4181
4292
 
@@ -4352,7 +4463,7 @@
4352
4463
  </fo:inline>
4353
4464
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4354
4465
  <fo:inline><xsl:value-of select="."/></fo:inline>
4355
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4466
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4356
4467
  <fo:inline>
4357
4468
  <xsl:apply-templates/>
4358
4469
  </fo:inline>
@@ -6063,13 +6174,14 @@
6063
6174
  <xsl:apply-templates mode="bookmarks"/>
6064
6175
  </xsl:template><xsl:template name="addBookmarks">
6065
6176
  <xsl:param name="contents"/>
6066
- <xsl:if test="xalan:nodeset($contents)//item">
6177
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6178
+ <xsl:if test="$contents_nodes//item">
6067
6179
  <fo:bookmark-tree>
6068
6180
  <xsl:choose>
6069
- <xsl:when test="xalan:nodeset($contents)/doc">
6181
+ <xsl:when test="$contents_nodes/doc">
6070
6182
  <xsl:choose>
6071
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
6072
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6183
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
6184
+ <xsl:for-each select="$contents_nodes/doc">
6073
6185
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6074
6186
  <xsl:if test="@bundle = 'true'">
6075
6187
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -6120,7 +6232,7 @@
6120
6232
  </xsl:for-each>
6121
6233
  </xsl:when>
6122
6234
  <xsl:otherwise>
6123
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6235
+ <xsl:for-each select="$contents_nodes/doc">
6124
6236
 
6125
6237
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
6126
6238
 
@@ -6138,25 +6250,36 @@
6138
6250
  </xsl:choose>
6139
6251
  </xsl:when>
6140
6252
  <xsl:otherwise>
6141
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
6253
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
6254
+
6255
+ <xsl:call-template name="insertFigureBookmarks">
6256
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6257
+ </xsl:call-template>
6258
+
6259
+ <xsl:call-template name="insertTableBookmarks">
6260
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6261
+ <xsl:with-param name="lang" select="@lang"/>
6262
+ </xsl:call-template>
6263
+
6142
6264
  </xsl:otherwise>
6143
6265
  </xsl:choose>
6144
6266
 
6267
+
6145
6268
 
6146
6269
 
6147
6270
 
6148
6271
 
6149
-
6150
-
6272
+
6151
6273
 
6152
6274
  </fo:bookmark-tree>
6153
6275
  </xsl:if>
6154
6276
  </xsl:template><xsl:template name="insertFigureBookmarks">
6155
6277
  <xsl:param name="contents"/>
6156
- <xsl:if test="xalan:nodeset($contents)/figure">
6157
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
6278
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6279
+ <xsl:if test="$contents_nodes/figure">
6280
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
6158
6281
  <fo:bookmark-title>Figures</fo:bookmark-title>
6159
- <xsl:for-each select="xalan:nodeset($contents)/figure">
6282
+ <xsl:for-each select="$contents_nodes/figure">
6160
6283
  <fo:bookmark internal-destination="{@id}">
6161
6284
  <fo:bookmark-title>
6162
6285
  <xsl:value-of select="normalize-space(title)"/>
@@ -6165,18 +6288,40 @@
6165
6288
  </xsl:for-each>
6166
6289
  </fo:bookmark>
6167
6290
  </xsl:if>
6291
+
6292
+
6293
+ <xsl:if test="$contents_nodes//figures/figure">
6294
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6295
+
6296
+
6297
+
6298
+ <xsl:variable name="bookmark-title">
6299
+
6300
+ <xsl:value-of select="$title-list-figures"/>
6301
+
6302
+ </xsl:variable>
6303
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
6304
+ <xsl:for-each select="$contents_nodes//figures/figure">
6305
+ <fo:bookmark internal-destination="{@id}">
6306
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6307
+ </fo:bookmark>
6308
+ </xsl:for-each>
6309
+ </fo:bookmark>
6310
+ </xsl:if>
6311
+
6168
6312
  </xsl:template><xsl:template name="insertTableBookmarks">
6169
6313
  <xsl:param name="contents"/>
6170
6314
  <xsl:param name="lang"/>
6171
- <xsl:if test="xalan:nodeset($contents)/table">
6172
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
6315
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6316
+ <xsl:if test="$contents_nodes/table">
6317
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
6173
6318
  <fo:bookmark-title>
6174
6319
  <xsl:choose>
6175
6320
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
6176
6321
  <xsl:otherwise>Tables</xsl:otherwise>
6177
6322
  </xsl:choose>
6178
6323
  </fo:bookmark-title>
6179
- <xsl:for-each select="xalan:nodeset($contents)/table">
6324
+ <xsl:for-each select="$contents_nodes/table">
6180
6325
  <fo:bookmark internal-destination="{@id}">
6181
6326
  <fo:bookmark-title>
6182
6327
  <xsl:value-of select="normalize-space(title)"/>
@@ -6185,6 +6330,29 @@
6185
6330
  </xsl:for-each>
6186
6331
  </fo:bookmark>
6187
6332
  </xsl:if>
6333
+
6334
+
6335
+ <xsl:if test="$contents_nodes//tables/table">
6336
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6337
+
6338
+
6339
+
6340
+ <xsl:variable name="bookmark-title">
6341
+
6342
+ <xsl:value-of select="$title-list-tables"/>
6343
+
6344
+ </xsl:variable>
6345
+
6346
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
6347
+
6348
+ <xsl:for-each select="$contents_nodes//tables/table">
6349
+ <fo:bookmark internal-destination="{@id}">
6350
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6351
+ </fo:bookmark>
6352
+ </xsl:for-each>
6353
+ </fo:bookmark>
6354
+ </xsl:if>
6355
+
6188
6356
  </xsl:template><xsl:template name="getLangVersion">
6189
6357
  <xsl:param name="lang"/>
6190
6358
  <xsl:param name="doctype" select="''"/>
@@ -6846,6 +7014,8 @@
6846
7014
  </xsl:otherwise>
6847
7015
  </xsl:choose> -->
6848
7016
  </fo:block>
7017
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7018
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6849
7019
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6850
7020
  <xsl:if test="normalize-space() != ''">
6851
7021
  <xsl:value-of select="."/>
@@ -6920,26 +7090,11 @@
6920
7090
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6921
7091
  <xsl:text>— </xsl:text>
6922
7092
  <xsl:apply-templates/>
6923
- </xsl:template><xsl:variable name="bibitem_hidden_">
6924
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6925
- <xsl:copy-of select="."/>
6926
- </xsl:for-each>
6927
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6928
- <xsl:copy-of select="."/>
6929
- </xsl:for-each>
6930
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6931
-
6932
- <xsl:variable name="bibitemid">
6933
- <xsl:choose>
6934
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6935
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6936
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6937
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6938
- </xsl:choose>
6939
- </xsl:variable>
6940
-
7093
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
7094
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7095
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
6941
7096
  <xsl:choose>
6942
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
7097
+ <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
6943
7098
  <fo:inline xsl:use-attribute-sets="eref-style">
6944
7099
  <xsl:if test="@type = 'footnote'">
6945
7100
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6953,8 +7108,8 @@
6953
7108
  <xsl:variable name="text" select="normalize-space()"/>
6954
7109
 
6955
7110
 
6956
-
6957
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7111
+
7112
+ <fo:basic-link fox:alt-text="{@citeas}">
6958
7113
  <xsl:if test="normalize-space(@citeas) = ''">
6959
7114
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6960
7115
  </xsl:if>
@@ -6964,14 +7119,21 @@
6964
7119
 
6965
7120
  </xsl:if>
6966
7121
 
6967
-
7122
+ <xsl:choose>
7123
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
7124
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
7125
+ </xsl:when>
7126
+ <xsl:otherwise>
7127
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7128
+ </xsl:otherwise>
7129
+ </xsl:choose>
6968
7130
 
6969
7131
  <xsl:apply-templates/>
6970
7132
  </fo:basic-link>
6971
-
7133
+
6972
7134
  </fo:inline>
6973
7135
  </xsl:when>
6974
- <xsl:otherwise>
7136
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6975
7137
  <fo:inline><xsl:apply-templates/></fo:inline>
6976
7138
  </xsl:otherwise>
6977
7139
  </xsl:choose>
@@ -7697,27 +7859,47 @@
7697
7859
  <xsl:apply-templates/>
7698
7860
  </fo:inline>
7699
7861
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7862
+
7863
+ <!-- list of footnotes to calculate actual footnotes number -->
7864
+ <xsl:variable name="p_fn_">
7865
+ <xsl:call-template name="get_fn_list"/>
7866
+ </xsl:variable>
7867
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7868
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7869
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7870
+ <!-- fn sequence number in document -->
7871
+ <xsl:variable name="current_fn_number">
7872
+ <xsl:choose>
7873
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7874
+ <xsl:otherwise>
7875
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7876
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7877
+ </xsl:otherwise>
7878
+ </xsl:choose>
7879
+ </xsl:variable>
7700
7880
  <fo:footnote>
7701
7881
  <xsl:variable name="number">
7702
7882
 
7703
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7883
+ <xsl:value-of select="$current_fn_number"/>
7704
7884
 
7705
7885
  </xsl:variable>
7706
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7707
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
7708
- <xsl:value-of select="$number"/>
7709
-
7886
+
7887
+ <xsl:variable name="current_fn_number_text">
7888
+ <xsl:value-of select="$number"/>
7889
+
7710
7890
  <xsl:text>)</xsl:text>
7711
7891
 
7892
+ </xsl:variable>
7893
+
7894
+ <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7895
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7896
+ <xsl:value-of select="$current_fn_number_text"/>
7712
7897
  </fo:basic-link>
7713
7898
  </fo:inline>
7714
7899
  <fo:footnote-body>
7715
7900
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
7716
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7717
- <xsl:value-of select="$number"/>
7718
-
7719
- <xsl:text>)</xsl:text>
7720
-
7901
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7902
+ <xsl:value-of select="$current_fn_number_text"/>
7721
7903
  </fo:inline>
7722
7904
  <xsl:apply-templates/>
7723
7905
  </fo:block>
@@ -7952,7 +8134,140 @@
7952
8134
  <!-- processing for admonition/p found in the template for 'p' -->
7953
8135
  <xsl:call-template name="paragraph"/>
7954
8136
 
7955
- </xsl:template><xsl:template name="convertDate">
8137
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
8138
+ <xsl:copy>
8139
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
8140
+ </xsl:copy>
8141
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
8142
+ <xsl:copy>
8143
+ <xsl:copy-of select="@*"/>
8144
+
8145
+ <xsl:variable name="nodes_preface_">
8146
+ <xsl:for-each select="*">
8147
+ <node id="{@id}"/>
8148
+ </xsl:for-each>
8149
+ </xsl:variable>
8150
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
8151
+
8152
+ <xsl:for-each select="*">
8153
+ <xsl:sort select="@displayorder" data-type="number"/>
8154
+
8155
+ <!-- process Section's title -->
8156
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8157
+ <xsl:if test="$preceding-sibling_id != ''">
8158
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8159
+ </xsl:if>
8160
+
8161
+ <xsl:choose>
8162
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8163
+ <xsl:otherwise>
8164
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8165
+ </xsl:otherwise>
8166
+ </xsl:choose>
8167
+
8168
+ </xsl:for-each>
8169
+ </xsl:copy>
8170
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
8171
+ <xsl:copy>
8172
+ <xsl:copy-of select="@*"/>
8173
+
8174
+ <xsl:variable name="nodes_sections_">
8175
+ <xsl:for-each select="*">
8176
+ <node id="{@id}"/>
8177
+ </xsl:for-each>
8178
+ </xsl:variable>
8179
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
8180
+
8181
+ <!-- move section 'Normative references' inside 'sections' -->
8182
+ <xsl:for-each select="* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
8183
+ <xsl:sort select="@displayorder" data-type="number"/>
8184
+
8185
+ <!-- process Section's title -->
8186
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8187
+ <xsl:if test="$preceding-sibling_id != ''">
8188
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8189
+ </xsl:if>
8190
+
8191
+ <xsl:choose>
8192
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8193
+ <xsl:otherwise>
8194
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8195
+ </xsl:otherwise>
8196
+ </xsl:choose>
8197
+
8198
+ </xsl:for-each>
8199
+ </xsl:copy>
8200
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
8201
+ <xsl:copy>
8202
+ <xsl:copy-of select="@*"/>
8203
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8204
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8205
+ <xsl:sort select="@displayorder" data-type="number"/>
8206
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8207
+ </xsl:for-each>
8208
+ </xsl:copy>
8209
+ </xsl:template>
8210
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
8211
+ <xsl:template match="@*|node()" mode="update_xml_step2">
8212
+ <xsl:copy>
8213
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step2"/>
8214
+ </xsl:copy>
8215
+ </xsl:template>
8216
+
8217
+ <xsl:variable name="localized_string_withdrawn">
8218
+ <xsl:call-template name="getLocalizedString">
8219
+ <xsl:with-param name="key">withdrawn</xsl:with-param>
8220
+ </xsl:call-template>
8221
+ </xsl:variable>
8222
+ <xsl:variable name="localized_string_cancelled_and_replaced">
8223
+ <xsl:variable name="str">
8224
+ <xsl:call-template name="getLocalizedString">
8225
+ <xsl:with-param name="key">cancelled_and_replaced</xsl:with-param>
8226
+ </xsl:call-template>
8227
+ </xsl:variable>
8228
+ <xsl:choose>
8229
+ <xsl:when test="contains($str, '%')"><xsl:value-of select="substring-before($str, '%')"/></xsl:when>
8230
+ <xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
8231
+ </xsl:choose>
8232
+ </xsl:variable>
8233
+
8234
+ <!-- add 'fn' after eref and origin, to reference bibitem with note = 'Withdrawn.' or 'Cancelled and replaced...' -->
8235
+ <xsl:template match="*[local-name() = 'eref'] | *[local-name() = 'origin']" mode="update_xml_step2">
8236
+ <xsl:copy-of select="."/>
8237
+
8238
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
8239
+ <xsl:variable name="local_name" select="local-name()"/>
8240
+ <xsl:variable name="position"><xsl:number count="*[local-name() = $local_name][@bibitemid = $bibitemid]" level="any"/></xsl:variable>
8241
+ <xsl:if test="normalize-space($position) = '1'">
8242
+ <xsl:variable name="fn_text">
8243
+ <xsl:copy-of select="key('bibitems', $bibitemid)[1]/*[local-name() = 'note'][not(@type='Unpublished-Status')][normalize-space() = $localized_string_withdrawn or starts-with(normalize-space(), $localized_string_cancelled_and_replaced)]/node()"/>
8244
+ </xsl:variable>
8245
+ <xsl:if test="normalize-space($fn_text) != ''">
8246
+ <xsl:element name="fn" namespace="{$namespace_full}">
8247
+ <xsl:attribute name="reference">bibitem_<xsl:value-of select="$bibitemid"/></xsl:attribute>
8248
+ <xsl:element name="p" namespace="{$namespace_full}">
8249
+ <xsl:copy-of select="$fn_text"/>
8250
+ </xsl:element>
8251
+ </xsl:element>
8252
+ </xsl:if>
8253
+ </xsl:if>
8254
+ </xsl:template>
8255
+
8256
+ <!-- add @reference for bibitem/note, similar to fn/reference -->
8257
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="update_xml_step2">
8258
+ <xsl:copy>
8259
+ <xsl:apply-templates select="@*" mode="update_xml_step2"/>
8260
+
8261
+ <xsl:attribute name="reference">
8262
+ <xsl:value-of select="concat('bibitem_', ../@id, '_', count(preceding-sibling::*[local-name() = 'note']))"/>
8263
+ </xsl:attribute>
8264
+
8265
+ <xsl:apply-templates select="node()" mode="update_xml_step2"/>
8266
+ </xsl:copy>
8267
+ </xsl:template>
8268
+
8269
+ <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
8270
+ <xsl:template name="convertDate">
7956
8271
  <xsl:param name="date"/>
7957
8272
  <xsl:param name="format" select="'short'"/>
7958
8273
  <xsl:variable name="year" select="substring($date, 1, 4)"/>