metanorma-iso 2.0.4 → 2.0.6.1

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/header.html +42 -33
  3. data/lib/isodoc/iso/html/isodoc.css +9 -7
  4. data/lib/isodoc/iso/html/isodoc.scss +7 -5
  5. data/lib/isodoc/iso/html/style-human.css +0 -1
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +0 -1
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/word_iso_titlepage.html +12 -11
  10. data/lib/isodoc/iso/html/wordstyle.css +46 -19
  11. data/lib/isodoc/iso/html/wordstyle.scss +52 -25
  12. data/lib/isodoc/iso/i18n-en.yaml +7 -2
  13. data/lib/isodoc/iso/i18n-fr.yaml +5 -2
  14. data/lib/isodoc/iso/i18n-ru.yaml +5 -2
  15. data/lib/isodoc/iso/i18n-zh-Hans.yaml +6 -2
  16. data/lib/isodoc/iso/init.rb +1 -2
  17. data/lib/isodoc/iso/iso.amendment.xsl +704 -328
  18. data/lib/isodoc/iso/iso.international-standard.xsl +704 -328
  19. data/lib/isodoc/iso/presentation_xml_convert.rb +58 -21
  20. data/lib/metanorma/iso/boilerplate-fr.xml +5 -6
  21. data/lib/metanorma/iso/boilerplate-ru.xml +4 -6
  22. data/lib/metanorma/iso/boilerplate.xml +5 -6
  23. data/lib/metanorma/iso/cleanup.rb +43 -10
  24. data/lib/metanorma/iso/front_id.rb +1 -0
  25. data/lib/metanorma/iso/processor.rb +14 -7
  26. data/lib/metanorma/iso/validate.rb +29 -1
  27. data/lib/metanorma/iso/validate_image.rb +3 -3
  28. data/lib/metanorma/iso/validate_list.rb +122 -0
  29. data/lib/metanorma/iso/validate_section.rb +39 -32
  30. data/lib/metanorma/iso/validate_style.rb +32 -2
  31. data/lib/metanorma/iso/validate_title.rb +13 -1
  32. data/lib/metanorma/iso/version.rb +1 -1
  33. data/metanorma-iso.gemspec +1 -1
  34. data/spec/isodoc/inline_spec.rb +127 -10
  35. data/spec/isodoc/postproc_spec.rb +2 -4
  36. data/spec/isodoc/terms_spec.rb +4 -4
  37. data/spec/metanorma/cleanup_spec.rb +11 -11
  38. data/spec/metanorma/refs_spec.rb +273 -61
  39. data/spec/metanorma/section_spec.rb +18 -26
  40. data/spec/metanorma/validate_spec.rb +448 -17
  41. data/spec/spec_helper.rb +6 -4
  42. data/spec/vcr_cassettes/docrels.yml +393 -0
  43. data/spec/vcr_cassettes/withdrawn_iso.yml +301 -0
  44. metadata +8 -5
@@ -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
  <!-- ==================== -->
@@ -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="''"/>
@@ -6409,7 +6577,51 @@
6409
6577
  <xsl:with-param name="text" select="$text_step1"/>
6410
6578
  </xsl:call-template>
6411
6579
  </xsl:variable>
6412
- <xsl:value-of select="$text_step2"/>
6580
+
6581
+ <!-- <xsl:value-of select="$text_step2"/> -->
6582
+
6583
+ <!-- add zero-width space after space -->
6584
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6585
+
6586
+ <!-- split text by zero-width space -->
6587
+ <xsl:variable name="text_step4">
6588
+ <xsl:call-template name="split">
6589
+ <xsl:with-param name="pText" select="$text_step3"/>
6590
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6591
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
6592
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
6593
+ </xsl:call-template>
6594
+ </xsl:variable>
6595
+
6596
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
6597
+ <xsl:choose>
6598
+ <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6599
+ <xsl:call-template name="interspers">
6600
+ <xsl:with-param name="str" select="."/>
6601
+ </xsl:call-template>
6602
+ </xsl:when>
6603
+ <xsl:otherwise>
6604
+ <xsl:value-of select="."/>
6605
+ </xsl:otherwise>
6606
+ </xsl:choose>
6607
+ </xsl:for-each>
6608
+
6609
+ </xsl:template><xsl:template name="interspers">
6610
+ <xsl:param name="str"/>
6611
+ <xsl:param name="char" select="$zero_width_space"/>
6612
+ <xsl:if test="$str != ''">
6613
+ <xsl:value-of select="substring($str, 1, 1)"/>
6614
+
6615
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6616
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6617
+ <xsl:value-of select="$char"/>
6618
+ </xsl:if>
6619
+
6620
+ <xsl:call-template name="interspers">
6621
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6622
+ <xsl:with-param name="char" select="$char"/>
6623
+ </xsl:call-template>
6624
+ </xsl:if>
6413
6625
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6414
6626
  <xsl:apply-templates mode="syntax_highlight"/>
