metanorma-ieee 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <!-- mandatory 'key' -->
6
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
6
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
7
7
 
8
8
  <!-- mandatory variable -->
9
9
 
@@ -40,7 +40,7 @@
40
40
  <!-- mandatory variable -->
41
41
  <xsl:variable name="ids">
42
42
  <xsl:for-each select="//*[@id]">
43
- <id><xsl:value-of select="@id"/></id>
43
+ <id name="{local-name()}"><xsl:value-of select="@id"/></id>
44
44
  </xsl:for-each>
45
45
  </xsl:variable>
46
46
 
@@ -548,6 +548,8 @@
548
548
 
549
549
  <fo:block break-after="page"/>
550
550
 
551
+ <!-- Second page -->
552
+
551
553
  <fo:block font-family="Arial" text-align="justify">
552
554
  <fo:block>
553
555
  <fo:inline font-weight="bold">
@@ -566,6 +568,7 @@
566
568
  <xsl:if test="position() != last()">, </xsl:if>
567
569
  </xsl:for-each>
568
570
  </fo:block>
571
+ <xsl:apply-templates select="/ieee:ieee-standard/ieee:preface/ieee:acknowledgements"/>
569
572
  </fo:block>
570
573
 
571
574
  <!-- Example:
@@ -728,6 +731,7 @@
728
731
  <xsl:if test="position() != last()">, </xsl:if>
729
732
  </xsl:for-each>
730
733
  </fo:block>
734
+ <xsl:apply-templates select="/ieee:ieee-standard/ieee:preface/ieee:acknowledgements"/>
731
735
  </fo:block>
732
736
 
733
737
  <!-- Example:
@@ -1597,6 +1601,12 @@
1597
1601
  <fo:inline><xsl:apply-templates/></fo:inline>
1598
1602
  </xsl:template>
1599
1603
 
1604
+ <xsl:template match="ieee:preface/ieee:acknowledgements" priority="3">
1605
+ <fo:block>
1606
+ <xsl:apply-templates/>
1607
+ </fo:block>
1608
+ </xsl:template>
1609
+
1600
1610
  <xsl:template match="text()" priority="2" mode="uppercase">
1601
1611
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
1602
1612
  </xsl:template>
@@ -2301,6 +2311,7 @@
2301
2311
  <xsl:otherwise>
2302
2312
  <xsl:choose>
2303
2313
  <xsl:when test="@type = 'section-title'">12pt</xsl:when>
2314
+ <xsl:when test="ancestor::ieee:acknowledgements">inherit</xsl:when>
2304
2315
  <xsl:when test="$level = 1">12pt</xsl:when>
2305
2316
  <xsl:when test="$level = 2">11pt</xsl:when>
2306
2317
  <xsl:otherwise>10pt</xsl:otherwise> <!-- 3rd, 4th, ... levels -->
@@ -2804,7 +2815,7 @@
2804
2815
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2805
2816
 
2806
2817
  <!-- no highlight term's names -->
2807
- <xsl:if test="normalize-space() != '' and string-length(normalize-space()) = string-length(translate(normalize-space(), '0123456789', '')) and not(contains(normalize-space(), 'Annex'))">
2818
+ <xsl:if test="normalize-space() != '' and xalan:nodeset($ids)/id[. = current()/@target]/@name = 'term'"> <!-- string-length(normalize-space()) = string-length(translate(normalize-space(), '0123456789', '')) and not(contains(normalize-space(), 'Annex')) -->
2808
2819
  <xsl:attribute name="color">inherit</xsl:attribute>
2809
2820
  <xsl:attribute name="text-decoration">none</xsl:attribute>
2810
2821
  </xsl:if>
@@ -3722,6 +3733,8 @@
3722
3733
  </xsl:choose>
3723
3734
  </xsl:template>
3724
3735
 
3736
+ <xsl:strip-space elements="ieee:xref"/>
3737
+
3725
3738
  <!-- external parameters -->
3726
3739
 
3727
3740
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -4257,6 +4270,7 @@
4257
4270
 
4258
4271
  1pt solid black
4259
4272
 
4273
+
4260
4274
  </xsl:variable>
