metanorma-ieee 1.0.7 → 1.0.8

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: cdf013ad5b7bad27f48282dfb166c87e0bce9d41f8a94621b56ce3f648ae7657
4
- data.tar.gz: 01ddb4d056454b112307855255b9ee2e67ae32bea8247510fc12f7bcc21a80e9
3
+ metadata.gz: b91dce824389198d4a39f1890590c4df0d2c99796e02c2458798d075065e5585
4
+ data.tar.gz: 10a4a1957e51f3a2137f2864d3735720dbb111f9e11f51b891ad8d5111a90cb2
5
5
  SHA512:
6
- metadata.gz: 482b633f5f6b44b41c271dc5e1b28d41952ac89e9eaf5cbf581544349999550154f40d89a13f8a805ea87db39428f6719154945a73db0d747c1f597017e79193
7
- data.tar.gz: 70156591d2d36841d14de1198d8676c475618fcafac4f71693e71f7cfaa3d7400c851715f9ee3f4717b28f54b84f36915f5b9968734f071abc594a753153b412
6
+ metadata.gz: b41c5e257a7dc4edbb8f63f9bef7bb1dd24d071b62de09129c15738d6c57db4ad718e1f0c055a558c63c6d915e63b17f5cdbd777ae41cb45afc8ccae729ed211
7
+ data.tar.gz: 6d4c2f3f265ae01edfc1ecd2c16e28777467af569bacc769385a7d4f9291735c40150d8af9f201696ae80c89feb8b2d1eefc180915ead8f4b07bd0e9d16f297c
@@ -2742,10 +2742,6 @@
2742
2742
  </xsl:choose>
2743
2743
  </xsl:template>
2744
2744
 
2745
- <xsl:template match="*[local-name() = 'inlineChar']">
2746
- <fo:inline><xsl:value-of select="."/></fo:inline>
2747
- </xsl:template>
2748
-
2749
2745
  <!--
2750
2746
  <xsl:variable name="example_name_width">25</xsl:variable>
2751
2747
  <xsl:template match="ieee:termexample" priority="2">
@@ -3710,29 +3706,6 @@
3710
3706
  <!-- End Back Pages -->
3711
3707
  <!-- =============================== -->
3712
3708
 
3713
- <xsl:template name="replaceChar">
3714
- <xsl:param name="text"/>
3715
- <xsl:param name="replace"/>
3716
- <xsl:param name="by"/>
3717
- <xsl:choose>
3718
- <xsl:when test="$text = '' or $replace = '' or not($replace)">
3719
- <xsl:value-of select="$text"/>
3720
- </xsl:when>
3721
- <xsl:when test="contains($text, $replace)">
3722
- <xsl:value-of select="substring-before($text,$replace)"/>
3723
- <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/ieee"><xsl:value-of select="$by"/></xsl:element>
3724
- <xsl:call-template name="replaceChar">
3725
- <xsl:with-param name="text" select="substring-after($text,$replace)"/>
3726
- <xsl:with-param name="replace" select="$replace"/>
3727
- <xsl:with-param name="by" select="$by"/>
3728
- </xsl:call-template>
3729
- </xsl:when>
3730
- <xsl:otherwise>
3731
- <xsl:value-of select="$text"/>
3732
- </xsl:otherwise>
3733
- </xsl:choose>
3734
- </xsl:template>
3735
-
3736
3709
  <xsl:strip-space elements="ieee:xref"/>
3737
3710
 
3738
3711
  <!-- external parameters -->
@@ -4544,6 +4517,7 @@
4544
4517
  <xsl:attribute-set name="term-name-style">
4545
4518
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4546
4519
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4520
+
4547
4521
  </xsl:attribute-set>
4548
4522
 
4549
4523
  <xsl:attribute-set name="figure-block-style">
@@ -5509,7 +5483,7 @@
5509
5483
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5510
5484
  </xsl:when>
5511
5485
  <xsl:otherwise>
5512
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
5486
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
5513
5487
  </xsl:otherwise>
5514
5488
  </xsl:choose>
5515
5489
 
@@ -6000,7 +5974,7 @@
6000
5974
  <xsl:param name="colwidths"/>
6001
5975
  <xsl:param name="colgroup"/>
6002
5976
 
6003
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
5977
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
6004
5978
 
6005
5979
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6006
5980
 
@@ -6068,6 +6042,7 @@
6068
6042
 
6069
6043
  <!-- except gb and bsi -->
6070
6044
 
6045
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
6071
6046
  <xsl:apply-templates select="../*[local-name()='note']"/>
6072
6047
 
6073
6048
  <xsl:variable name="isDisplayRowSeparator">
@@ -6235,7 +6210,7 @@
6235
6210
  <!-- ===================== -->
6236
6211
  <!-- Table's row processing -->