6415
6627
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -6790,7 +7002,7 @@
6790
7002
  <xsl:variable name="element">
6791
7003
 
6792
7004
  <xsl:choose>
6793
- <xsl:when test="$num = 1">inline</xsl:when>
7005
+ <xsl:when test="$num = 1 and not(contains($fo_element, 'block'))">inline</xsl:when>
6794
7006
  <xsl:otherwise>block</xsl:otherwise>
6795
7007
  </xsl:choose>
6796
7008
 
@@ -6846,6 +7058,8 @@
6846
7058
  </xsl:otherwise>
6847
7059
  </xsl:choose> -->
6848
7060
  </fo:block>
7061
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7062
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6849
7063
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6850
7064
  <xsl:if test="normalize-space() != ''">
6851
7065
  <xsl:value-of select="."/>
@@ -6920,26 +7134,24 @@
6920
7134
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6921
7135
  <xsl:text>— </xsl:text>
6922
7136
  <xsl:apply-templates/>
6923
- </xsl:template><xsl:variable name="bibitem_hidden_">
7137
+ </xsl:template><xsl:variable name="bibitems_">
7138
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
7139
+ <xsl:copy-of select="."/>
7140
+ </xsl:for-each>
7141
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
6924
7142
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6925
7143
  <xsl:copy-of select="."/>
6926
7144
  </xsl:for-each>
6927
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
7145
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
6928
7146
  <xsl:copy-of select="."/>
6929
7147
  </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
-
7148
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
7149
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7150
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7151
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
6941
7152
  <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 -->
7153
+ <!-- <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) -->
7154
+ <xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $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
7155
  <fo:inline xsl:use-attribute-sets="eref-style">
6944
7156
  <xsl:if test="@type = 'footnote'">
6945
7157
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -6953,8 +7165,8 @@
6953
7165
  <xsl:variable name="text" select="normalize-space()"/>
6954
7166
 
6955
7167
 
6956
-
6957
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7168
+
7169
+ <fo:basic-link fox:alt-text="{@citeas}">
6958
7170
  <xsl:if test="normalize-space(@citeas) = ''">
6959
7171
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6960
7172
  </xsl:if>
@@ -6964,14 +7176,21 @@
6964
7176
 
6965
7177
  </xsl:if>
6966
7178
 
6967
-
7179
+ <xsl:choose>
7180
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
7181
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
7182
+ </xsl:when>
7183
+ <xsl:otherwise>
7184
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7185
+ </xsl:otherwise>
7186
+ </xsl:choose>
6968
7187
 
6969
7188
  <xsl:apply-templates/>
6970
7189
  </fo:basic-link>
6971
-
7190
+
6972
7191
  </fo:inline>
6973
7192
  </xsl:when>
6974
- <xsl:otherwise>
7193
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
6975
7194
  <fo:inline><xsl:apply-templates/></fo:inline>
6976
7195
  </xsl:otherwise>
6977
7196
  </xsl:choose>
@@ -7697,27 +7916,47 @@
7697
7916
  <xsl:apply-templates/>
7698
7917
  </fo:inline>
7699
7918
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7919
+
7920
+ <!-- list of footnotes to calculate actual footnotes number -->
7921
+ <xsl:variable name="p_fn_">
7922
+ <xsl:call-template name="get_fn_list"/>
7923
+ </xsl:variable>
7924
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7925
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7926
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7927
+ <!-- fn sequence number in document -->
7928
+ <xsl:variable name="current_fn_number">
7929
+ <xsl:choose>
7930
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7931
+ <xsl:otherwise>
7932
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7933
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7934
+ </xsl:otherwise>
7935
+ </xsl:choose>
7936
+ </xsl:variable>
7700
7937
  <fo:footnote>
