metanorma-ieee 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fcdee8a51301c3df48c602dd91eed680ec3225d7c29962d9e5be525e049a99f
4
- data.tar.gz: 41506b613379f537e090002267a82857eb23570bec07db98b36fcc66ebce8b0e
3
+ metadata.gz: ab36d0a51a7e7658f28802e6b30a87c4ca819cb0a50f88d8b17d4ff289d45234
4
+ data.tar.gz: 96779fe34b793774df397097420fbaea4046658b506f2550102bed5d8ce6d211
5
5
  SHA512:
6
- metadata.gz: d4d4bb35f51417c6a4797ac41dca9269a74771f599e30fc9610e0a2cedc1ec0310700897ad48d9f559d41a2e1580346f75ba414ebcd63bd705f3b7a2957e8a6b
7
- data.tar.gz: 55407e26370a1745bb9a0361b0bf2f43f6ca6a1e4b5ca76a36a9887c7e82bc418b895c6b116a051393e8951d6f5f5ff7c7dd4e5eb0307b4e187d886a2d2c1763
6
+ metadata.gz: 4f2110189a9dd35f8589ab4ac13b064c179492a9fa9cbd13e01b01dfa1018137dad9be4f81c96e11f2ef40c7c90cbcc3956a783a63cc3cfdc2341f9a096c16f4
7
+ data.tar.gz: 2c87f9b7f67cd7d8b38dde3e60b05fffd9298996287cc01a2830bfa1ea4ecdd5f44a9a663a62f3831eaaf4c9b012559ec86bb43ea9b575cf8e8ecb7e626f100d
@@ -5024,6 +5024,9 @@
5024
5024
 
5025
5025
  </xsl:attribute-set>
5026
5026
 
5027
+ <xsl:attribute-set name="related-block-style" use-attribute-sets="preferred-block-style">
5028
+ </xsl:attribute-set>
5029
+
5027
5030
  <xsl:attribute-set name="definition-style">
5028
5031
 
5029
5032
  </xsl:attribute-set>
@@ -7300,7 +7303,9 @@
7300
7303
  <xsl:with-param name="element">
7301
7304
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
7302
7305
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
7306
+
7303
7307
  <xsl:copy-of select="$current_fn_number_text"/>
7308
+
7304
7309
  </fo:inline>
7305
7310
  </fo:basic-link>
7306
7311
  </xsl:with-param>
@@ -7319,8 +7324,7 @@
7319
7324
 
7320
7325
  <fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">
7321
7326
 
7322
- <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
7323
-
7327
+ <xsl:variable name="fn_block">
7324
7328
  <xsl:call-template name="refine_fn-body-style"/>
7325
7329
 
7326
7330
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">
@@ -7328,9 +7332,15 @@
7328
7332
  <xsl:call-template name="refine_fn-body-num-style"/>
7329
7333
 
7330
7334
  <xsl:value-of select="$current_fn_number_text"/>
7335
+
7331
7336
  </fo:inline>
7332
7337
  <xsl:apply-templates/>
7333
- </fo:block>
7338
+ </xsl:variable>
7339
+
7340
+ <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
7341
+ <xsl:copy-of select="$fn_block"/>
7342
+ </fo:block>
7343
+
7334
7344
  </fo:block-container>
7335
7345
  </fo:footnote-body>
7336
7346
  </fo:footnote>
@@ -13360,14 +13370,17 @@
13360
13370
  </fo:block>
13361
13371
  </xsl:template>
13362
13372
 
13363
- <xsl:template match="*[local-name() = 'domain']">
13373
+ <!-- <xsl:template match="*[local-name() = 'domain']"> -->
13364
13374
  <!-- https://github.com/metanorma/isodoc/issues/607
13365
13375
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
13366
13376
  <xsl:text> </xsl:text> -->
13367
- <xsl:if test="not(@hidden = 'true')">
13377
+ <!-- <xsl:if test="not(@hidden = 'true')">
13368
13378
  <xsl:apply-templates/>
13369
13379
  </xsl:if>
13370
- </xsl:template>
13380
+ </xsl:template> -->
13381
+
13382
+ <!-- https://github.com/metanorma/isodoc/issues/632#issuecomment-2567163931 -->
13383
+ <xsl:template match="*[local-name() = 'domain']"/>
13371
13384
 
13372
13385
  <xsl:template match="*[local-name() = 'admitted']">
13373
13386
  <fo:block xsl:use-attribute-sets="admitted-style">
@@ -13382,9 +13395,11 @@
13382
13395
  </xsl:template>
13383
13396
 
13384
13397
  <xsl:template name="setStyle_preferred">
13385
- <xsl:if test="*[local-name() = 'strong']">
13386
- <xsl:attribute name="font-weight">normal</xsl:attribute>
13387
- </xsl:if>
13398
+
13399
+ <xsl:if test="*[local-name() = 'strong']">
13400
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
13401
+ </xsl:if>
13402
+
13388
13403
  </xsl:template>
13389
13404
 
13390
13405
  <!-- regarding ISO 10241-1:2011, If there is more than one preferred term, each preferred term follows the previous one on a new line. -->
@@ -13394,6 +13409,17 @@
13394
13409
  </xsl:template>
13395
13410
  <!-- End Preferred, admitted, deprecated -->
13396
13411
 
13412
+ <xsl:template match="*[local-name() = 'fmt-related']">
13413
+ <fo:block role="SKIP" xsl:use-attribute-sets="related-block-style">
13414
+ <xsl:apply-templates/>
13415
+ </fo:block>
13416
+ </xsl:template>
13417
+ <xsl:template match="*[local-name() = 'fmt-related']/*[local-name() = 'p']" priority="4">
13418
+ <fo:block>
13419
+ <xsl:apply-templates/>
13420
+ </fo:block>
13421
+ </xsl:template>
13422
+
13397
13423
  <!-- ========== -->