6237
6212
  <!-- ===================== -->
6238
- <!-- row in table header (thead) -->
6213
+ <!-- row in table header (thead) thead/tr -->
6239
6214
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6240
6215
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6241
6216
 
@@ -6276,7 +6251,7 @@
6276
6251
  </xsl:choose>
6277
6252
  </xsl:template>
6278
6253
 
6279
- <!-- row in table footer (tfoot) -->
6254
+ <!-- row in table footer (tfoot), tfoot/tr -->
6280
6255
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6281
6256
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
6282
6257
 
@@ -6772,6 +6747,8 @@
6772
6747
  <!-- <dl><xsl:copy-of select="."/></dl> -->
6773
6748
  <fo:block-container>
6774
6749
 
6750
+ <xsl:call-template name="setBlockSpanAll"/>
6751
+
6775
6752
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
6776
6753
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
6777
6754
  </xsl:if>
@@ -8848,13 +8825,17 @@
8848
8825
  </xsl:template>
8849
8826
 
8850
8827
  <xsl:template match="*[local-name() = 'callout']">
8851
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
8828
+ <xsl:choose>
8829
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
8830
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8831
+ </xsl:choose>
8852
8832
  </xsl:template>
8853
8833
 
8854
8834
  <xsl:template match="*[local-name() = 'annotation']">
8855
8835
  <xsl:variable name="annotation-id" select="@id"/>
8856
8836
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
8857
8837
  <fo:block id="{$annotation-id}" white-space="nowrap">
8838
+
8858
8839
  <fo:inline>
8859
8840
  <xsl:apply-templates>
8860
8841
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -8959,6 +8940,10 @@
8959
8940
  <!-- ====== -->
8960
8941
  <!-- ====== -->
8961
8942
 
8943
+ <xsl:template name="setBlockSpanAll">
8944
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
8945
+ </xsl:template>
8946
+
8962
8947
  <!-- ====== -->
8963
8948
  <!-- note -->
8964
8949
  <!-- termnote -->
@@ -8968,6 +8953,8 @@
8968
8953
 
8969
8954
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
8970
8955
 
8956
+ <xsl:call-template name="setBlockSpanAll"/>
8957
+
8971
8958
  <fo:block-container margin-left="0mm" margin-right="0mm">
8972
8959
 
8973
8960
  <fo:block>
@@ -9018,6 +9005,8 @@
9018
9005
  <xsl:template match="*[local-name() = 'termnote']">
9019
9006
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
9020
9007
 
9008
+ <xsl:call-template name="setBlockSpanAll"/>
9009
+
9021
9010
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9022
9011
 
9023
9012
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -10936,6 +10925,9 @@
10936
10925
  <!-- ====== -->
10937
10926
  <xsl:template match="*[local-name() = 'termexample']">
10938
10927
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10928
+
10929
+ <xsl:call-template name="setBlockSpanAll"/>
10930
+
10939
10931
  <xsl:apply-templates select="*[local-name()='name']"/>
10940
10932
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10941
10933
  </fo:block>
@@ -10991,6 +10983,8 @@
10991
10983
 
10992
10984
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
10993
10985
 
10986
+ <xsl:call-template name="setBlockSpanAll"/>
10987
+
10994
10988
  <xsl:variable name="fo_element">
10995
10989
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10996
10990
  block
@@ -11018,6 +11012,35 @@
11018
11012
  </fo:block-container>
11019
11013
  </xsl:when> <!-- end block -->
11020
11014
 
11015
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11016
+
11017
+ <xsl:variable name="provisional_distance_between_starts">
11018
+ 7
11019
+ </xsl:variable>
11020
+ <xsl:variable name="indent">
11021
+ 0
11022
+ </xsl:variable>
11023
+
11024
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11025
+ <fo:list-item>
11026
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11027
+ <fo:block>
11028
+ <xsl:apply-templates select="*[local-name()='name']">
11029
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11030
+ </xsl:apply-templates>
11031
+ </fo:block>
11032
+ </fo:list-item-label>
11033
+ <fo:list-item-body start-indent="body-start()">
11034
+ <fo:block>
11035
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11036
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11037
+ </xsl:apply-templates>
11038
+ </fo:block>
11039
+ </fo:list-item-body>
11040
+ </fo:list-item>
11041
+ </fo:list-block>
11042
+ </xsl:when> <!-- end list -->
11043
+
11021
11044
  <xsl:otherwise> <!-- inline -->
11022
11045
 
11023
11046
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -11097,6 +11120,11 @@
11097
11120
  </fo:block>
11098
11121
  </fo:block-container>
11099
11122
  </xsl:when>
11123
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
11124
+ <fo:block xsl:use-attribute-sets="example-p-style">
11125
+ <xsl:apply-templates/>
11126
+ </fo:block>
11127
+ </xsl:when>
11100
11128
  <xsl:otherwise>