7701
7938
  <xsl:variable name="number">
7702
7939
 
7703
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7940
+ <xsl:value-of select="$current_fn_number"/>
7704
7941
 
7705
7942
  </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
-
7943
+
7944
+ <xsl:variable name="current_fn_number_text">
7945
+ <xsl:value-of select="$number"/>
7946
+
7710
7947
  <xsl:text>)</xsl:text>
7711
7948
 
7949
+ </xsl:variable>
7950
+
7951
+ <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7952
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7953
+ <xsl:value-of select="$current_fn_number_text"/>
7712
7954
  </fo:basic-link>
7713
7955
  </fo:inline>
7714
7956
  <fo:footnote-body>
7715
7957
  <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
-
7958
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7959
+ <xsl:value-of select="$current_fn_number_text"/>
7721
7960
  </fo:inline>
7722
7961
  <xsl:apply-templates/>
7723
7962
  </fo:block>
@@ -7952,7 +8191,141 @@
7952
8191
  <!-- processing for admonition/p found in the template for 'p' -->
7953
8192
  <xsl:call-template name="paragraph"/>
7954
8193
 
7955
- </xsl:template><xsl:template name="convertDate">
8194
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
8195
+ <xsl:copy>
8196
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
8197
+ </xsl:copy>
8198
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
8199
+ <xsl:copy>
8200
+ <xsl:copy-of select="@*"/>
8201
+
8202
+ <xsl:variable name="nodes_preface_">
8203
+ <xsl:for-each select="*">
8204
+ <node id="{@id}"/>
8205
+ </xsl:for-each>
8206
+ </xsl:variable>
8207
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
8208
+
8209
+ <xsl:for-each select="*">
8210
+ <xsl:sort select="@displayorder" data-type="number"/>
8211
+
8212
+ <!-- process Section's title -->
8213
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8214
+ <xsl:if test="$preceding-sibling_id != ''">
8215
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8216
+ </xsl:if>
8217
+
8218
+ <xsl:choose>
8219
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8220
+ <xsl:otherwise>
8221
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8222
+ </xsl:otherwise>
8223
+ </xsl:choose>
8224
+
8225
+ </xsl:for-each>
8226
+ </xsl:copy>
8227
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
8228
+ <xsl:copy>
8229
+ <xsl:copy-of select="@*"/>
8230
+
8231
+ <xsl:variable name="nodes_sections_">
8232
+ <xsl:for-each select="*">
8233
+ <node id="{@id}"/>
8234
+ </xsl:for-each>
8235
+ </xsl:variable>
8236
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
8237
+
8238
+ <!-- move section 'Normative references' inside 'sections' -->
8239
+ <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']]">
8240
+ <xsl:sort select="@displayorder" data-type="number"/>
8241
+
8242
+ <!-- process Section's title -->
8243
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8244
+ <xsl:if test="$preceding-sibling_id != ''">
8245
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8246
+ </xsl:if>
8247
+
8248
+ <xsl:choose>
8249
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8250
+ <xsl:otherwise>
8251
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8252
+ </xsl:otherwise>
8253
+ </xsl:choose>
8254
+
8255
+ </xsl:for-each>
8256
+ </xsl:copy>
8257
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
8258
+ <xsl:copy>
8259
+ <xsl:copy-of select="@*"/>
8260
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8261
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
8262
+ <xsl:sort select="@displayorder" data-type="number"/>
8263
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8264
+ </xsl:for-each>
8265
+ </xsl:copy>
8266
+ </xsl:template>
8267
+ <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
8268
+ <xsl:template match="@*|node()" mode="update_xml_step2">
8269
+ <xsl:copy>
8270
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step2"/>
8271
+ </xsl:copy>
8272
+ </xsl:template>
8273
+
8274
+ <xsl:variable name="localized_string_withdrawn">
8275
+ <xsl:call-template name="getLocalizedString">
8276
+ <xsl:with-param name="key">withdrawn</xsl:with-param>
8277
+ </xsl:call-template>
8278
+ </xsl:variable>
8279
+ <xsl:variable name="localized_string_cancelled_and_replaced">
8280
+ <xsl:variable name="str">
8281
+ <xsl:call-template name="getLocalizedString">
8282
+ <xsl:with-param name="key">cancelled_and_replaced</xsl:with-param>
8283
+ </xsl:call-template>
8284
+ </xsl:variable>
8285
+ <xsl:choose>
8286
+ <xsl:when test="contains($str, '%')"><xsl:value-of select="substring-before($str, '%')"/></xsl:when>
8287
+ <xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
8288
+ </xsl:choose>
8289
+ </xsl:variable>
8290
+
8291
+ <!-- add 'fn' after eref and origin, to reference bibitem with note = 'Withdrawn.' or 'Cancelled and replaced...' -->
8292
+ <xsl:template match="*[local-name() = 'eref'] | *[local-name() = 'origin']" mode="update_xml_step2">
8293
+ <xsl:copy-of select="."/>
8294
+
8295
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
8296
+ <xsl:variable name="local_name" select="local-name()"/>
8297
+ <xsl:variable name="position"><xsl:number count="*[local-name() = $local_name][@bibitemid = $bibitemid]" level="any"/></xsl:variable>
8298
+ <xsl:if test="normalize-space($position) = '1'">
8299
+ <xsl:variable name="fn_text">
8300
+ <!-- <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()" /> -->
8301
+ <xsl:copy-of select="$bibitems/*[local-name() ='bibitem'][@id = $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()"/>
8302
+ </xsl:variable>
8303
+ <xsl:if test="normalize-space($fn_text) != ''">
8304
+ <xsl:element name="fn" namespace="{$namespace_full}">
8305
+ <xsl:attribute name="reference">bibitem_<xsl:value-of select="$bibitemid"/></xsl:attribute>
8306
+ <xsl:element name="p" namespace="{$namespace_full}">
8307
+ <xsl:copy-of select="$fn_text"/>
8308
+ </xsl:element>
8309
+ </xsl:element>
8310
+ </xsl:if>
8311
+ </xsl:if>
8312
+ </xsl:template>
8313
+
8314
+ <!-- add @reference for bibitem/note, similar to fn/reference -->
8315
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="update_xml_step2">
8316
+ <xsl:copy>
8317
+ <xsl:apply-templates select="@*" mode="update_xml_step2"/>
8318
+
8319
+ <xsl:attribute name="reference">
8320
+ <xsl:value-of select="concat('bibitem_', ../@id, '_', count(preceding-sibling::*[local-name() = 'note']))"/>
8321
+ </xsl:attribute>
8322
+
8323
+ <xsl:apply-templates select="node()" mode="update_xml_step2"/>
8324
+ </xsl:copy>
8325
+ </xsl:template>
8326
+
8327
+ <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
8328
+ <xsl:template name="convertDate">
7956
8329
  <xsl:param name="date"/>