4261
4275
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4262
4276
 
@@ -5125,17 +5139,22 @@
5125
5139
  </xsl:for-each>
5126
5140
  </xsl:template>
5127
5141
 
5142
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5128
5143
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
5129
5144
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
5130
5145
  <xsl:template match="text()" name="text">
5131
5146
 
5132
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5133
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
5134
- <xsl:call-template name="replace_fo_inline_tags">
5135
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
5136
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
5137
- <xsl:with-param name="text" select="$text"/>
5138
- </xsl:call-template>
5147
+ <xsl:choose>
5148
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
5149
+ <xsl:otherwise>
5150
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
5151
+ <xsl:call-template name="replace_fo_inline_tags">
5152
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
5153
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
5154
+ <xsl:with-param name="text" select="$text"/>
5155
+ </xsl:call-template>
5156
+ </xsl:otherwise>
5157
+ </xsl:choose>
5139
5158
 
5140
5159
  </xsl:template>
5141
5160
 
@@ -6214,7 +6233,7 @@
6214
6233
  <xsl:template match="*[local-name()='tr']">
6215
6234
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6216
6235
 
6217
- <xsl:if test="*[local-name() = 'th']">
6236
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
6218
6237
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6219
6238
  </xsl:if>
6220
6239
 
@@ -7193,7 +7212,8 @@
7193
7212
  <xsl:copy-of select="node()"/>
7194
7213
  </td>
7195
7214
  <td>
7196
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
7215
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
7216
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
7197
7217
  <!-- get paragraphs from nested 'dl' -->
7198
7218
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7199
7219
  </td>
@@ -7201,6 +7221,53 @@
7201
7221
  </xsl:template>
7202
7222
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
7203
7223
 
7224
+ <xsl:template match="*" mode="dl_if">
7225
+ <xsl:copy-of select="."/>
7226
+ </xsl:template>
7227
+
7228
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
7229
+ <xsl:param name="indent"/>
7230
+ <p>
7231
+ <xsl:copy-of select="@*"/>
7232
+ <xsl:value-of select="$indent"/>
7233
+ <xsl:copy-of select="node()"/>
7234
+ </p>
7235
+
7236
+ </xsl:template>
7237
+
7238
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
7239
+ <xsl:variable name="list_rendered_">
7240
+ <xsl:apply-templates select="."/>
7241
+ </xsl:variable>
7242
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
7243
+
7244
+ <xsl:variable name="indent">
7245
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
7246
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
7247
+ </xsl:for-each>
7248
+ </xsl:variable>
7249
+
7250
+ <xsl:apply-templates mode="dl_if">
7251
+ <xsl:with-param name="indent" select="$indent"/>
7252
+ </xsl:apply-templates>
7253
+ </xsl:template>
7254
+
7255
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
7256
+ <xsl:param name="indent"/>
7257
+ <xsl:apply-templates mode="dl_if">
7258
+ <xsl:with-param name="indent" select="$indent"/>
7259
+ </xsl:apply-templates>
7260
+ </xsl:template>
7261
+
7262
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
7263
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
7264
+ <!-- emulate left indent for list item -->
7265
+ <xsl:call-template name="repeat">
7266
+ <xsl:with-param name="char" select="'x'"/>
7267
+ <xsl:with-param name="count" select="$value"/>
7268
+ </xsl:call-template>
7269
+ </xsl:template>
7270
+
7204
7271
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
7205
7272
  <xsl:for-each select="*[local-name() = 'dt']">
7206
7273
  <p>
@@ -7594,6 +7661,7 @@
7594
7661
  </word>
7595
7662
  <xsl:call-template name="tokenize_with_tags">
7596
7663
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
7664
+ <xsl:with-param name="tags" select="$tags"/>
7597
7665
  </xsl:call-template>
7598
7666
  </xsl:otherwise>
7599
7667
  </xsl:choose>
@@ -7633,8 +7701,18 @@
7633
7701
 
7634
7702
  <xsl:template name="add-zero-spaces-java">
7635
7703
  <xsl:param name="text" select="."/>