11101
11129
  <fo:inline xsl:use-attribute-sets="example-p-style">
11102
11130
  <xsl:apply-templates/>
@@ -11214,6 +11242,9 @@
11214
11242
  <!-- ====== -->
11215
11243
  <xsl:template match="*[local-name() = 'quote']">
11216
11244
  <fo:block-container margin-left="0mm">
11245
+
11246
+ <xsl:call-template name="setBlockSpanAll"/>
11247
+
11217
11248
  <xsl:if test="parent::*[local-name() = 'note']">
11218
11249
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
11219
11250
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -11499,6 +11530,8 @@
11499
11530
  <fo:block>
11500
11531
  <xsl:call-template name="setId"/>
11501
11532
 
11533
+ <xsl:call-template name="setBlockSpanAll"/>
11534
+
11502
11535
  <xsl:apply-templates/>
11503
11536
  </fo:block>
11504
11537
  </xsl:template>
@@ -11513,6 +11546,8 @@
11513
11546
  <fo:block break-after="page"/>
11514
11547
  <fo:block id="{@id}">
11515
11548
 
11549
+ <xsl:call-template name="setBlockSpanAll"/>
11550
+
11516
11551
  </fo:block>
11517
11552
  <xsl:apply-templates/>
11518
11553
  </xsl:template>
@@ -12489,6 +12524,8 @@
12489
12524
  <!-- text in the box -->
12490
12525
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
12491
12526
 
12527
+ <xsl:call-template name="setBlockSpanAll"/>
12528
+
12492
12529
  <xsl:if test="@type = 'editorial'">
12493
12530
  <xsl:attribute name="border">none</xsl:attribute>
12494
12531
  <!-- <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -12700,6 +12737,16 @@
12700
12737
  <xsl:apply-templates mode="update_xml_step1"/>
12701
12738
  </xsl:copy>
12702
12739
  </xsl:template>
12740
+
12741
+ <!-- remove semantic xml -->
12742
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12743
+
12744
+ <!-- remove image/emf -->
12745
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12746
+
12747
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
12748
+ <xsl:copy-of select="."/>
12749
+ </xsl:template>
12703
12750
  <!-- =========================================================================== -->
12704
12751
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12705
12752
  <!-- =========================================================================== -->
@@ -12800,6 +12847,10 @@
12800
12847
  </xsl:call-template>
12801
12848
  </xsl:template>
12802
12849
 
12850
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step2">
12851
+ <xsl:copy-of select="."/>
12852
+ </xsl:template>
12853
+
12803
12854
  <!-- =========================================================================== -->
12804
12855
  <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12805
12856
  <!-- =========================================================================== -->
@@ -12821,7 +12872,7 @@
12821
12872
 
12822
12873
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12823
12874
 
12824
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12875
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12825
12876
 
12826
12877
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12827
12878
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -12895,6 +12946,10 @@
12895
12946
 
12896
12947
  </xsl:template>
12897
12948
 
12949
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
12950
+ <xsl:copy-of select="."/>
12951
+ </xsl:template>
12952
+
12898
12953
  <xsl:template name="replace_text_tags">
12899
12954
  <xsl:param name="tag_open"/>
12900
12955
  <xsl:param name="tag_close"/>
@@ -12921,6 +12976,194 @@
12921
12976
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12922
12977
  <!-- ===================================== -->
12923
12978
 