7957
8330
  <xsl:param name="format" select="'short'"/>
7958
8331
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -8196,22 +8569,25 @@
8196
8569
  <xsl:param name="pText" select="."/>
8197
8570
  <xsl:param name="sep" select="','"/>
8198
8571
  <xsl:param name="normalize-space" select="'true'"/>
8572
+ <xsl:param name="keep_sep" select="'false'"/>
8199
8573
  <xsl:if test="string-length($pText) &gt;0">
8200
- <item>
8201
- <xsl:choose>
8202
- <xsl:when test="$normalize-space = 'true'">
8203
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8204
- </xsl:when>
8205
- <xsl:otherwise>
8206
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8207
- </xsl:otherwise>
8208
- </xsl:choose>
8209
- </item>
8210
- <xsl:call-template name="split">
8211
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8212
- <xsl:with-param name="sep" select="$sep"/>
8213
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8214
- </xsl:call-template>
8574
+ <item>
8575
+ <xsl:choose>
8576
+ <xsl:when test="$normalize-space = 'true'">
8577
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8578
+ </xsl:when>
8579
+ <xsl:otherwise>
8580
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8581
+ </xsl:otherwise>
8582
+ </xsl:choose>
8583
+ </item>
8584
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8585
+ <xsl:call-template name="split">
8586
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8587
+ <xsl:with-param name="sep" select="$sep"/>
8588
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8589
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8590
+ </xsl:call-template>
8215
8591
  </xsl:if>
8216
8592
  </xsl:template><xsl:template name="getDocumentId">
8217
8593
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>