7636
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7637
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
7704
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
7705
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
7706
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
7707
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
7708
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
7709
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
7710
+ <!-- add zero-width space (#x200B) before character: { -->
7711
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7712
+ <!-- add zero-width space (#x200B) after character: , -->
7713
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7714
+
7715
+ <xsl:value-of select="$text5"/>
7638
7716
  </xsl:template>
7639
7717
 
7640
7718
  <xsl:template name="add-zero-spaces-link-java">
@@ -7780,7 +7858,7 @@
7780
7858
  </xsl:copy>
7781
7859
  </xsl:template>
7782
7860
 
7783
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
7861
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
7784
7862
  <xsl:copy>
7785
7863
  <xsl:copy-of select="@*"/>
7786
7864
  <p>
@@ -7828,6 +7906,28 @@
7828
7906
  </xsl:for-each>
7829
7907
  </xsl:template>
7830
7908
 
7909
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
7910
+ <xsl:apply-templates mode="table-without-br"/>
7911
+ </xsl:template>
7912
+
7913
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
7914
+
7915
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
7916
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
7917
+ <xsl:variable name="items">
7918
+ <xsl:call-template name="split">
7919
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
7920
+ <xsl:with-param name="sep" select="$sep"/>
7921
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
7922
+ </xsl:call-template>
7923
+ </xsl:variable>
7924
+ <xsl:for-each select="xalan:nodeset($items)/*">
7925
+ <p>
7926
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
7927
+ </p>
7928
+ </xsl:for-each>
7929
+ </xsl:template>
7930
+
7831
7931
  <!-- remove redundant white spaces -->
7832
7932
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
7833
7933
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -8138,6 +8238,7 @@
8138
8238
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
8139
8239
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
8140
8240
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
8241
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
8141
8242
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
8142
8243
  </tags>
8143
8244
  </xsl:template>
@@ -8635,6 +8736,12 @@
8635
8736
 
8636
8737
  <fo:block-container margin-left="0mm">
8637
8738
 
8739
+ <!-- <xsl:if test="$namespace = 'iho'">
8740
+ <xsl:if test="ancestor::iho:td">
8741
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
8742
+ </xsl:if>
8743
+ </xsl:if> -->
8744
+
8638
8745
  <fo:block>
8639
8746
 
8640
8747
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -9785,37 +9892,15 @@
9785
9892
  <!-- =============== -->
9786
9893
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9787
9894
 
9788
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
9789
-
9790
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
9791
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
9792
- </xsl:if>
9895
+ <xsl:variable name="sourcecode_attributes">
9896
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
9897
+ <xsl:variable name="_font-size">
9793
9898
 
9794
- <xsl:if test="ancestor::*[local-name() = 'example']">
9795
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
9796
- </xsl:if>
9899
+ <!-- 9 -->
9797
9900
 
9798
- <xsl:copy-of select="@id"/>
9799
-
9800
- <xsl:if test="parent::*[local-name() = 'note']">
9801
- <xsl:attribute name="margin-left">
9802
- <xsl:choose>
9803
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
9804
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
9805
- </xsl:choose>
9806
- </xsl:attribute>
9807
-
9808
- </xsl:if>
9809
- <fo:block-container margin-left="0mm">
9810
-
9811
- <fo:block xsl:use-attribute-sets="sourcecode-style">
9812
- <xsl:variable name="_font-size">
9813
-
9814
- <!-- 9 -->
9815
-
9816
- <!-- <xsl:if test="$namespace = 'ieee'">
9817
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
9818
- </xsl:if> -->
9901
+ <!-- <xsl:if test="$namespace = 'ieee'">
9902
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
9903
+ </xsl:if> -->
9819
9904
 
9820
9905
  </xsl:variable>
9821
9906
 
@@ -9830,14 +9915,60 @@
9830
9915
  </xsl:choose>
9831
9916
  </xsl:attribute>
9832
9917
  </xsl:if>
9918
+ </xsl:element>
9919
+ </xsl:variable>
9833
9920
 
9921
+ <xsl:choose>
9922
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
9923
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
9924
+ <xsl:attribute name="{local-name()}">
9925
+ <xsl:value-of select="."/>
9926
+ </xsl:attribute>
9927
+ </xsl:for-each>
9834
9928
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9835
- </fo:block>
9929
+ </xsl:when>
9836
9930
 
9837
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
9931
+ <xsl:otherwise>
9932
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
9838
9933
 
9839
- </fo:block-container>
9840
- </fo:block-container>
9934
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
9935
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
9936
+ </xsl:if>
9937
+
9938
+ <xsl:if test="ancestor::*[local-name() = 'example']">
9939
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
9940
+ </xsl:if>
9941
+
9942
+ <xsl:copy-of select="@id"/>
9943
+
9944
+ <xsl:if test="parent::*[local-name() = 'note']">
9945
+ <xsl:attribute name="margin-left">
9946
+ <xsl:choose>
9947
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
9948
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
9949
+ </xsl:choose>
9950
+ </xsl:attribute>
9951
+
9952
+ </xsl:if>
9953
+ <fo:block-container margin-left="0mm">
9954
+
9955
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
9956
+
9957
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
9958
+ <xsl:attribute name="{local-name()}">
9959
+ <xsl:value-of select="."/>
9960
+ </xsl:attribute>
9961
+ </xsl:for-each>
9962
+
9963
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9964
+ </fo:block>
9965
+
9966
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
9967
+
9968
+ </fo:block-container>
9969
+ </fo:block-container>
9970
+ </xsl:otherwise>
9971
+ </xsl:choose>
9841
9972
  </xsl:template>
9842
9973
 
9843
9974
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -12125,7 +12256,9 @@
12125
12256
  <!-- ===================================== -->
12126
12257
  <!-- Update xml -->
12127
12258
  <!-- ===================================== -->
12259
+ <!-- =========================================================================== -->
12128
12260
  <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12261
+ <!-- =========================================================================== -->
12129
12262
  <xsl:template match="@*|node()" mode="update_xml_step1">
12130
12263
  <xsl:copy>
12131
12264
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -12217,10 +12350,13 @@
12217
12350
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12218
12351
  <xsl:apply-templates mode="update_xml_step1"/>
12219
12352
  </xsl:template>
12220
-
12353
+ <!-- =========================================================================== -->
12221
12354
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12355
+ <!-- =========================================================================== -->
12222
12356
 
12357
+ <!-- =========================================================================== -->
12223
12358
  <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12359
+ <!-- =========================================================================== -->
12224
12360
  <xsl:template match="@*|node()" mode="update_xml_step2">
12225
12361
  <xsl:copy>
12226
12362
  <xsl:apply-templates select="@*|node()" mode="update_xml_step2"/>
@@ -12299,8 +12435,6 @@
12299
12435
  </xsl:copy>
12300
12436
  </xsl:template>
12301
12437
 
12302
- <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12303
-
12304
12438
  <!-- enclose sequence of 'char x' + 'combining char y' to <lang_none>xy</lang_none> -->
12305
12439
  <xsl:variable name="regex_combining_chars">(.[̀-ͯ])</xsl:variable>
12306
12440
  <xsl:variable name="element_name_lang_none">lang_none</xsl:variable>
@@ -12316,7 +12450,15 @@
12316
12450
  </xsl:call-template>
12317
12451
  </xsl:template>
12318
12452
 
12453
+ <!-- =========================================================================== -->
12454
+ <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12455
+ <!-- =========================================================================== -->
12456
+
12457
+ <!-- =========================================================================== -->
12319
12458
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12459
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12460
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12461
+ <!-- =========================================================================== -->
12320
12462
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
12321
12463
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
12322
12464
  <xsl:copy>
@@ -12332,10 +12474,15 @@
12332
12474
  <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">
12333
12475
 
12334
12476
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12335
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
12336
12477
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12337
12478
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12338
- <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12479
+ <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12480
+ <xsl:variable name="text_">
12481
+ <xsl:choose>
12482
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
12483
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
12484
+ </xsl:choose>
12485
+ </xsl:variable>
12339
12486
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
12340
12487
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12341
12488
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -12351,7 +12498,11 @@
12351
12498
  </xsl:variable>
12352
12499
 
12353
12500
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12354
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
12501
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12502
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12503
+ <!-- add &lt; and &gt; to \S -->
12504
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
12505
+ <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
12355
12506
  <xsl:variable name="text3">
12356
12507
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
12357
12508
  <xsl:choose>
@@ -12415,9 +12566,8 @@
12415
12566
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
12416
12567
  </xsl:choose>
12417
12568
  </xsl:template>
12418
-
12419
12569
  <!-- ===================================== -->
12420
- <!-- End Update xml -->
12570
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12421
12571
  <!-- ===================================== -->
12422
12572
 
12423
12573
  <!-- for correct rendering combining chars -->
@@ -12,7 +12,7 @@ module IsoDoc
12
12
 
13
13
  def xref_init(lang, script, _klass, i18n, options)
14
14
  html = HtmlConvert.new(language: lang, script: script)
15
- options = options.merge(hierarchical_assets: @hierarchical_assets)
15
+ options = options.merge(hierarchicalassets: @hierarchical_assets)
16
16
  @xrefs = Xref.new(lang, script, html, i18n, options)
17
17
  end
18
18
 
@@ -1,3 +1,5 @@
1
+ require_relative "../../relaton/render/general"
2
+
1
3
  module IsoDoc
2
4
  module IEEE
3
5
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
@@ -1,5 +1,3 @@
1
- require_relative "../../relaton/render/general"
2
-
3
1
  module IsoDoc
4
2
  module IEEE
5
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
@@ -28,9 +26,7 @@ module IsoDoc
28
26
  if coll.all? do |c|
29
27
  c.elements.size == 1 && c.elements.first.name == "p"
30
28
  end
31
- ret = coll.map do |c|
32
- c.elements.first.children.to_xml
33
- end
29
+ ret = coll.map { |c| c.elements.first.children.to_xml }
34
30
  return "<p>#{ret.join}</p>"
35
31
  end
36
32
  coll.map { |c| c.children.to_xml }.join
@@ -61,9 +57,9 @@ module IsoDoc
61
57
  prev = 0
62
58
  coll[1..-1].each_with_index do |r, i|
63
59
  if coll[prev]["type"] != r["type"]
64
- prev = i
65
- next
60
+ prev = i and next
66
61
  end
62
+
67
63
  coll[prev].at(ns("./preferred")) << "; #{r.at(ns('./preferred'))
68
64
  .children.to_xml}"
69
65
  r.remove
@@ -81,8 +77,7 @@ module IsoDoc
81
77
  end
82
78
 
83
79
  def sort_terms_key1(elem)
84
- return "zzzz" if elem.nil?
85
-
80
+ elem.nil? and return "zzzz"
86
81
  dup = elem.dup
87
82
  dup.xpath(ns(".//asciimath | .//latexmath")).each(&:remove)
88
83
  dup.text&.strip&.downcase || "zzzz"
@@ -190,8 +185,7 @@ module IsoDoc
190
185
  opt[:source] and src = "(#{opt[:source].remove.children.to_xml.strip})"
191
186
  <<~TERM
192
187
  <p>#{opt[:pref]&.children&.to_xml || '**TERM NOT FOUND**'}: #{defn}
193
- #{collapse_term_related(opt[:rels])}
194
- #{src}</p>
188
+ #{collapse_term_related(opt[:rels])} #{src}</p>
195
189
  TERM
196
190
  end
197
191
 
@@ -7,7 +7,7 @@ module IsoDoc
7
7
  module IEEE
8
8
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
9
9
  def initialize(options)
10
- @hierarchical_assets = options[:hierarchical_assets]
10
+ @hierarchical_assets = options[:hierarchicalassets]
11
11
  super
12
12
  end
13
13
 
@@ -107,6 +107,14 @@ module IsoDoc
107
107
  FigureTitle: "IEEEStdsRegularFigureCaption",
108
108
  }.freeze