12979
+ <!-- ===================================== -->
12980
+ <!-- ===================================== -->
12981
+ <!-- Make linear XML (need for landscape orientation) -->
12982
+ <!-- ===================================== -->
12983
+ <!-- ===================================== -->
12984
+ <xsl:template match="@*|node()" mode="linear_xml">
12985
+ <xsl:copy>
12986
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
12987
+ </xsl:copy>
12988
+ </xsl:template>
12989
+
12990
+ <xsl:template match="processing-instruction()" mode="linear_xml">
12991
+ <xsl:copy-of select="."/>
12992
+ </xsl:template>
12993
+
12994
+ <!-- From:
12995
+ <clause>
12996
+ <title>...</title>
12997
+ <p>...</p>
12998
+ </clause>
12999
+ To:
13000
+ <clause/>
13001
+ <title>...</title>
13002
+ <p>...</p>
13003
+ -->
13004
+ <xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
13005
+
13006
+ <xsl:copy>
13007
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13008
+
13009
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13010
+
13011
+ <xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
13012
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13013
+ </xsl:if>
13014
+ </xsl:copy>
13015
+
13016
+ <xsl:apply-templates mode="linear_xml"/>
13017
+ </xsl:template>
13018
+
13019
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
13020
+ <xsl:copy>
13021
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13022
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13023
+ <xsl:variable name="level">
13024
+ <xsl:call-template name="getLevel"/>
13025
+ </xsl:variable>
13026
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13027
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
13028
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
13029
+ </xsl:copy>
13030
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
13031
+ </xsl:template>
13032
+
13033
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
13034
+ <xsl:copy>
13035
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13036
+
13037
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13038
+
13039
+ <xsl:variable name="level">
13040
+ <xsl:call-template name="getLevel"/>
13041
+ </xsl:variable>
13042
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13043
+
13044
+ <xsl:if test="parent::*[local-name() = 'annex']">
13045
+ <xsl:attribute name="depth">1</xsl:attribute>
13046
+ </xsl:if>
13047
+
13048
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
13049
+ <xsl:copy-of select="../@inline-header"/>
13050
+ </xsl:if>
13051
+
13052
+ <xsl:attribute name="ancestor">
13053
+ <xsl:choose>
13054
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
13055
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
13056
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
13057
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
13058
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
13059
+ </xsl:choose>
13060
+ </xsl:attribute>
13061
+
13062
+ <xsl:apply-templates mode="linear_xml"/>
13063
+ </xsl:copy>
13064
+ </xsl:template>
13065
+
13066
+ <!-- add @to = figure, table, clause -->
13067
+ <!-- add @depth = from -->
13068
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
13069
+ <xsl:copy>
13070
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13071
+ <xsl:variable name="target" select="@target"/>
13072
+ <xsl:attribute name="to">
13073
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
13074
+ </xsl:attribute>
13075
+ <xsl:attribute name="depth">
13076
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
13077
+ </xsl:attribute>
13078
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13079
+ </xsl:copy>
13080
+ </xsl:template>
13081
+
13082
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
13083
+ <xsl:choose>
13084
+ <xsl:when test="contains(., $non_breaking_hyphen)">
13085
+ <xsl:call-template name="replaceChar">
13086
+ <xsl:with-param name="text" select="."/>
13087
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
13088
+ <xsl:with-param name="by" select="'-'"/>
13089
+ </xsl:call-template>
13090
+ </xsl:when>
13091
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
13092
+ </xsl:choose>
13093
+ </xsl:template>
13094
+
13095
+ <xsl:template name="replaceChar">
13096
+ <xsl:param name="text"/>
13097
+ <xsl:param name="replace"/>
13098
+ <xsl:param name="by"/>
13099
+ <xsl:choose>
13100
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
13101
+ <xsl:value-of select="$text"/>
13102
+ </xsl:when>
13103
+ <xsl:when test="contains($text, $replace)">
13104
+ <xsl:value-of select="substring-before($text,$replace)"/>
13105
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
13106
+ <xsl:call-template name="replaceChar">
13107
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
13108
+ <xsl:with-param name="replace" select="$replace"/>
13109
+ <xsl:with-param name="by" select="$by"/>
13110
+ </xsl:call-template>
13111
+ </xsl:when>
13112
+ <xsl:otherwise>
13113
+ <xsl:value-of select="$text"/>
13114
+ </xsl:otherwise>
13115
+ </xsl:choose>
13116
+ </xsl:template>
13117
+
13118
+ <xsl:template match="*[local-name() = 'inlineChar']">
13119
+ <fo:inline><xsl:value-of select="."/></fo:inline>
13120
+ </xsl:template>
13121
+
13122
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
13123
+ <!--
13124
+ <fn reference="1">
13125
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13126
+ </fn>
13127
+ -->
13128
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
13129
+ <xsl:variable name="p_fn_">
13130
+ <xsl:call-template name="get_fn_list"/>
13131
+ </xsl:variable>
13132
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
13133
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
13134
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
13135
+ <xsl:variable name="reference" select="@reference"/>
13136
+ <!-- fn sequence number in document -->
13137
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
13138
+
13139
+ <xsl:copy>
13140
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13141
+ <!-- put actual reference number -->
13142
+ <xsl:attribute name="current_fn_number">
13143
+ <xsl:value-of select="$current_fn_number"/>
13144
+ </xsl:attribute>
13145
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
13146
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
13147
+ </xsl:attribute>
13148
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13149
+ </xsl:copy>
13150
+ </xsl:template>
13151
+
13152
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
13153
+ <xsl:copy>
13154
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13155
+ <xsl:if test="@depth = '1'">
13156
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13157
+ </xsl:if>
13158
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13159
+ </xsl:copy>
13160
+ </xsl:template>
13161
+ <!-- ===================================== -->
13162
+ <!-- ===================================== -->
13163
+ <!-- END: Make linear XML (need for landscape orientation) -->
13164
+ <!-- ===================================== -->
13165
+ <!-- ===================================== -->
13166
+
12924
13167
  <!-- for correct rendering combining chars -->