13398
13424
  <!-- definition -->
13399
13425
  <!-- ========== -->
@@ -14302,6 +14328,7 @@
14302
14328
 
14303
14329
  <!-- Normative references -->
14304
14330
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
14331
+ <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
14305
14332
 
14306
14333
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
14307
14334
 
@@ -15070,7 +15097,8 @@
15070
15097
  <!-- add @id - first element with @id plus '_element_name' -->
15071
15098
  <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
15072
15099
  <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
15073
- <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
15100
+ <xsl:variable name="document_suffix" select="ancestor::*[contains(local-name(), '-standard')]/@document_suffix"/>
15101
+ <xsl:attribute name="id"><xsl:value-of select="concat($prefix_id, '_', local-name(), '_', $document_suffix)"/></xsl:attribute>
15074
15102
  </xsl:if>
15075
15103
  </xsl:template>
15076
15104
 
@@ -15127,6 +15155,31 @@
15127
15155
  <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
15128
15156
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
15129
15157
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
15158
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_step1"/> -->
15159
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_step1"/>
15160
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_pres"/> -->
15161
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_pres"/>
15162
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_step1"/> -->
15163
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_step1"/>
15164
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_pres"/> -->
15165
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_pres"/>
15166
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_step1"/> -->
15167
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_step1"/>
15168
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_step1"/>
15169
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_pres"/> -->
15170
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_pres"/>
15171
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_pres"/>
15172
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_step1"/> -->
15173
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_step1"/>
15174
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_pres"/> -->
15175
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_pres"/>
15176
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_step1"/> -->
15177
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_step1"/>
15178
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_pres"/> -->
15179
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_pres"/>
15180
+
15181
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_step1"/>
15182
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_pres"/>
15130
15183
 
15131
15184
  <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
15132
15185
  <xsl:copy>
@@ -15171,6 +15224,94 @@
15171
15224
  </xsl:element>
15172
15225
  </xsl:template>
15173
15226
 
15227
+ <xsl:template match="*[local-name() = 'fmt-preferred']"/>
15228
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
15229
+ <xsl:apply-templates mode="update_xml_step1"/>
15230
+ </xsl:template>
15231
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_step1">
15232
+ <xsl:element name="preferred" namespace="{$namespace_full}">
15233
+ <xsl:copy-of select="@*"/>
15234
+ <xsl:apply-templates mode="update_xml_step1"/>
15235
+ </xsl:element>
15236
+ </xsl:template>
15237
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_pres">
15238
+ <xsl:apply-templates mode="update_xml_pres"/>
15239
+ </xsl:template>
15240
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_pres">
15241
+ <xsl:element name="preferred" namespace="{$namespace_full}">
15242
+ <xsl:copy-of select="@*"/>
15243
+ <xsl:apply-templates mode="update_xml_pres"/>
15244
+ </xsl:element>
15245
+ </xsl:template>
15246
+
15247
+ <xsl:template match="*[local-name() = 'fmt-admitted']"/>
15248
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_step1">
15249
+ <xsl:apply-templates mode="update_xml_step1"/>
15250
+ </xsl:template>
15251
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_step1">
15252
+ <xsl:element name="admitted" namespace="{$namespace_full}">
15253
+ <xsl:copy-of select="@*"/>
15254
+ <xsl:apply-templates mode="update_xml_step1"/>
15255
+ </xsl:element>
15256
+ </xsl:template>
15257
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_pres">
15258
+ <xsl:apply-templates mode="update_xml_pres"/>
15259
+ </xsl:template>
15260
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_pres">
15261
+ <xsl:element name="admitted" namespace="{$namespace_full}">
15262
+ <xsl:copy-of select="@*"/>
15263
+ <xsl:apply-templates mode="update_xml_pres"/>
15264
+ </xsl:element>
15265
+ </xsl:template>
15266
+
15267
+ <xsl:template match="*[local-name() = 'fmt-deprecates']"/>
15268
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_step1">
15269
+ <xsl:apply-templates mode="update_xml_step1"/>
15270
+ </xsl:template>
15271
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_step1">
15272
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
15273
+ <xsl:copy-of select="@*"/>
15274
+ <xsl:apply-templates mode="update_xml_step1"/>
15275
+ </xsl:element>
15276
+ </xsl:template>
15277
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_pres">
15278
+ <xsl:apply-templates mode="update_xml_pres"/>
15279
+ </xsl:template>
15280
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_pres">
15281
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
15282
+ <xsl:copy-of select="@*"/>
15283
+ <xsl:apply-templates mode="update_xml_pres"/>
15284
+ </xsl:element>
15285
+ </xsl:template>
15286
+
15287
+ <xsl:template match="*[local-name() = 'fmt-definition']"/>
15288
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_step1">
15289
+ <xsl:element name="definition" namespace="{$namespace_full}">
15290
+ <xsl:copy-of select="@*"/>
15291
+ <xsl:apply-templates mode="update_xml_step1"/>
15292
+ </xsl:element>
15293
+ </xsl:template>
15294
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_pres">
15295
+ <xsl:element name="definition" namespace="{$namespace_full}">
15296
+ <xsl:copy-of select="@*"/>
15297
+ <xsl:apply-templates mode="update_xml_pres"/>
15298
+ </xsl:element>
15299
+ </xsl:template>
15300
+
15301
+ <xsl:template match="*[local-name() = 'fmt-termsource']"/>
15302
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_step1">
15303
+ <xsl:element name="termsource" namespace="{$namespace_full}">
15304
+ <xsl:copy-of select="@*"/>
15305
+ <xsl:apply-templates mode="update_xml_step1"/>
15306
+ </xsl:element>
15307
+ </xsl:template>
15308
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_pres">
15309
+ <xsl:element name="termsource" namespace="{$namespace_full}">
15310
+ <xsl:copy-of select="@*"/>
15311
+ <xsl:apply-templates mode="update_xml_pres"/>
15312
+ </xsl:element>
15313
+ </xsl:template>
15314
+
15174
15315
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
15175
15316
  <xsl:apply-templates mode="update_xml_step1"/>