109
109
 
110
+ def table_toc_class
111
+ %w(IEEEStdsRegularTableCaption TableTitle tabletitle)
112
+ end
113
+
114
+ def figure_toc_class
115
+ %w(IEEEStdsRegularFigureCaption FigureTitle figuretitle)
116
+ end
117
+
110
118
  def style_cleanup(docxml)
111
119
  note_style_cleanup(docxml)
112
120
  docxml.xpath("//div[@class = 'formula']/p").each do |p|
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  class Xref < ::IsoDoc::Xref
9
9
  def initialize(lang, script, klass, labels, options)
10
10
  super
11
- @hierarchical_assets = options[:hierarchical_assets]
11
+ @hierarchical_assets = options[:hierarchicalassets]
12
12
  end
13
13
 
14
14
  def initial_anchor_names(doc)
@@ -29,7 +29,7 @@ module IsoDoc
29
29
  n = Counter.new
30
30
  n = section_names(doc.at(ns("//clause[@type = 'overview']")), n, 1)
31
31
  n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
32
- n = section_names(doc.at(ns("//sections/terms | "\
32
+ n = section_names(doc.at(ns("//sections/terms | " \
33
33
  "//sections/clause[descendant::terms]")), n, 1)
34
34
  n = section_names(doc.at(ns("//sections/definitions")), n, 1)
35
35
  clause_names(doc, n)
@@ -37,14 +37,14 @@ module IsoDoc
37
37
  end
38
38
 
39
39
  def middle_sections
40
- " #{@klass.norm_ref_xpath} | "\
41
- "//sections/terms | //preface/clause | "\
40
+ " #{@klass.norm_ref_xpath} | " \
41
+ "//sections/terms | //preface/clause | " \
42
42
  "//sections/definitions | //clause[parent::sections]"
43
43
  end
44
44
 
45
45
  def middle_section_asset_names(doc)
46
46
  middle_sections =
47
- "#{@klass.norm_ref_xpath} | //sections/terms | "\
47
+ "#{@klass.norm_ref_xpath} | //sections/terms | " \
48
48
  "//sections/definitions | //clause[parent::sections]"
49
49
  if @hierarchical_assets
50
50
  doc.xpath(ns(middle_sections)).each do |c|
@@ -57,9 +57,7 @@ module IsoDoc
57
57
 
58
58
  def sequential_formula_names(clause)
59
59
  c = Counter.new
60
- clause.xpath(ns(".//formula")).reject do |n|
61
- blank?(n["id"])
62
- end.each do |t|
60
+ clause.xpath(ns(".//formula")).noblank.each do |t|
63
61
  @anchors[t["id"]] = anchor_struct(
64
62
  c.increment(t).print, nil,
65
63
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
@@ -71,14 +69,12 @@ module IsoDoc
71
69
  def termnote_anchor_names(docxml)
72
70
  docxml.xpath(ns("//*[termnote]")).each do |t|
73
71
  c = Counter.new
74
- sequence = UUIDTools::UUID.random_create.to_s
75
72
  notes = t.xpath(ns("./termnote"))
76
- notes.reject { |n| blank?(n["id"]) }.each do |n|
73
+ notes.noblank.each do |n|
77
74
  @anchors[n["id"]] =
78
75
  anchor_struct("#{@labels['termnote']} #{increment_label(notes, n, c)}",
79
- n,
80
- @labels["note_xref"], "termnote", false)
81
- .merge(sequence: sequence)
76
+ n, @labels["note_xref"], "termnote", false)
77
+ .merge(sequence: UUIDTools::UUID.random_create.to_s)
82
78
  end
83
79
  end
84
80
  end
@@ -62,13 +62,13 @@ module Metanorma
62
62
  end
63
63
 
64
64
  def html_extract_attributes(node)
65
- super.merge(hierarchical_assets:
65
+ super.merge(hierarchicalassets:
66
66
  node.attr("hierarchical-object-numbering"),
67
67
  ieeedtd: node.attr("ieee-dtd"))
68
68
  end
69
69
 
70
70
  def doc_extract_attributes(node)
71
- super.merge(hierarchical_assets:
71
+ super.merge(hierarchicalassets:
72
72
  node.attr("hierarchical-object-numbering"),
73
73
  ulstyle: "l11", olstyle: "l16")
74
74
  end