12925
13168
  <xsl:template match="*[local-name() = 'lang_none']">
12926
13169
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
@@ -2742,10 +2742,6 @@
2742
2742
  </xsl:choose>
2743
2743
  </xsl:template>
2744
2744
 
2745
- <xsl:template match="*[local-name() = 'inlineChar']">
2746
- <fo:inline><xsl:value-of select="."/></fo:inline>
2747
- </xsl:template>
2748
-
2749
2745
  <!--
2750
2746
  <xsl:variable name="example_name_width">25</xsl:variable>
2751
2747
  <xsl:template match="ieee:termexample" priority="2">
@@ -3710,29 +3706,6 @@
3710
3706
  <!-- End Back Pages -->
3711
3707
  <!-- =============================== -->
3712
3708
 
3713
- <xsl:template name="replaceChar">
3714
- <xsl:param name="text"/>
3715
- <xsl:param name="replace"/>
3716
- <xsl:param name="by"/>
3717
- <xsl:choose>
3718
- <xsl:when test="$text = '' or $replace = '' or not($replace)">
3719
- <xsl:value-of select="$text"/>
3720
- </xsl:when>
3721
- <xsl:when test="contains($text, $replace)">
3722
- <xsl:value-of select="substring-before($text,$replace)"/>
3723
- <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/ieee"><xsl:value-of select="$by"/></xsl:element>
3724
- <xsl:call-template name="replaceChar">
3725
- <xsl:with-param name="text" select="substring-after($text,$replace)"/>
3726
- <xsl:with-param name="replace" select="$replace"/>
3727
- <xsl:with-param name="by" select="$by"/>
3728
- </xsl:call-template>
3729
- </xsl:when>
3730
- <xsl:otherwise>
3731
- <xsl:value-of select="$text"/>
3732
- </xsl:otherwise>
3733
- </xsl:choose>
3734
- </xsl:template>
3735
-
3736
3709
  <xsl:strip-space elements="ieee:xref"/>
3737
3710
 
3738
3711
  <!-- external parameters -->
@@ -4544,6 +4517,7 @@
4544
4517
  <xsl:attribute-set name="term-name-style">
4545
4518
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4546
4519
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4520
+
4547
4521
  </xsl:attribute-set>
4548
4522
 
4549
4523
  <xsl:attribute-set name="figure-block-style">
@@ -5509,7 +5483,7 @@
5509
5483
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5510
5484
  </xsl:when>
5511
5485
  <xsl:otherwise>
5512
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
5486
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
5513
5487
  </xsl:otherwise>
5514
5488
  </xsl:choose>
5515
5489
 
@@ -6000,7 +5974,7 @@
6000
5974
  <xsl:param name="colwidths"/>
6001
5975
  <xsl:param name="colgroup"/>
6002
5976
 
6003
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
5977
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
6004
5978
 
6005
5979
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6006
5980
 
@@ -6068,6 +6042,7 @@
6068
6042
 
6069
6043
  <!-- except gb and bsi -->
6070
6044
 
6045
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
6071
6046
  <xsl:apply-templates select="../*[local-name()='note']"/>
6072
6047
 
6073
6048
  <xsl:variable name="isDisplayRowSeparator">
@@ -6235,7 +6210,7 @@
6235
6210
  <!-- ===================== -->
6236
6211
  <!-- Table's row processing -->
6237
6212
  <!-- ===================== -->
6238
- <!-- row in table header (thead) -->
6213
+ <!-- row in table header (thead) thead/tr -->
6239
6214
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6240
6215
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6241
6216
 
@@ -6276,7 +6251,7 @@
6276
6251
  </xsl:choose>
6277
6252
  </xsl:template>
6278
6253
 
6279
- <!-- row in table footer (tfoot) -->
6254
+ <!-- row in table footer (tfoot), tfoot/tr -->
6280
6255
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6281
6256
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
6282
6257
 
@@ -6772,6 +6747,8 @@
6772
6747
  <!-- <dl><xsl:copy-of select="."/></dl> -->
6773
6748
  <fo:block-container>
6774
6749
 
6750
+ <xsl:call-template name="setBlockSpanAll"/>
6751
+
6775
6752
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
6776
6753
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
6777
6754
  </xsl:if>
@@ -8848,13 +8825,17 @@
8848
8825
  </xsl:template>
8849
8826
 
8850
8827
  <xsl:template match="*[local-name() = 'callout']">
8851
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
8828
+ <xsl:choose>
8829
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
8830
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8831
+ </xsl:choose>
8852
8832
  </xsl:template>
8853
8833
 
8854
8834
  <xsl:template match="*[local-name() = 'annotation']">
8855
8835
  <xsl:variable name="annotation-id" select="@id"/>
8856
8836
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
8857
8837
  <fo:block id="{$annotation-id}" white-space="nowrap">
8838
+
8858
8839
  <fo:inline>
8859
8840
  <xsl:apply-templates>
8860
8841
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -8959,6 +8940,10 @@
8959
8940
  <!-- ====== -->
8960
8941
  <!-- ====== -->
8961
8942
 
8943
+ <xsl:template name="setBlockSpanAll">
8944
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
8945
+ </xsl:template>
8946
+
8962
8947
  <!-- ====== -->
8963
8948
  <!-- note -->
8964
8949
  <!-- termnote -->
@@ -8968,6 +8953,8 @@
8968
8953
 
8969
8954
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
8970
8955
 
8956
+ <xsl:call-template name="setBlockSpanAll"/>
8957
+
8971
8958
  <fo:block-container margin-left="0mm" margin-right="0mm">
8972
8959
 
8973
8960
  <fo:block>
@@ -9018,6 +9005,8 @@
9018
9005
  <xsl:template match="*[local-name() = 'termnote']">
9019
9006
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
9020
9007
 
9008
+ <xsl:call-template name="setBlockSpanAll"/>
9009
+
9021
9010
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9022
9011
 
9023
9012
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -10936,6 +10925,9 @@
10936
10925
  <!-- ====== -->
10937
10926
  <xsl:template match="*[local-name() = 'termexample']">
10938
10927
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
10928
+
10929
+ <xsl:call-template name="setBlockSpanAll"/>
10930
+
10939
10931
  <xsl:apply-templates select="*[local-name()='name']"/>
10940
10932
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10941
10933
  </fo:block>
@@ -10991,6 +10983,8 @@
10991
10983
 
10992
10984
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
10993
10985
 
10986
+ <xsl:call-template name="setBlockSpanAll"/>
10987
+
10994
10988
  <xsl:variable name="fo_element">
10995
10989
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10996
10990
  block
@@ -11018,6 +11012,35 @@
11018
11012
  </fo:block-container>
11019
11013
  </xsl:when> <!-- end block -->
11020
11014
 
11015
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11016
+
11017
+ <xsl:variable name="provisional_distance_between_starts">
11018
+ 7
11019
+ </xsl:variable>
11020
+ <xsl:variable name="indent">
11021
+ 0
11022
+ </xsl:variable>
11023
+
11024
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11025
+ <fo:list-item>
11026
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11027
+ <fo:block>
11028
+ <xsl:apply-templates select="*[local-name()='name']">
11029
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11030
+ </xsl:apply-templates>
11031
+ </fo:block>
11032
+ </fo:list-item-label>
11033
+ <fo:list-item-body start-indent="body-start()">
11034
+ <fo:block>
11035
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11036
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11037
+ </xsl:apply-templates>
11038
+ </fo:block>
11039
+ </fo:list-item-body>
11040
+ </fo:list-item>
11041
+ </fo:list-block>
11042
+ </xsl:when> <!-- end list -->
11043
+
11021
11044
  <xsl:otherwise> <!-- inline -->
11022
11045
 
11023
11046
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -11097,6 +11120,11 @@
11097
11120
  </fo:block>
11098
11121
  </fo:block-container>
11099
11122
  </xsl:when>
11123
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
11124
+ <fo:block xsl:use-attribute-sets="example-p-style">
11125
+ <xsl:apply-templates/>
11126
+ </fo:block>
11127
+ </xsl:when>
11100
11128
  <xsl:otherwise>
11101
11129
  <fo:inline xsl:use-attribute-sets="example-p-style">
11102
11130
  <xsl:apply-templates/>
@@ -11214,6 +11242,9 @@
11214
11242
  <!-- ====== -->
11215
11243
  <xsl:template match="*[local-name() = 'quote']">
11216
11244
  <fo:block-container margin-left="0mm">
11245
+
11246
+ <xsl:call-template name="setBlockSpanAll"/>
11247
+
11217
11248
  <xsl:if test="parent::*[local-name() = 'note']">
11218
11249
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
11219
11250
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -11499,6 +11530,8 @@
11499
11530
  <fo:block>
11500
11531
  <xsl:call-template name="setId"/>
11501
11532
 
11533
+ <xsl:call-template name="setBlockSpanAll"/>
11534
+
11502
11535
  <xsl:apply-templates/>
11503
11536
  </fo:block>
11504
11537
  </xsl:template>
@@ -11513,6 +11546,8 @@
11513
11546
  <fo:block break-after="page"/>
11514
11547
  <fo:block id="{@id}">
11515
11548
 
11549
+ <xsl:call-template name="setBlockSpanAll"/>
11550
+
11516
11551
  </fo:block>
11517
11552
  <xsl:apply-templates/>
11518
11553
  </xsl:template>
@@ -12489,6 +12524,8 @@
12489
12524
  <!-- text in the box -->