15176
15317
  </xsl:template>
@@ -16404,7 +16545,7 @@
16404
16545
  </xsl:template>
16405
16546
 
16406
16547
  <xsl:template name="namespaceCheck">
16407
- <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
16548
+ <xsl:variable name="documentNS" select="$namespace_full"/> <!-- namespace-uri(/*) -->
16408
16549
  <xsl:variable name="XSLNS">
16409
16550
 
16410
16551
  <xsl:value-of select="document('')//*/namespace::ieee"/>
@@ -16494,6 +16635,9 @@
16494
16635
  <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
16495
16636
  <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16496
16637
  </xsl:when>
16638
+ <xsl:when test="string-length($bibdata_updated) != ''">
16639
+ <xsl:value-of select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16640
+ </xsl:when>
16497
16641
  <xsl:when test="$formatted = 'true'">
16498
16642
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16499
16643
  </xsl:when>
@@ -5024,6 +5024,9 @@
5024
5024
 
5025
5025
  </xsl:attribute-set>
5026
5026
 
5027
+ <xsl:attribute-set name="related-block-style" use-attribute-sets="preferred-block-style">
5028
+ </xsl:attribute-set>
5029
+
5027
5030
  <xsl:attribute-set name="definition-style">
5028
5031
 
5029
5032
  </xsl:attribute-set>
@@ -7300,7 +7303,9 @@
7300
7303
  <xsl:with-param name="element">
7301
7304
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
7302
7305
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
7306
+
7303
7307
  <xsl:copy-of select="$current_fn_number_text"/>
7308
+
7304
7309
  </fo:inline>
7305
7310
  </fo:basic-link>
7306
7311
  </xsl:with-param>
@@ -7319,8 +7324,7 @@
7319
7324
 
7320
7325
  <fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">
7321
7326
 
7322
- <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
7323
-
7327
+ <xsl:variable name="fn_block">
7324
7328
  <xsl:call-template name="refine_fn-body-style"/>
7325
7329
 
7326
7330
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">
@@ -7328,9 +7332,15 @@
7328
7332
  <xsl:call-template name="refine_fn-body-num-style"/>
7329
7333
 
7330
7334
  <xsl:value-of select="$current_fn_number_text"/>
7335
+
7331
7336
  </fo:inline>
7332
7337
  <xsl:apply-templates/>
7333
- </fo:block>
7338
+ </xsl:variable>
7339
+
7340
+ <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
7341
+ <xsl:copy-of select="$fn_block"/>
7342
+ </fo:block>
7343
+
7334
7344
  </fo:block-container>
7335
7345
  </fo:footnote-body>
7336
7346
  </fo:footnote>
@@ -13360,14 +13370,17 @@
13360
13370
  </fo:block>
13361
13371
  </xsl:template>
13362
13372
 
13363
- <xsl:template match="*[local-name() = 'domain']">
13373
+ <!-- <xsl:template match="*[local-name() = 'domain']"> -->
13364
13374
  <!-- https://github.com/metanorma/isodoc/issues/607
13365
13375
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
13366
13376
  <xsl:text> </xsl:text> -->
13367
- <xsl:if test="not(@hidden = 'true')">
13377
+ <!-- <xsl:if test="not(@hidden = 'true')">
13368
13378
  <xsl:apply-templates/>
13369
13379
  </xsl:if>
13370
- </xsl:template>
13380
+ </xsl:template> -->
13381
+
13382
+ <!-- https://github.com/metanorma/isodoc/issues/632#issuecomment-2567163931 -->
13383
+ <xsl:template match="*[local-name() = 'domain']"/>
13371
13384
 
13372
13385
  <xsl:template match="*[local-name() = 'admitted']">
13373
13386
  <fo:block xsl:use-attribute-sets="admitted-style">
@@ -13382,9 +13395,11 @@
13382
13395
  </xsl:template>
13383
13396
 
13384
13397
  <xsl:template name="setStyle_preferred">
13385
- <xsl:if test="*[local-name() = 'strong']">
13386
- <xsl:attribute name="font-weight">normal</xsl:attribute>
13387
- </xsl:if>
13398
+
13399
+ <xsl:if test="*[local-name() = 'strong']">
13400
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
13401
+ </xsl:if>
13402
+
13388
13403
  </xsl:template>
13389
13404
 
13390
13405
  <!-- regarding ISO 10241-1:2011, If there is more than one preferred term, each preferred term follows the previous one on a new line. -->
@@ -13394,6 +13409,17 @@
13394
13409
  </xsl:template>
13395
13410
  <!-- End Preferred, admitted, deprecated -->
13396
13411
 
13412
+ <xsl:template match="*[local-name() = 'fmt-related']">
13413
+ <fo:block role="SKIP" xsl:use-attribute-sets="related-block-style">
13414
+ <xsl:apply-templates/>
13415
+ </fo:block>
13416
+ </xsl:template>
13417
+ <xsl:template match="*[local-name() = 'fmt-related']/*[local-name() = 'p']" priority="4">
13418
+ <fo:block>
13419
+ <xsl:apply-templates/>
13420
+ </fo:block>
13421
+ </xsl:template>
13422
+
13397
13423
  <!-- ========== -->
13398
13424
  <!-- definition -->
13399
13425
  <!-- ========== -->
@@ -14302,6 +14328,7 @@
14302
14328
 
14303
14329
  <!-- Normative references -->
14304
14330
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
14331
+ <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
14305
14332
 
14306
14333
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
14307
14334
 
@@ -15070,7 +15097,8 @@
15070
15097
  <!-- add @id - first element with @id plus '_element_name' -->
15071
15098
  <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
15072
15099
  <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
15073
- <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
15100
+ <xsl:variable name="document_suffix" select="ancestor::*[contains(local-name(), '-standard')]/@document_suffix"/>
15101
+ <xsl:attribute name="id"><xsl:value-of select="concat($prefix_id, '_', local-name(), '_', $document_suffix)"/></xsl:attribute>
15074
15102
  </xsl:if>
15075
15103
  </xsl:template>
15076
15104
 
@@ -15127,6 +15155,31 @@
15127
15155
  <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
15128
15156
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
15129
15157
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
15158
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_step1"/> -->
15159
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_step1"/>
15160
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_pres"/> -->
15161
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_pres"/>
15162
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_step1"/> -->
15163
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_step1"/>
15164
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_pres"/> -->
15165
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_pres"/>
15166
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_step1"/> -->
15167
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_step1"/>
15168
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_step1"/>
15169
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_pres"/> -->
15170
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_pres"/>
15171
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_pres"/>
15172
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_step1"/> -->
15173
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_step1"/>
15174
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_pres"/> -->
15175
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_pres"/>
15176
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_step1"/> -->
15177
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_step1"/>
15178
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_pres"/> -->
15179
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_pres"/>
15180
+
15181
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_step1"/>
15182
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_pres"/>
15130
15183
 
15131
15184
  <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
15132
15185
  <xsl:copy>
@@ -15171,6 +15224,94 @@
15171
15224
  </xsl:element>
15172
15225
  </xsl:template>
15173
15226
 
15227
+ <xsl:template match="*[local-name() = 'fmt-preferred']"/>
15228
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
15229
+ <xsl:apply-templates mode="update_xml_step1"/>
15230
+ </xsl:template>
15231
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_step1">
15232
+ <xsl:element name="preferred" namespace="{$namespace_full}">
15233
+ <xsl:copy-of select="@*"/>
15234
+ <xsl:apply-templates mode="update_xml_step1"/>
15235
+ </xsl:element>
15236
+ </xsl:template>
15237
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_pres">
15238
+ <xsl:apply-templates mode="update_xml_pres"/>
15239
+ </xsl:template>
15240
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_pres">
15241
+ <xsl:element name="preferred" namespace="{$namespace_full}">
15242
+ <xsl:copy-of select="@*"/>
15243
+ <xsl:apply-templates mode="update_xml_pres"/>
15244
+ </xsl:element>
15245
+ </xsl:template>
15246
+
15247
+ <xsl:template match="*[local-name() = 'fmt-admitted']"/>
15248
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_step1">
15249
+ <xsl:apply-templates mode="update_xml_step1"/>
15250
+ </xsl:template>
15251
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_step1">
15252
+ <xsl:element name="admitted" namespace="{$namespace_full}">
15253
+ <xsl:copy-of select="@*"/>
15254
+ <xsl:apply-templates mode="update_xml_step1"/>
15255
+ </xsl:element>
15256
+ </xsl:template>
15257
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_pres">
15258
+ <xsl:apply-templates mode="update_xml_pres"/>
15259
+ </xsl:template>
15260
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_pres">
15261
+ <xsl:element name="admitted" namespace="{$namespace_full}">
15262
+ <xsl:copy-of select="@*"/>
15263
+ <xsl:apply-templates mode="update_xml_pres"/>
15264
+ </xsl:element>
15265
+ </xsl:template>
15266
+
15267
+ <xsl:template match="*[local-name() = 'fmt-deprecates']"/>
15268
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_step1">
15269
+ <xsl:apply-templates mode="update_xml_step1"/>
15270
+ </xsl:template>
15271
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_step1">
15272
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
15273
+ <xsl:copy-of select="@*"/>
15274
+ <xsl:apply-templates mode="update_xml_step1"/>
15275
+ </xsl:element>
15276
+ </xsl:template>
15277
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_pres">
15278
+ <xsl:apply-templates mode="update_xml_pres"/>
15279
+ </xsl:template>
15280
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_pres">
15281
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
15282
+ <xsl:copy-of select="@*"/>
15283
+ <xsl:apply-templates mode="update_xml_pres"/>
15284
+ </xsl:element>
15285
+ </xsl:template>
15286
+
15287
+ <xsl:template match="*[local-name() = 'fmt-definition']"/>
15288
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_step1">
15289
+ <xsl:element name="definition" namespace="{$namespace_full}">
15290
+ <xsl:copy-of select="@*"/>
15291
+ <xsl:apply-templates mode="update_xml_step1"/>
15292
+ </xsl:element>
15293
+ </xsl:template>
15294
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_pres">
15295
+ <xsl:element name="definition" namespace="{$namespace_full}">
15296
+ <xsl:copy-of select="@*"/>
15297
+ <xsl:apply-templates mode="update_xml_pres"/>
15298
+ </xsl:element>
15299
+ </xsl:template>
15300
+
15301
+ <xsl:template match="*[local-name() = 'fmt-termsource']"/>
15302
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_step1">
15303
+ <xsl:element name="termsource" namespace="{$namespace_full}">
15304
+ <xsl:copy-of select="@*"/>
15305
+ <xsl:apply-templates mode="update_xml_step1"/>
15306
+ </xsl:element>
15307
+ </xsl:template>
15308
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_pres">
15309
+ <xsl:element name="termsource" namespace="{$namespace_full}">
15310
+ <xsl:copy-of select="@*"/>
15311
+ <xsl:apply-templates mode="update_xml_pres"/>
15312
+ </xsl:element>
15313
+ </xsl:template>
15314
+
15174
15315
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
15175
15316
  <xsl:apply-templates mode="update_xml_step1"/>
15176
15317
  </xsl:template>
@@ -16404,7 +16545,7 @@
16404
16545
  </xsl:template>
16405
16546
 
16406
16547
  <xsl:template name="namespaceCheck">
16407
- <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
16548
+ <xsl:variable name="documentNS" select="$namespace_full"/> <!-- namespace-uri(/*) -->
16408
16549
  <xsl:variable name="XSLNS">
16409
16550
 
16410
16551
  <xsl:value-of select="document('')//*/namespace::ieee"/>
@@ -16494,6 +16635,9 @@
16494
16635
  <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
16495
16636
  <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16496
16637
  </xsl:when>
16638
+ <xsl:when test="string-length($bibdata_updated) != ''">
16639
+ <xsl:value-of select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16640
+ </xsl:when>
16497
16641
  <xsl:when test="$formatted = 'true'">
16498
16642
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16499
16643
  </xsl:when>
@@ -1,78 +1,172 @@
1
1
  module IsoDoc
2
2
  module Ieee
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
- def multidef(elem)
5
- # require "debug"; binding.b
6
- number_multidef(elem)
7
- collapse_multidef(elem)
4
+ def multidef(elem, defn, fmt_defn)
5
+ ctr = IsoDoc::XrefGen::Counter.new("@")
6
+ coll = defn.each_with_object([]) do |d, m|
7
+ ctr.increment(d)
8
+ ret = semx_fmt_dup(d)
9
+ ret.at(ns("./verbal-definition | ./non-verbal-definition")).elements
10
+ .first.add_first_child("<strong>(#{ctr.print})</strong>&#xa0;")
11
+ m << ret
12
+ end
13
+ #require "debug"; binding.b
14
+ fmt_defn << coll.map { |c| to_xml(c) }.join(" ")
15
+ #coll.each { |x| unwrap_definition1(x) }
16
+ #fmt_defn << unwrap_multidef(coll)
8
17
  end
9
18
 
10
- def number_multidef(elem)
11
- c = IsoDoc::XrefGen::Counter.new("@")
12
- elem.xpath(ns("./definition")).each do |d|
13
- c.increment(d)
14
- d.elements.first.add_first_child "<strong>(#{c.print})</strong>&#xa0;"
19
+ def unwrap_multidef(coll)
20
+ if coll.all? do |c|
21
+ c.elements.size == 1 && c.elements.first.name == "p"
22
+ end
23
+ ret = coll.map do |c|
24
+ c.children = c.elements.first.children
25
+ end
26
+ return "<p>#{ret.map { |x| to_xml(x) }.join}</p>"
15
27
  end
28
+ coll.map { |c| to_xml(c.children) }.join(" ")
16
29
  end
17
30
 
18
- def collapse_multidef(elem)
19
- ins = elem.at(ns("./definition")).previous_element
20
- coll = elem.xpath(ns("./definition"))
21
- coll.each(&:remove)
22
- ins.next = "<definition>#{unwrap_multidef(coll)}</definition>"
31
+ =begin
32
+ def unwrap_definition(elem)
33
+ elem.xpath(ns("./definition")).each do |d|
34
+ %w(verbal-definition non-verbal-representation).each do |e|
35
+ v = d&.at(ns("./#{e}"))
36
+ v&.replace(v.children)
37
+ end
23
38
  end
39
+ end
24
40
 
25
- def unwrap_multidef(coll)
26
- if coll.all? do |c|
27
- c.elements.size == 1 && c.elements.first.name == "p"
28
- end
29
- ret = coll.map { |c| to_xml(c.elements.first.children) }
30
- return "<p>#{ret.join}</p>"
41
+ to
42
+
43
+ def unwrap_definition(_elem, fmt_defn)
44
+ fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d|
45
+ %w(verbal-definition non-verbal-representation).each do |e|
46
+ v = d&.at(ns("./#{e}"))
47
+ v&.replace(v.children)
31
48
  end
32
- coll.map { |c| to_xml(c.children) }.join
33
49
  end
50
+ en
51
+
52
+ =end
53
+
54
+ def designation(docxml)
55
+ super
56
+ end
57
+
58
+ def deprecates(desgn)
59
+ desgn.remove
60
+ end
61
+
62
+ def designation_boldface(desgn)
63
+ #desgn["element"] == "preferred" or return
64
+ name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return
65
+ name.children = "<strong>#{name.children}</strong>"
66
+ end
34
67
 
35
68
  def unwrap_definition(docxml)
36
69
  docxml.xpath(ns(".//definition/verbal-definition")).each do |v|
37
70
  v.elements.all? { |e| %w(termsource p).include?(e.name) } or next
38
71
  p = v.xpath(ns("./p"))
39
72
  s = v.xpath(ns('./termsource'))
40
- s.empty? or
41
- s = " (#{s.map { |x| to_xml(x) }.join("\n")})"
73
+ s.empty? or s = " (#{s.map { |x| to_xml(x) }.join("\n")})"
42
74
  v.children =
43
75
  "<p>#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}#{s}</p>"
44
76
  end
45
77
  super
46
78
  end
47
79
 
80
+ def unwrap_definition(_elem, fmt_defn)
81
+ fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d|
82
+ unwrap_definition1(d)
83
+ end
84
+ end
85
+
86
+ def unwrap_definition1(d)
87
+ %w(verbal-definition non-verbal-representation).each do |e|
88
+ v = d.at(ns("./#{e}")) or next
89
+ if v.elements.all? { |e| %w(termsource p).include?(e.name) }
90
+ p = v.xpath(ns("./p"))
91
+ s = v.xpath(ns('./termsource'))
92
+ s.empty? or s = " (#{s.map { |x| to_xml(x) }.join()})"
93
+ v.children =
94
+ "#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}#{s}"
95
+ else
96
+ s = v.xpath(ns('./termsource'))
97
+ unless s.empty?
98
+ s[0].previous = " ("
99
+ s[-1].next = ")"
100
+ end
101
+ end
102
+ v.replace(v.children)
103
+ end
104
+ end
105
+
106
+ def related_designation1(desgn)
107
+ super
108
+ end
109
+
48
110
  def related(docxml)
49
- docxml.xpath(ns("//term[related]")).each { |f| related_term(f) }
111
+ insert_related_type(docxml)
112
+ admitted_to_related docxml
113
+ term_reorder(docxml)
114
+ docxml.xpath(ns("//term[fmt-related/semx]")).each { |f| related_term(f) }
115
+ end
116
+
117
+ # temporarily insert related/@type to fmt-related/semx, for sorting
118
+ def insert_related_type(docxml)
119
+ docxml.xpath(ns("//fmt-related/semx")).each do |r|
120
+ orig = semx_orig(r)
121
+ r["type"] = orig["type"]
122
+ end
50
123
  end
51
124
 
52
125
  def related_term(term)
53
- coll = term_related_reorder(term.xpath(ns("./related")))
54
- term_related_collapse(coll)
126
+ #require "debug"; binding.b
127
+ #coll = term_related_reorder(term.xpath(ns("./fmt-related/semx")))
128
+ r = term.at(ns("./fmt-related"))
129
+ r.xpath(ns(".//xref | .//eref | .//termref")).each(&:remove)
130
+ coll = sort_related(r.xpath(ns("./semx")))
131
+ r.children = term_related_collapse(coll)
55
132
  end
56
133
 
57
134
  def term_related_collapse(coll)
58
135
  prev = 0
136
+ coll[0].wrap("<p></p>")
59
137
  coll[1..-1].each_with_index do |r, i|
60
138
  if coll[prev]["type"] != r["type"]
61
- prev = i and next
139
+ prev = i
140
+ r.wrap("<p></p>")
141
+ next
62
142
  end
63
143
 
64
- coll[prev].at(ns("./preferred")) << "; #{to_xml(r.at(ns('./preferred'))
65
- .children)}"
144
+ #coll[prev].at(ns("./preferred")) << "; #{to_xml(r.at(ns('./preferred'))
145
+ #.children)}"
146
+ coll[prev] << "; #{to_xml(r)}"
66
147
  r.remove
67
148
  end
68
149
  end
69
150
 
151
+ def term_related_collapse(coll)
152
+ prev = 0
153
+ ret = [[coll[0]]]
154
+ coll[1..-1].each do |r|
155
+ if ret[-1][0]["type"] != r["type"]
156
+ ret << [r]
157
+ next
158
+ end
159
+ ret[-1] << r
160
+ end
161
+ ret.map { |x| x.map { |y| to_xml(y) }.join("; ") }.map { |x| "<p>#{x}</p>" }.join("\n")
162
+ end
163
+
70
164
  def sort_terms_key(term)
71
165
  d = term.at(ns("./preferred/expression/name | " \
72
166
  "./preferred/letter-symbol/name | " \
73
167
  "./preferred/graphical-symbol/figure/name | " \
74
168
  "./preferred/graphical-symbol/figure/@id | " \
75
- "./preferred"))
169
+ "./preferred | ./fmt-preferred//semx"))
76
170
  f = term.at(ns("./field-of-application")) || term.at(ns("./domain"))
77
171
  @c.decode("#{sort_terms_key1(d)} :: #{sort_terms_key1(f)}")
78
172
  end
@@ -84,6 +178,7 @@ module IsoDoc
84
178
  dup.text&.strip&.downcase || "zzzz"
85
179
  end
86
180
 
181
+ #KILL
87
182
  def term_related_reorder(coll)
88
183
  ins = coll.first.previous_element
89
184
  ret = sort_related(coll)
@@ -109,24 +204,28 @@ module IsoDoc
109
204
  "#{type} :: #{sort_terms_key(related)}"
110
205
  end
111
206
 
112
- def terms(docxml)
113
- admitted_to_related docxml
114
- super
207
+ def termcleanup(docxml)
115
208
  collapse_term docxml
209
+ docxml.xpath(ns("//term//semx[@type]")).each { |x| x.delete("type") } # temp attribute from insert_related_type
210
+ super
116
211
  end
117
212
 
118
213
  def admitted_to_related(docxml)
119
214
  docxml.xpath(ns("//term")).each do |t|
120
- t.xpath(ns("./admitted | ./preferred")).each_with_index do |a, i|
215
+ t.xpath(ns("./fmt-admitted/semx | ./fmt-preferred/semx")).each_with_index do |a, i|
216
+ orig = semx_orig(a)
121
217
  (i.zero? ||
122
- a.at(ns("./abbreviation-type | ./graphical-symbol"))) and next
123
- admitted_to_related1(a, t.at(ns("./preferred")))
218
+ orig.at(ns("./abbreviation-type | ./graphical-symbol"))) and next
219
+ out = t.at(ns("./fmt-related")) || t.at(ns("./definition")).before("<fmt-related/>").previous
220
+ admitted_to_related1(a, t.at(ns("./fmt-preferred/semx")), out)
221
+ a.parent.name == "fmt-preferred" and a.remove
124
222
  end
223
+ t.at(ns("./fmt-admitted"))&.remove
125
224
  end
126
- term_reorder(docxml)
225
+ #term_reorder(docxml)
127
226
  end
128
227
 
129
- def admitted_to_related1(adm, pref)
228
+ def admitted_to_related1(adm, pref, out)
130
229
  new = adm.dup
131
230
  adm["type"] = "equivalent"
132
231
  adm.name = "related"
@@ -137,6 +236,33 @@ module IsoDoc
137
236
  TERM
138
237
  end
139
238
 
239
+ def admitted_to_related1(adm, pref, out)
240
+ out << <<~TERM
241
+ <semx element='related' source='#{adm['source']}' type='equivalent'><fmt-preferred>#{to_xml(adm)}</p></semx></fmt-preferred>
242
+ TERM
243
+ out.parent.next = <<~TERM
244
+ <term><fmt-preferred>#{to_xml(adm)}</fmt-preferred>
245
+ <fmt-related>
246
+ <semx element="related" source="#{pref['source']}" type="see"><fmt-preferred>#{to_xml(pref)}</fmt-preferred></semx>
247
+ </fmt-related>
248
+ <fmt-definition></fmt-definition></term>
249
+ TERM
250
+ end
251
+
252
+ #KILL
253
+ def related1(node)
254
+ require "debug"; binding.b
255
+ p, ref, orig = related1_prep(node)
256
+ label = @i18n.relatedterms[orig["type"]].upcase
257
+ if p
258
+ node.children =(l10n("<p><strong>#{label}:</strong> " \
259
+ "<em>#{to_xml(p)}</em></p>"))
260
+ else
261
+ node.children = (l10n("<p><strong>#{label}:</strong> " \
262
+ "<strong>**RELATED TERM NOT FOUND**</strong></p>"))
263
+ end
264
+ end
265
+
140
266
  def term_reorder(xmldoc)
141
267
  xmldoc.xpath(ns("//terms")).each { |t| term_reorder1(t) }
142
268
  end
@@ -155,19 +281,35 @@ module IsoDoc
155
281
  end
156
282
  end
157
283
 
284
+ def termcontainers(docxml)
285
+ super
286
+ docxml.xpath(ns("//term[not(./fmt-definition)]")).each do |t|
287
+ t << "<fmt-definition></fmt-definition>"
288
+ end
289
+ end
290
+
158
291
  def collapse_term(docxml)
159
292
  docxml.xpath(ns("//term")).each { |t| collapse_term1(t) }
160
293
  end
161
294
 
162
295
  def collapse_term1(term)
296
+ #pref = term.xpath(ns("./fmt-preferred//semx")).each_with_index.with_object([]) do |(a, i), m|
297
+ #orig = semx_orig(a, term)
298
+ #if i.zero? || orig.at(ns("./abbreviation-type | ./graphical-symbol"))
299
+ #m << a
300
+ #end
301
+ #end
302
+
163
303
  ret = collapse_term_template(
164
- pref: term.at(ns("./preferred"))&.remove,
165
- def: term.at(ns("./definition")),
166
- rels: term.xpath(ns("./related")).map(&:remove),
167
- source: term.at(ns("./termsource")),
304
+ pref: term.at(ns("./fmt-preferred")),
305
+ def: term.at(ns("./fmt-definition")),
306
+ rels: term.at(ns("./fmt-related"))&.remove,
307
+ source: term.at(ns("./fmt-termsource"))&.remove,
168
308
  )
169
- (ins = term.elements.first and ins.previous = ret) or
170
- term << ret
309
+ term.at(ns("./fmt-preferred"))&.remove
310
+ term.at(ns("./fmt-admitted"))&.remove
311
+ ins = term.at(ns("./fmt-definition")) and
312
+ ins.children = ret
171
313
  end
172
314
 
173
315
  def collapse_term_related(rels)
@@ -180,29 +322,71 @@ module IsoDoc
180
322
  ret
181
323
  end
182
324
 
325
+ def collapse_term_related(rels)
326
+ rels or return
327
+ rels.xpath(ns("./p")).each do |p|
328
+ #require "debug"; binding.b
329
+ orig = p.at(ns(".//semx[@element = 'related']"))
330
+ reln = "<em>#{@i18n.relatedterms[orig['type']]}:</em> "
331
+ p.add_first_child reln
332
+ p.xpath(ns(".//semx[@element = 'related']")).each do |r|
333
+ r.at(ns("./fmt-preferred")) or r.add_first_child "**RELATED TERM NOT FOUND**"
334
+ end
335
+ end
336
+ ret = rels.xpath(ns("./p")).map { |x| to_xml(x.children).strip }.join(". ")
337
+ ret += "." unless ret.empty?
338
+ ret
339
+ end
340
+
183
341
  def collapse_term_template(opt)
184
- defn = collapse_unwrap_definition(opt[:def])
342
+ defn, multiblock = collapse_unwrap_definition(opt[:def])
343
+ #require "debug"; binding.b
185
344
  src = nil
186
345
  opt[:source] and src = "(#{to_xml(opt[:source].remove.children).strip})"
187
- t = opt[:pref] ? to_xml(opt[:pref].children) : "**TERM NOT FOUND**"
346
+ t = collapse_term_pref(opt)
347
+ #require "debug"; opt[:pref].nil? and binding.b
348
+ #require "debug"; opt[:rels].empty? or binding.b
349
+ tail = "#{collapse_term_related(opt[:rels])} #{src}"
350
+ if multiblock
351
+ tail = tail.strip.empty? ? "" : "<p>#{tail}</p>"
352
+ <<~TERM
353
+ <p>#{t}:</p> #{defn}#{tail}
354
+ TERM
355
+ else
188
356
  <<~TERM
189
- <p>#{t}: #{defn} #{collapse_term_related(opt[:rels])} #{src}</p>
357
+ <p>#{t}: #{defn} #{tail}</p>
190
358
  TERM
359
+ end
360
+ end
361
+
362
+ def collapse_term_pref(opt)
363
+ p = opt[:pref]
364
+ p.text.strip.empty? and return "**TERM NOT FOUND**"
365
+ s = p.xpath(ns(".//semx[@element = 'termsource']"))
366
+ unless s.empty?
367
+ s[0].previous = " ("
368
+ s[-1].next = ")"
369
+ end
370
+ p.xpath(ns(".//fmt-termsource")).each { |x| x.replace(x.children) }
371
+ to_xml(p.children).strip
372
+
191
373
  end
192
374
 
193
375
  def collapse_unwrap_definition(defn)
194
- defn.nil? and return nil
195
- s = defn.remove.xpath(ns("./termsource"))
196
- p = defn.at(ns("./p"))
376
+ #require "debug"; binding.b
377
+ defn.nil? and return nil, nil
378
+ s = defn.xpath(ns(".//fmt-termsource"))
379
+ p = defn.at(ns(".//p"))
197
380
  !s.empty? && p and p << s.map(&:remove).map(&:children)
198
381
  .map { |x| to_xml(x) }.join
199
- if defn.elements.size == 1 && defn.elements.first.name == "p"
200
- defn.elements.first.children
201
- else defn.elements
202
- end
382
+ # fmt-definition/semx/p
383
+ elems = defn.at(ns("./semx")) || defn
384
+ multiblock = elems.at(ns("./table | ./formula | ./dl | ./ol | ./ul")) || elems.xpath(ns("./p")).size > 1
385
+ [defn.elements, multiblock]
203
386
  end
204
387
 
205
- def termsource1(elem)
388
+ # KILL
389
+ def termsource1xx(elem)
206
390
  while elem&.next_element&.name == "termsource"
207
391
  elem << "; #{to_xml(elem.next_element.remove.children)}"
208
392
  end
@@ -210,6 +394,12 @@ module IsoDoc
210
394
  elem.children = l10n("#{adapt}#{to_xml(elem.children).strip}")
211
395
  end
212
396
 
397
+ def termsource_label(elem, sources)
398
+ adapt = termsource_adapt(elem["status"]) and
399
+ sources = "#{adapt}#{sources}"
400
+ elem.replace(l10n(sources))
401
+ end
402
+
213
403
  def termsource_adapt(status)
214
404
  case status
215
405
  when "adapted" then @i18n.adapted_from
@@ -217,17 +407,17 @@ module IsoDoc
217
407
  end
218
408
 
219
409
  # domain is rendered in designation_field instead
220
- def termdomain(elem)
221
- d = elem.at(ns(".//domain")) or return
222
- d["hidden"] = "true"
410
+ def termdomain(elem, domain)
411
+ #d = elem.at(ns(".//domain")) or return
412
+ #d["hidden"] = "true"
223
413
  end
224
414
 
225
- # TODO wrap domain not in <domain>, but <span class="domain"> or equivalent
226
- def designation_field(desgn, name)
227
- if desgn.name == "preferred"
228
- f = desgn.xpath(ns("./../domain | ./../subject")).map(&:remove)
229
- .map { |u| to_xml(u.children) }.join(", ")
230
- name << ", &#x3c;#{f}&#x3e;" unless f.empty?
415
+ def designation_field(desgn, name, orig)
416
+ if desgn["element"] == "preferred"
417
+ f = orig.parent.xpath(ns("./domain | ./subject"))
418
+ .map { |u| to_xml(semx_fmt_dup(u)) }.join(", ")
419
+ #require 'debug'; binding.b
420
+ name << "<span class='fmt-designation-field'>, &#x3c;#{f}&#x3e;</span>" unless f.empty?
231
421
  end
232
422
  super
233
423
  end
@@ -244,6 +434,27 @@ module IsoDoc
244
434
  pref << " (#{tail})"
245
435
  end
246
436
 
437
+ def merge_second_preferred(term)
438
+ term.name == "fmt-admitted" and return
439
+ pref =
440
+ term.parent.at(ns("./preferred[not(abbreviation-type)][expression/name]"))
441
+ x = term.parent.xpath(ns("./preferred[expression/name][abbreviation-type] | " \
442
+ "./admitted[expression/name][abbreviation-type]"))
443
+ (pref && !x.empty?) or return
444
+ fmt_pref = term.parent.at(ns(".//semx[@source = '#{pref['id']}']"))
445
+ fdf = fmt_pref.at(ns(".//span[@class = 'fmt-designation-field']"))&.text
446
+ out = to_xml(fmt_pref)
447
+ tail = x.map do |p|
448
+ #require "debug"; binding.b
449
+ ret = term.parent.at(ns(".//semx[@source = '#{p['id']}']")).remove
450
+ fdf1 = ret.at(ns(".//span[@class = 'fmt-designation-field']"))
451
+ fdf1 && (fdf1&.text == fdf) and fdf1.remove # repetition of domain suppressed
452
+ to_xml(ret).strip
453
+ end.join(", ")
454
+ out += " (#{tail})"
455
+ term.children = out
456
+ end
457
+
247
458
  def termnote1(elem)
248
459
  lbl = termnote_label(elem)
249
460
  prefix_name(elem, { label: block_delim }, lower2cap(lbl), "name")
@@ -258,7 +469,7 @@ module IsoDoc
258
469
 
259
470
  def concept1(node)
260
471
  concept_render(node, ital: "false", ref: "false", bold: "false",
261
- linkref: "false", linkmention: "false")
472
+ linkref: "false", linkmention: "false")
262
473
  end
263
474
  end
264
475
  end
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -1271,17 +1277,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1271
1277
  </define>
1272
1278
  <define name="validityBegins">
1273
1279
  <element name="validityBegins">
1274
- <ref name="ISO8601DateTime"/>
1280
+ <ref name="ISO8601Date"/>
1275
1281
  </element>
1276
1282
  </define>
1277
1283
  <define name="validityEnds">
1278
1284
  <element name="validityEnds">
1279
- <ref name="ISO8601DateTime"/>
1285
+ <ref name="ISO8601Date"/>
1280
1286
  </element>
1281
1287
  </define>
1282
1288
  <define name="validityRevision">
1283
1289
  <element name="revision">
1284
- <ref name="ISO8601DateTime"/>
1290
+ <ref name="ISO8601Date"/>
1285
1291
  </element>
1286
1292
  </define>
1287
1293
  <define name="TypedTitleString">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ieee
3
- VERSION = "1.3.8".freeze
3
+ VERSION = "1.3.9".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-07 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc