metanorma-iso 2.8.9 → 2.9.0

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.
@@ -3731,6 +3731,21 @@
3731
3731
  </xsl:choose>
3732
3732
  </xsl:template>
3733
3733
 
3734
+ <xsl:template match="iso:copyright-statement/iso:clause" priority="3">
3735
+ <fo:block role="SKIP">
3736
+ <xsl:if test="@id = 'boilerplate-copyright-default' and ../iso:clause[not(@id = 'boilerplate-copyright-default')]">
3737
+ <xsl:attribute name="color">blue</xsl:attribute>
3738
+ <xsl:attribute name="border">1pt solid blue</xsl:attribute>
3739
+ <xsl:attribute name="padding">1mm</xsl:attribute>
3740
+ </xsl:if>
3741
+ <xsl:if test="not(@id = 'boilerplate-copyright-default') and preceding-sibling::iso:clause">
3742
+ <xsl:attribute name="margin-top">5mm</xsl:attribute>
3743
+ </xsl:if>
3744
+ <xsl:copy-of select="@id"/>
3745
+ <xsl:apply-templates/>
3746
+ </fo:block>
3747
+ </xsl:template>
3748
+
3734
3749
  <xsl:template match="iso:copyright-statement//iso:p" priority="2">
3735
3750
  <xsl:choose>
3736
3751
  <xsl:when test="$layoutVersion = '1951'">
@@ -3777,7 +3792,7 @@
3777
3792
  <xsl:attribute name="margin-left">0.5mm</xsl:attribute>
3778
3793
  <xsl:attribute name="margin-right">0.5mm</xsl:attribute>
3779
3794
  </xsl:if>
3780
- <xsl:if test="contains(@id, 'address')">
3795
+ <xsl:if test="contains(@id, 'address') or contains(normalize-space(), 'Tel:') or contains(normalize-space(), 'Phone:')">
3781
3796
  <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
3782
3797
  </xsl:if>
3783
3798
  <xsl:apply-templates/>
@@ -4415,6 +4430,8 @@
4415
4430
  </xsl:if>
4416
4431
  </xsl:if>
4417
4432
 
4433
+ <xsl:call-template name="addReviewHelper"/>
4434
+
4418
4435
  <xsl:call-template name="processElementContent"/>
4419
4436
  </fo:block>
4420
4437
  </xsl:template>
@@ -4431,6 +4448,8 @@
4431
4448
 
4432
4449
  <xsl:call-template name="refine_clause_style"/>
4433
4450
 
4451
+ <xsl:call-template name="addReviewHelper"/>
4452
+
4434
4453
  <xsl:call-template name="processElementContent"/>
4435
4454
 
4436
4455
  </fo:block>
@@ -9357,6 +9376,11 @@
9357
9376
 
9358
9377
  <xsl:value-of select="@reference"/>
9359
9378
 
9379
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
9380
+ <!-- <xsl:if test="$namespace = 'itu'">
9381
+ <xsl:text>)</xsl:text>
9382
+ </xsl:if> -->
9383
+
9360
9384
  </fo:inline>
9361
9385
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
9362
9386
  <xsl:copy-of select="./node()"/>
@@ -9366,7 +9390,7 @@
9366
9390
 
9367
9391
  </xsl:if>
9368
9392
  </xsl:for-each>
9369
- </xsl:template>
9393
+ </xsl:template> <!-- table_fn_display -->
9370
9394
 
9371
9395
  <xsl:template name="create_fn">
9372
9396
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -9394,8 +9418,10 @@
9394
9418
  <!-- EMD table's footnotes rendering -->
9395
9419
  <!-- ============================ -->
9396
9420
 
9421
+ <!-- ============================ -->
9397
9422
  <!-- figure's footnotes rendering -->
9398
- <xsl:template name="fn_display_figure">
9423
+ <!-- ============================ -->
9424
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
9399
9425
 
9400
9426
  <!-- current figure id -->
9401
9427
  <xsl:variable name="figure_id_">
@@ -9508,9 +9534,28 @@
9508
9534
 
9509
9535
  </fo:block>
9510
9536
  </xsl:if>
9511
-
9512
9537
  </xsl:template> <!-- fn_display_figure -->
9513
9538
 
9539
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
9540
+ <!-- figure's footnote label -->
9541
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'dl'][@key = 'true']/*[local-name() = 'dt']/ *[local-name() = 'p'][count(node()[normalize-space() != '']) = 1]/*[local-name() = 'sup']" priority="3">
9542
+ <xsl:variable name="key_iso">
9543
+ true
9544
+ </xsl:variable>
9545
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9546
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
9547
+
9548
+ </xsl:if>
9549
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
9550
+ <!-- <xsl:value-of select="@reference"/> -->
9551
+ <xsl:apply-templates/>
9552
+ </fo:inline>
9553
+ </xsl:template>
9554
+
9555
+ <!-- ============================ -->
9556
+ <!-- END: figure's footnotes rendering -->
9557
+ <!-- ============================ -->
9558
+
9514
9559
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
9515
9560
  <xsl:template match="*[local-name()='fn']">
9516
9561
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -9526,6 +9571,10 @@
9526
9571
 
9527
9572
  <xsl:value-of select="@reference"/>
9528
9573
 
9574
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9575
+ <!-- <xsl:if test="$namespace = 'jis'">
9576
+ <fo:inline font-weight="normal">)</fo:inline>
9577
+ </xsl:if> -->
9529
9578
  </fo:basic-link>
9530
9579
  </fo:inline>
9531
9580
  </xsl:template>
@@ -9656,17 +9705,22 @@
9656
9705
  </fo:block>
9657
9706
  </xsl:when> <!-- END: a few components -->
9658
9707
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
9659
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
9708
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
9709
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
9660
9710
 
9661
- <xsl:call-template name="refine_figure_key_style"/>
9711
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
9662
9712
 
9663
- <xsl:variable name="title-key">
9664
- <xsl:call-template name="getLocalizedString">
9665
- <xsl:with-param name="key">key</xsl:with-param>
9666
- </xsl:call-template>
9667
- </xsl:variable>
9668
- <xsl:value-of select="$title-key"/>
9669
- </fo:block>
9713
+ <xsl:call-template name="refine_figure_key_style"/>
9714
+
9715
+ <xsl:variable name="title-key">
9716
+ <xsl:call-template name="getLocalizedString">
9717
+ <xsl:with-param name="key">key</xsl:with-param>
9718
+ </xsl:call-template>
9719
+ </xsl:variable>
9720
+ <xsl:value-of select="$title-key"/>
9721
+ </fo:block>
9722
+
9723
+ </xsl:if>
9670
9724
  </xsl:when> <!-- END: definition list in a figure -->
9671
9725
  </xsl:choose>
9672
9726
 
@@ -9856,6 +9910,14 @@
9856
9910
 
9857
9911
  </xsl:template> <!-- END: dl -->
9858
9912
 
9913
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
9914
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
9915
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
9916
+ <xsl:call-template name="refine_figure_key_style"/>
9917
+ <xsl:apply-templates/>
9918
+ </fo:block>
9919
+ </xsl:template>
9920
+
9859
9921
  <xsl:template name="refine_dl_formula_where_style">
9860
9922
 
9861
9923
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -11988,6 +12050,39 @@
11988
12050
  </xsl:copy>
11989
12051
  </xsl:template>
11990
12052
 
12053
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
12054
+ <xsl:copy>
12055
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
12056
+ </xsl:copy>
12057
+ </xsl:template>
12058
+
12059
+ <!-- split math into two math -->
12060
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
12061
+ <xsl:variable name="math_elements_tree_">
12062
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
12063
+ <element pos="{position()}">
12064
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
12065
+ <xsl:value-of select="name()"/>
12066
+ </element>
12067
+ </xsl:for-each>
12068
+ </xsl:variable>
12069
+
12070
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
12071
+
12072
+ <xsl:call-template name="insertClosingElements">
12073
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
12074
+ </xsl:call-template>
12075
+
12076
+ <xsl:element name="br" namespace="{$namespace_full}"/>
12077
+
12078
+ <xsl:call-template name="insertOpeningElements">
12079
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
12080
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
12081
+ <xsl:with-param name="add_continue">false</xsl:with-param>
12082
+ </xsl:call-template>
12083
+
12084
+ </xsl:template>
12085
+
11991
12086
  <!-- Examples:
11992
12087
  <stem type="AsciiMath">x = 1</stem>
11993
12088
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -12241,9 +12336,11 @@
12241
12336
  </xsl:template>
12242
12337
 
12243
12338
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
12339
+ <!-- https://github.com/metanorma/isodoc/issues/607
12244
12340
  <xsl:if test="normalize-space() != ''">
12245
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
12246
- </xsl:if>
12341
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
12342
+ </xsl:if> -->
12343
+ <xsl:apply-templates/>
12247
12344
  </xsl:template>
12248
12345
 
12249
12346
  <!-- stem inside formula with name (with formula's number) -->
@@ -12422,10 +12519,21 @@
12422
12519
  </xsl:when>
12423
12520
  <xsl:otherwise>
12424
12521
 
12522
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
12523
+ <!-- <xsl:if test="$namespace = 'ieee'">
12524
+ <xsl:text>—</xsl:text> em dash &#x2014;
12525
+ </xsl:if> -->
12526
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
12527
+ <xsl:text>:</xsl:text>
12528
+ </xsl:if> -->
12529
+
12425
12530
  <xsl:if test="$layoutVersion = '1987' and . = translate(.,'1234567890','')"> <!-- NOTE without number -->
12426
12531
  <xsl:text> — </xsl:text>
12427
12532
  </xsl:if>
12428
12533
 
12534
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
12535
+ <xsl:text> – </xsl:text> en dash &#x2013;
12536
+ </xsl:if> -->
12429
12537
  </xsl:otherwise>
12430
12538
  </xsl:choose>
12431
12539
  </xsl:variable>
@@ -12444,8 +12552,16 @@
12444
12552
  </xsl:when>
12445
12553
  <xsl:otherwise>
12446
12554
 
12555
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
12556
+ <!-- <xsl:if test="$namespace = 'ieee'">
12557
+ <xsl:text>—</xsl:text> em dash &#x2014;
12558
+ </xsl:if> -->
12559
+ <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' or $namespace = 'rsd' or $namespace = 'jcgm'">
12447
12560
  <xsl:text>:</xsl:text>
12448
-
12561
+ </xsl:if> -->
12562
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
12563
+ <xsl:text> – </xsl:text> en dash &#x2013;
12564
+ </xsl:if> -->
12449
12565
  </xsl:otherwise>
12450
12566
  </xsl:choose>
12451
12567
  </xsl:variable>
@@ -14615,7 +14731,7 @@
14615
14731
  <xsl:if test="normalize-space() != ''">
14616
14732
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
14617
14733
  <xsl:call-template name="refine_termexample-name-style"/>
14618
- <xsl:apply-templates/>
14734
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
14619
14735
  </fo:inline>
14620
14736
  </xsl:if>
14621
14737
  </xsl:template>
@@ -14782,7 +14898,7 @@
14782
14898
  <xsl:otherwise>
14783
14899
  <fo:inline xsl:use-attribute-sets="example-name-style">
14784
14900
  <xsl:call-template name="refine_example-name-style"/>
14785
- <xsl:apply-templates/>
14901
+ <xsl:apply-templates/> <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
14786
14902
  </fo:inline>
14787
14903
  </xsl:otherwise>
14788
14904
  </xsl:choose>
@@ -14974,15 +15090,17 @@
14974
15090
 
14975
15091
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
14976
15092
  <fo:block role="BlockQuote">
14977
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
15093
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source') and not(local-name() = 'attribution')]"/> <!-- process all nested nodes, except author and source -->
14978
15094
  </fo:block>
14979
15095
  </fo:block-container>
14980
15096
  </fo:block-container>
14981
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
15097
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
14982
15098
  <fo:block xsl:use-attribute-sets="quote-source-style">
14983
15099
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
14984
15100
  <xsl:apply-templates select="*[local-name() = 'author']"/>
14985
15101
  <xsl:apply-templates select="*[local-name() = 'source']"/>
15102
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
15103
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
14986
15104
  </fo:block>
14987
15105
  </xsl:if>
14988
15106
 
@@ -15004,9 +15122,13 @@
15004
15122
  </xsl:template>
15005
15123
 
15006
15124
  <xsl:template match="*[local-name() = 'author']">
15007
- <xsl:text>— </xsl:text>
15125
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
15126
+ <xsl:text>— </xsl:text>
15127
+ </xsl:if>
15008
15128
  <xsl:apply-templates/>
15009
15129
  </xsl:template>
15130
+
15131
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
15010
15132
  <!-- ====== -->
15011
15133
  <!-- ====== -->
15012
15134
 
@@ -15187,8 +15309,12 @@
15187
15309
  </xsl:template>
15188
15310
 
15189
15311
  <xsl:template match="*[local-name() = 'domain']">
15312
+ <!-- https://github.com/metanorma/isodoc/issues/607
15190
15313
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
15191
- <xsl:text> </xsl:text>
15314
+ <xsl:text> </xsl:text> -->
15315
+ <xsl:if test="not(@hidden = 'true')">
15316
+ <xsl:apply-templates/>
15317
+ </xsl:if>
15192
15318
  </xsl:template>
15193
15319
 
15194
15320
  <xsl:template match="*[local-name() = 'admitted']">
@@ -15236,6 +15362,29 @@
15236
15362
  <!-- END definition -->
15237
15363
  <!-- ========== -->
15238
15364
 
15365
+ <xsl:variable name="reviews_">
15366
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
15367
+ <xsl:copy>
15368
+ <xsl:copy-of select="@from"/>
15369
+ <xsl:copy-of select="@id"/>
15370
+ </xsl:copy>
15371
+ </xsl:for-each>
15372
+ </xsl:variable>
15373
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
15374
+
15375
+ <xsl:template name="addReviewHelper">
15376
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
15377
+ <xsl:variable name="curr_id" select="@id"/>
15378
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
15379
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
15380
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
15381
+ </xsl:if>
15382
+ <!-- <fo:block>
15383
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
15384
+ <xsl:copy-of select="$reviews"/>
15385
+ </fo:block> -->
15386
+ </xsl:template>
15387
+
15239
15388
  <!-- main sections -->
15240
15389
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
15241
15390
 
@@ -15244,6 +15393,8 @@
15244
15393
 
15245
15394
  <xsl:call-template name="sections_element_style"/>
15246
15395
 
15396
+ <xsl:call-template name="addReviewHelper"/>
15397
+
15247
15398
  <xsl:apply-templates/>
15248
15399
  </fo:block>
15249
15400
 
@@ -15290,6 +15441,7 @@
15290
15441
 
15291
15442
  <fo:block>
15292
15443
  <xsl:call-template name="setId"/>
15444
+ <xsl:call-template name="addReviewHelper"/>
15293
15445
  <xsl:apply-templates/>
15294
15446
  </fo:block>
15295
15447
  </xsl:template>
@@ -15326,6 +15478,8 @@
15326
15478
 
15327
15479
  <xsl:call-template name="refine_clause_style"/>
15328
15480
 
15481
+ <xsl:call-template name="addReviewHelper"/>
15482
+
15329
15483
  <xsl:apply-templates/>
15330
15484
  </fo:block>
15331
15485
  </xsl:template>
@@ -15378,6 +15532,23 @@
15378
15532
 
15379
15533
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
15380
15534
 
15535
+ <xsl:if test="1 = 1">
15536
+ <xsl:choose>
15537
+ <!-- if there isn't the attribute '@from', then -->
15538
+ <xsl:when test="$id_from = ''">
15539
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
15540
+ </xsl:when>
15541
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
15542
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
15543
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
15544
+ </xsl:when>
15545
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
15546
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
15547
+ </xsl:when>
15548
+ </xsl:choose>
15549
+ </xsl:if>
15550
+
15551
+ <xsl:if test="1 = 2">
15381
15552
  <xsl:choose>
15382
15553
  <!-- if there isn't the attribute '@from', then -->
15383
15554
  <xsl:when test="$id_from = ''">
@@ -15391,6 +15562,7 @@
15391
15562
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
15392
15563
  </xsl:when>
15393
15564
  </xsl:choose>
15565
+ </xsl:if>
15394
15566
 
15395
15567
  </xsl:template>
15396
15568
 
@@ -16545,9 +16717,9 @@
16545
16717
  </xsl:if>
16546
16718
 
16547
16719
  <xsl:if test="@type != 'editorial'">
16548
- <xsl:call-template name="displayAdmonitionName">
16549
- <xsl:with-param name="sep"> — </xsl:with-param>
16550
- </xsl:call-template>
16720
+ <xsl:call-template name="displayAdmonitionName"/>
16721
+ <!-- https://github.com/metanorma/isodoc/issues/614 -->
16722
+ <!-- <xsl:with-param name="sep"> — </xsl:with-param> -->
16551
16723
  </xsl:if>
16552
16724
 
16553
16725
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -16805,7 +16977,7 @@
16805
16977
  <!-- remove preprocess-xslt -->
16806
16978
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
16807
16979
 
16808
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
16980
+ <xsl:template match="*[local-name() = 'stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])] | *[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
16809
16981
  <xsl:copy-of select="."/>
16810
16982
  </xsl:template>
16811
16983
 
@@ -16871,6 +17043,22 @@
16871
17043
  </xsl:choose>
16872
17044
  </xsl:template>
16873
17045
 
17046
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
17047
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
17048
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
17049
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
17050
+ <xsl:apply-templates mode="update_xml_step1"/>
17051
+ </xsl:if>
17052
+ </xsl:template>
17053
+
17054
+ <!-- split math by element with @linebreak into maths -->
17055
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
17056
+ <xsl:variable name="maths">
17057
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
17058
+ </xsl:variable>
17059
+ <xsl:copy-of select="$maths"/>
17060
+ </xsl:template>
17061
+
16874
17062
  <!-- =========================================================================== -->
16875
17063
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
16876
17064
  <!-- =========================================================================== -->
@@ -16974,6 +17162,8 @@
16974
17162
 
16975
17163
  <xsl:template name="insertOpeningElements">
16976
17164
  <xsl:param name="tree"/>
17165
+ <xsl:param name="xmlns"/>
17166
+ <xsl:param name="add_continue">true</xsl:param>
16977
17167
  <xsl:for-each select="$tree//element">
16978
17168
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
16979
17169
  <xsl:value-of select="."/>
@@ -16984,7 +17174,8 @@
16984
17174
  <xsl:value-of select="."/>
16985
17175
  <xsl:text>"</xsl:text>
16986
17176
  </xsl:for-each>
16987
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
17177
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
17178
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
16988
17179
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
16989
17180
  <xsl:if test="$debug = 'true'">
16990
17181
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -32,7 +32,7 @@ module IsoDoc
32
32
  ret = "<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}'>" \
33
33
  "<p><strong>Metadata warnings:<strong></p> #{ret}</review>"
34
34
  ins = docxml.at(ns("//sections//title")) or return
35
- ins.children.first.previous = ret
35
+ ins.add_first_child ret
36
36
  end
37
37
 
38
38
  def editorialgroup_identifier(docxml)
@@ -52,19 +52,6 @@ module IsoDoc
52
52
  node.children)
53
53
  end
54
54
 
55
- def termdefinition1(elem)
56
- prefix_domain_to_definition(elem)
57
- super
58
- end
59
-
60
- def prefix_domain_to_definition(elem)
61
- ((d = elem.at(ns("./domain"))) &&
62
- (v = elem.at(ns("./definition/verbal-definition"))) &&
63
- v.elements.first.name == "p") or return
64
- v.elements.first.children.first.previous =
65
- "&#x3c;#{to_xml(d.remove.children)}&#x3e; "
66
- end
67
-
68
55
  def insertall_after_here(node, insert, name)
69
56
  node.children.each do |n|
70
57
  n.name == name or next
@@ -31,6 +31,7 @@ module IsoDoc
31
31
  admonition docxml
32
32
  source docxml
33
33
  ol docxml
34
+ quote docxml
34
35
  permission docxml
35
36
  requirement docxml
36
37
  recommendation docxml
@@ -38,6 +39,8 @@ module IsoDoc
38
39
  @xrefs.anchors_previous = @xrefs.anchors.dup # store old xrefs of reqts
39
40
  @xrefs.parse docxml
40
41
  table docxml # have table include requirements newly converted to tables
42
+ # table feeds dl
43
+ dl docxml
41
44
  example docxml
42
45
  note docxml
43
46
  end
@@ -52,6 +55,8 @@ module IsoDoc
52
55
  end
53
56
 
54
57
  def figure1(node)
58
+ figure_fn(node)
59
+ figure_key(node.at(ns("./dl")))
55
60
  lbl = @xrefs.anchor(node["id"], :label, false) or return
56
61
  figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} "
57
62
  conn = node.parent.name == "figure" ? "&#xa0; " : "&#xa0;&#x2014; "
@@ -97,7 +102,6 @@ module IsoDoc
97
102
 
98
103
  def admonition1(elem)
99
104
  super
100
- admonition_inline_name(elem)
101
105
  admonition_outside_clauses(elem)
102
106
  end
103
107
 
@@ -113,17 +117,6 @@ module IsoDoc
113
117
  cell.children.each { |p| wrap_in_bold(p) }
114
118
  end
115
119
 
116
- def admonition_inline_name(elem)
117
- n = elem.at(ns("./name")) or return
118
- if (p = n.next_element) && p&.name == "p"
119
- p.children.first.previous = admonition_name(to_xml(n.remove.children))
120
- end
121
- end
122
-
123
- def admonition_name(xml)
124
- "#{xml} &#x2014; "
125
- end
126
-
127
120
  def bibrender_formattedref(formattedref, xml)
128
121
  %w(techreport standard).include? xml["type"] and return
129
122
  super
@@ -146,10 +139,9 @@ module IsoDoc
146
139
 
147
140
  def formula_where(dlist)
148
141
  dlist.nil? and return
149
- return super unless dlist.xpath(ns("./dt")).size == 1 &&
142
+ dlist.xpath(ns("./dt")).size == 1 &&
150
143
  dlist.at(ns("./dd"))&.elements&.size == 1 &&
151
- dlist.at(ns("./dd/p"))
152
-
144
+ dlist.at(ns("./dd/p")) or return super
153
145
  formula_where_one(dlist)
154
146
  end
155
147
 
@@ -162,7 +154,7 @@ module IsoDoc
162
154
 
163
155
  def table1(elem)
164
156
  elem.xpath(ns(".//dl[@key = 'true'][not(./name)]")).each do |dl|
165
- dl.children.first.previous = "<name>#{@i18n.key}</name>"
157
+ dl.add_first_child "<name>#{@i18n.key}</name>"
166
158
  end
167
159
  super
168
160
  end
@@ -177,7 +169,7 @@ module IsoDoc
177
169
  return
178
170
  s = docxml.at(ns("//sections")) or return
179
171
  ret = "#{middle_title_main}#{middle_title_amd}"
180
- s.children.first.previous = ret
172
+ s.add_first_child ret
181
173
  end
182
174
 
183
175
  def middle_title_main
@@ -214,9 +206,7 @@ module IsoDoc
214
206
  end
215
207
 
216
208
  def move_norm_ref_to_sections(docxml)
217
- if amd?(docxml)
218
- else super
219
- end
209
+ amd?(docxml) or super
220
210
  end
221
211
 
222
212
  def twitter_cldr_localiser_symbols
@@ -224,6 +214,25 @@ module IsoDoc
224
214
  fraction_group_digits: 3 }
225
215
  end
226
216
 
217
+ def implicit_reference(bib)
218
+ bib.at(ns("./docidentifier"))&.text == "IEV" and return true
219
+ super
220
+ end
221
+
222
+ def render_identifier(ident)
223
+ ret = super
224
+ ret[:sdo] = std_docid_semantic(ret[:sdo])
225
+ ret
226
+ end
227
+
228
+ def admonition_delim(elem)
229
+ if elem.at("./*[not(self::xmlns:name)]")&.name == "p"
230
+ " &#x2014; "
231
+ else
232
+ ""
233
+ end
234
+ end
235
+
227
236
  include Init
228
237
  end
229
238
  end
@@ -130,6 +130,8 @@ module IsoDoc
130
130
  end
131
131
 
132
132
  def expand_citeas(text)
133
+ ret = super or return
134
+ ret.include?("<span") and return ret
133
135
  std_docid_semantic(super)
134
136
  end
135
137
 
@@ -12,7 +12,7 @@ module IsoDoc
12
12
  @foreword = true
13
13
  page_break(out)
14
14
  out.div **attr_code(id: clause["id"]) do |s|
15
- clause_name(nil, clause.at(ns("./title")) || @i18n.foreword, s,
15
+ clause_name(nil, clause.at(ns("./title")), s,
16
16
  { class: "ForewordTitle" })
17
17
  clause.elements.each { |e| parse(e, s) unless e.name == "title" }
18
18
  end
@@ -21,6 +21,7 @@ module Metanorma
21
21
  @amd && a = node.attr("updates-document-type") and
22
22
  xml.updates_document_type a
23
23
  a = node.attr("fast-track") and xml.send "fast-track", a != "false"
24
+ a = node.attr("price-code") and xml.price_code a
24
25
  end
25
26
 
26
27
  STAGE_ERROR = [Pubid::Core::Errors::HarmonizedStageCodeInvalidError,
@@ -54,12 +54,10 @@ module Metanorma
54
54
  def contrib_committee_build(xml, agency, committee)
55
55
  name = org_abbrev.invert[agency] and agency = name
56
56
  xml.name agency
57
- xml.subdivision do |s|
58
- s.organization do |o|
57
+ xml.subdivision do |o|
59
58
  o.name committee[:name]
60
59
  committee[:abbr] and o.abbreviation committee[:abbr]
61
60
  committee[:ident] and o.identifier committee[:ident]
62
- end
63
61
  end
64
62
  end
65
63