12490
12525
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
12491
12526
 
12527
+ <xsl:call-template name="setBlockSpanAll"/>
12528
+
12492
12529
  <xsl:if test="@type = 'editorial'">
12493
12530
  <xsl:attribute name="border">none</xsl:attribute>
12494
12531
  <!-- <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -12700,6 +12737,16 @@
12700
12737
  <xsl:apply-templates mode="update_xml_step1"/>
12701
12738
  </xsl:copy>
12702
12739
  </xsl:template>
12740
+
12741
+ <!-- remove semantic xml -->
12742
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12743
+
12744
+ <!-- remove image/emf -->
12745
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12746
+
12747
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
12748
+ <xsl:copy-of select="."/>
12749
+ </xsl:template>
12703
12750
  <!-- =========================================================================== -->
12704
12751
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12705
12752
  <!-- =========================================================================== -->
@@ -12800,6 +12847,10 @@
12800
12847
  </xsl:call-template>
12801
12848
  </xsl:template>
12802
12849
 
12850
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step2">
12851
+ <xsl:copy-of select="."/>
12852
+ </xsl:template>
12853
+
12803
12854
  <!-- =========================================================================== -->
12804
12855
  <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12805
12856
  <!-- =========================================================================== -->
@@ -12821,7 +12872,7 @@
12821
12872
 
12822
12873
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12823
12874
 
12824
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12875
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12825
12876
 
12826
12877
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12827
12878
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -12895,6 +12946,10 @@
12895
12946
 
12896
12947
  </xsl:template>
12897
12948
 
12949
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
12950
+ <xsl:copy-of select="."/>
12951
+ </xsl:template>
12952
+
12898
12953
  <xsl:template name="replace_text_tags">
12899
12954
  <xsl:param name="tag_open"/>
12900
12955
  <xsl:param name="tag_close"/>
@@ -12921,6 +12976,194 @@
12921
12976
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12922
12977
  <!-- ===================================== -->
12923
12978
 
12979
+ <!-- ===================================== -->
12980
+ <!-- ===================================== -->
12981
+ <!-- Make linear XML (need for landscape orientation) -->
12982
+ <!-- ===================================== -->
12983
+ <!-- ===================================== -->
12984
+ <xsl:template match="@*|node()" mode="linear_xml">
12985
+ <xsl:copy>
12986
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
12987
+ </xsl:copy>
12988
+ </xsl:template>
12989
+
12990
+ <xsl:template match="processing-instruction()" mode="linear_xml">
12991
+ <xsl:copy-of select="."/>
12992
+ </xsl:template>
12993
+
12994
+ <!-- From:
12995
+ <clause>
12996
+ <title>...</title>
12997
+ <p>...</p>
12998
+ </clause>
12999
+ To:
13000
+ <clause/>
13001
+ <title>...</title>
13002
+ <p>...</p>
13003
+ -->
13004
+ <xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
13005
+
13006
+ <xsl:copy>
13007
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13008
+
13009
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13010
+
13011
+ <xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
13012
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13013
+ </xsl:if>
13014
+ </xsl:copy>
13015
+
13016
+ <xsl:apply-templates mode="linear_xml"/>
13017
+ </xsl:template>
13018
+
13019
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
13020
+ <xsl:copy>
13021
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13022
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13023
+ <xsl:variable name="level">
13024
+ <xsl:call-template name="getLevel"/>
13025
+ </xsl:variable>
13026
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13027
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
13028
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
13029
+ </xsl:copy>
13030
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
13031
+ </xsl:template>
13032
+
13033
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
13034
+ <xsl:copy>
13035
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13036
+
13037
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13038
+
13039
+ <xsl:variable name="level">
13040
+ <xsl:call-template name="getLevel"/>
13041
+ </xsl:variable>
13042
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
13043
+
13044
+ <xsl:if test="parent::*[local-name() = 'annex']">
13045
+ <xsl:attribute name="depth">1</xsl:attribute>
13046
+ </xsl:if>
13047
+
13048
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
13049
+ <xsl:copy-of select="../@inline-header"/>
13050
+ </xsl:if>
13051
+
13052
+ <xsl:attribute name="ancestor">
13053
+ <xsl:choose>
13054
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
13055
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
13056
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
13057
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
13058
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
13059
+ </xsl:choose>
13060
+ </xsl:attribute>
13061
+
13062
+ <xsl:apply-templates mode="linear_xml"/>
13063
+ </xsl:copy>
13064
+ </xsl:template>
13065
+
13066
+ <!-- add @to = figure, table, clause -->
13067
+ <!-- add @depth = from -->
13068
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
13069
+ <xsl:copy>
13070
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13071
+ <xsl:variable name="target" select="@target"/>
13072
+ <xsl:attribute name="to">
13073
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
13074
+ </xsl:attribute>
13075
+ <xsl:attribute name="depth">
13076
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
13077
+ </xsl:attribute>
13078
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13079
+ </xsl:copy>
13080
+ </xsl:template>
13081
+
13082
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
13083
+ <xsl:choose>
13084
+ <xsl:when test="contains(., $non_breaking_hyphen)">
13085
+ <xsl:call-template name="replaceChar">
13086
+ <xsl:with-param name="text" select="."/>
13087
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
13088
+ <xsl:with-param name="by" select="'-'"/>
13089
+ </xsl:call-template>
13090
+ </xsl:when>
13091
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
13092
+ </xsl:choose>
13093
+ </xsl:template>
13094
+
13095
+ <xsl:template name="replaceChar">
13096
+ <xsl:param name="text"/>
13097
+ <xsl:param name="replace"/>
13098
+ <xsl:param name="by"/>
13099
+ <xsl:choose>
13100
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
13101
+ <xsl:value-of select="$text"/>
13102
+ </xsl:when>
13103
+ <xsl:when test="contains($text, $replace)">
13104
+ <xsl:value-of select="substring-before($text,$replace)"/>
13105
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
13106
+ <xsl:call-template name="replaceChar">
13107
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
13108
+ <xsl:with-param name="replace" select="$replace"/>
13109
+ <xsl:with-param name="by" select="$by"/>
13110
+ </xsl:call-template>
13111
+ </xsl:when>
13112
+ <xsl:otherwise>
13113
+ <xsl:value-of select="$text"/>
13114
+ </xsl:otherwise>
13115
+ </xsl:choose>
13116
+ </xsl:template>
13117
+
13118
+ <xsl:template match="*[local-name() = 'inlineChar']">
13119
+ <fo:inline><xsl:value-of select="."/></fo:inline>
13120
+ </xsl:template>
13121
+
13122
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
13123
+ <!--
13124
+ <fn reference="1">
13125
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13126
+ </fn>
13127
+ -->
13128
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
13129
+ <xsl:variable name="p_fn_">
13130
+ <xsl:call-template name="get_fn_list"/>
13131
+ </xsl:variable>
13132
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
13133
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
13134
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
13135
+ <xsl:variable name="reference" select="@reference"/>
13136
+ <!-- fn sequence number in document -->
13137
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
13138
+
13139
+ <xsl:copy>
13140
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13141
+ <!-- put actual reference number -->
13142
+ <xsl:attribute name="current_fn_number">
13143
+ <xsl:value-of select="$current_fn_number"/>
13144
+ </xsl:attribute>
13145
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
13146
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
13147
+ </xsl:attribute>
13148
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13149
+ </xsl:copy>
13150
+ </xsl:template>
13151
+
13152
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
13153
+ <xsl:copy>
13154
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
13155
+ <xsl:if test="@depth = '1'">
13156
+ <xsl:attribute name="mainsection">true</xsl:attribute>
13157
+ </xsl:if>
13158
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
13159
+ </xsl:copy>
13160
+ </xsl:template>
13161
+ <!-- ===================================== -->
13162
+ <!-- ===================================== -->
13163
+ <!-- END: Make linear XML (need for landscape orientation) -->
13164
+ <!-- ===================================== -->
13165
+ <!-- ===================================== -->
13166
+
12924
13167
  <!-- for correct rendering combining chars -->
12925
13168
  <xsl:template match="*[local-name() = 'lang_none']">
12926
13169
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
@@ -218,10 +218,23 @@ module IsoDoc
218
218
  map["company"] || map["name"] || "#{map['given']} #{map['surname']}"
219
219
  end
220
220
 
221
+ def asciimath_dup(node)
222
+ @suppressasciimathdup and return
223
+ super
224
+ node.parent.at(ns("./latexmath")) and return
225
+ math = node.to_xml.gsub(/ xmlns=["'][^"']+["']/, "")
226
+ .gsub(%r{<[^:/]+:}, "<").gsub(%r{</[^:/]+:}, "</")
227
+ ret = Plurimath::Math.parse(math, "mathml").to_latex
228
+ ret = HTMLEntities.new.encode(ret, :basic)
229
+ node.next = "<latexmath>#{ret}</latexmath>"
230
+ rescue StandardError => e
231
+ warn "Failure to convert MathML to LaTeX\n#{node.parent.to_xml}\n#{e}"
232
+ end
233
+
221
234
  def formula_where(dlist)
222
- dlist or return
223
- dlist["class"] = "formula_dl"
224
- end
235
+ dlist or return
236
+ dlist["class"] = "formula_dl"
237
+ end
225
238
 
226
239
  include Init
227
240
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.0.7".freeze
3
+ VERSION = "1.0.8".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.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-13 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc