metanorma-ieee 0.1.1 → 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 -->
@@ -4139,6 +4152,16 @@
4139
4152
 
4140
4153
  </xsl:attribute-set>
4141
4154
 
4155
+ <xsl:attribute-set name="pre-style">
4156
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4157
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4158
+
4159
+ <xsl:attribute name="margin-top">5pt</xsl:attribute>
4160
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
4161
+ <xsl:attribute name="font-size">95%</xsl:attribute>
4162
+
4163
+ </xsl:attribute-set>
4164
+
4142
4165
  <xsl:attribute-set name="permission-style">
4143
4166
 
4144
4167
  </xsl:attribute-set>
@@ -4246,9 +4269,16 @@
4246
4269
  <xsl:variable name="table-border_">
4247
4270
 
4248
4271
  1pt solid black
4272
+
4273
+
4249
4274
  </xsl:variable>
4250
4275
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
4251
4276
 
4277
+ <xsl:variable name="table-cell-border_">
4278
+
4279
+ </xsl:variable>
4280
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
4281
+
4252
4282
  <xsl:attribute-set name="table-container-style">
4253
4283
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4254
4284
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4262,8 +4292,6 @@
4262
4292
  <xsl:attribute-set name="table-style">
4263
4293
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4264
4294
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4265
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4266
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4267
4295
 
4268
4296
  <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
4269
4297
 
@@ -5111,17 +5139,22 @@
5111
5139
  </xsl:for-each>
5112
5140
  </xsl:template>
5113
5141
 
5142
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5114
5143
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
5115
5144
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
5116
5145
  <xsl:template match="text()" name="text">
5117
5146
 
5118
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
5119
- <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))"/>
5120
- <xsl:call-template name="replace_fo_inline_tags">
5121
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
5122
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
5123
- <xsl:with-param name="text" select="$text"/>
5124
- </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>
5125
5158
 
5126
5159
  </xsl:template>
5127
5160
 
@@ -5390,6 +5423,12 @@
5390
5423
  <xsl:variable name="table_attributes">
5391
5424
 
5392
5425
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
5426
+
5427
+ <xsl:if test="$margin-side != 0">
5428
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
5429
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
5430
+ </xsl:if>
5431
+
5393
5432
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5394
5433
 
5395
5434
  <xsl:if test="$current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report'">
@@ -6194,6 +6233,10 @@
6194
6233
  <xsl:template match="*[local-name()='tr']">
6195
6234
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
6196
6235
 
6236
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
6237
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
6238
+ </xsl:if>
6239
+
6197
6240
  <xsl:if test="ancestor::*[local-name() = 'feedback-statement']">
6198
6241
  <xsl:attribute name="min-height">0mm</xsl:attribute>
6199
6242
  </xsl:if>
@@ -7169,7 +7212,8 @@
7169
7212
  <xsl:copy-of select="node()"/>
7170
7213
  </td>
7171
7214
  <td>
7172
- <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"/>
7173
7217
  <!-- get paragraphs from nested 'dl' -->
7174
7218
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7175
7219
  </td>
@@ -7177,6 +7221,53 @@
7177
7221
  </xsl:template>
7178
7222
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
7179
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
+
7180
7271
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
7181
7272
  <xsl:for-each select="*[local-name() = 'dt']">
7182
7273
  <p>
@@ -7570,6 +7661,7 @@
7570
7661
  </word>
7571
7662
  <xsl:call-template name="tokenize_with_tags">
7572
7663
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
7664
+ <xsl:with-param name="tags" select="$tags"/>
7573
7665
  </xsl:call-template>
7574
7666
  </xsl:otherwise>
7575
7667
  </xsl:choose>
@@ -7609,8 +7701,18 @@
7609
7701
 
7610
7702
  <xsl:template name="add-zero-spaces-java">
7611
7703
  <xsl:param name="text" select="."/>
7612
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7613
- <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"/>
7614
7716
  </xsl:template>
7615
7717
 
7616
7718
  <xsl:template name="add-zero-spaces-link-java">
@@ -7756,7 +7858,7 @@
7756
7858
  </xsl:copy>
7757
7859
  </xsl:template>
7758
7860
 
7759
- <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">
7760
7862
  <xsl:copy>
7761
7863
  <xsl:copy-of select="@*"/>
7762
7864
  <p>
@@ -7804,6 +7906,28 @@
7804
7906
  </xsl:for-each>
7805
7907
  </xsl:template>
7806
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
+
7807
7931
  <!-- remove redundant white spaces -->
7808
7932
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
7809
7933
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -8114,6 +8238,7 @@
8114
8238
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
8115
8239
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
8116
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>
8117
8242
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
8118
8243
  </tags>
8119
8244
  </xsl:template>
@@ -8176,6 +8301,9 @@
8176
8301
  <xsl:value-of select="substring($str, 2)"/>
8177
8302
  </xsl:template>
8178
8303
 
8304
+ <!-- ======================================= -->
8305
+ <!-- math -->
8306
+ <!-- ======================================= -->
8179
8307
  <xsl:template match="mathml:math">
8180
8308
  <xsl:variable name="isAdded" select="@added"/>
8181
8309
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8226,14 +8354,59 @@
8226
8354
  <xsl:value-of select="$comment_text"/>
8227
8355
  </xsl:template>
8228
8356
 
8357
+ <xsl:template match="*[local-name() = 'asciimath']">
8358
+ <xsl:param name="process" select="'false'"/>
8359
+ <xsl:if test="$process = 'true'">
8360
+ <xsl:apply-templates/>
8361
+ </xsl:if>
8362
+ </xsl:template>
8363
+
8364
+ <xsl:template match="*[local-name() = 'latexmath']"/>
8365
+
8366
+ <xsl:template name="getMathml_asciimath_text">
8367
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
8368
+ <xsl:variable name="latexmath">
8369
+
8370
+ <xsl:value-of select="../*[local-name() = 'latexmath']"/>
8371
+
8372
+ </xsl:variable>
8373
+ <xsl:variable name="asciimath_text_following">
8374
+ <xsl:choose>
8375
+ <xsl:when test="normalize-space($latexmath) != ''">
8376
+ <xsl:value-of select="$latexmath"/>
8377
+ </xsl:when>
8378
+ <xsl:when test="normalize-space($asciimath) != ''">
8379
+ <xsl:value-of select="$asciimath"/>
8380
+ </xsl:when>
8381
+ <xsl:otherwise>
8382
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
8383
+ </xsl:otherwise>
8384
+ </xsl:choose>
8385
+ </xsl:variable>
8386
+ <xsl:variable name="asciimath_text_">
8387
+ <xsl:choose>
8388
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
8389
+ <xsl:value-of select="$asciimath_text_following"/>
8390
+ </xsl:when>
8391
+ <xsl:otherwise>
8392
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
8393
+ </xsl:otherwise>
8394
+ </xsl:choose>
8395
+ </xsl:variable>
8396
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
8397
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
8398
+ <xsl:value-of select="$asciimath_text"/>
8399
+ </xsl:template>
8400
+
8229
8401
  <xsl:template name="mathml_instream_object">
8230
- <xsl:param name="comment_text"/>
8402
+ <xsl:param name="asciimath_text"/>
8231
8403
  <xsl:param name="mathml_content"/>
8232
8404
 
8233
- <xsl:variable name="comment_text_">
8405
+ <xsl:variable name="asciimath_text_">
8234
8406
  <xsl:choose>
8235
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
8236
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
8407
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
8408
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
8409
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
8237
8410
  </xsl:choose>
8238
8411
  </xsl:variable>
8239
8412
 
@@ -8250,10 +8423,10 @@
8250
8423
  </xsl:attribute>
8251
8424
 
8252
8425
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8253
- <xsl:if test="normalize-space($comment_text_) != ''">
8426
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8254
8427
  <!-- put Mathin Alternate Text -->
8255
8428
  <xsl:attribute name="fox:alt-text">
8256
- <xsl:value-of select="$comment_text_"/>
8429
+ <xsl:value-of select="$asciimath_text_"/>
8257
8430
  </xsl:attribute>
8258
8431
  </xsl:if>
8259
8432
  <!-- </xsl:if> -->
@@ -8326,6 +8499,29 @@
8326
8499
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8327
8500
  </xsl:template>
8328
8501
 
8502
+ <!-- Examples:
8503
+ <stem type="AsciiMath">x = 1</stem>
8504
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
8505
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
8506
+ -->
8507
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8508
+ <fo:inline xsl:use-attribute-sets="mathml-style">
8509
+
8510
+ <xsl:choose>
8511
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
8512
+ <xsl:otherwise>
8513
+ <xsl:apply-templates>
8514
+ <xsl:with-param name="process">true</xsl:with-param>
8515
+ </xsl:apply-templates>
8516
+ </xsl:otherwise>
8517
+ </xsl:choose>
8518
+
8519
+ </fo:inline>
8520
+ </xsl:template>
8521
+ <!-- ======================================= -->
8522
+ <!-- END: math -->
8523
+ <!-- ======================================= -->
8524
+
8329
8525
  <xsl:template match="*[local-name()='localityStack']"/>
8330
8526
 
8331
8527
  <xsl:template match="*[local-name()='link']" name="link">
@@ -8540,6 +8736,12 @@
8540
8736
 
8541
8737
  <fo:block-container margin-left="0mm">
8542
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
+
8543
8745
  <fo:block>
8544
8746
 
8545
8747
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -9685,42 +9887,20 @@
9685
9887
  <xsl:apply-templates mode="contents_item"/>
9686
9888
  </xsl:template>
9687
9889
 
9688
- <!-- ====== -->
9689
- <!-- sourcecode -->
9690
- <!-- ====== -->
9890
+ <!-- =============== -->
9891
+ <!-- sourcecode -->
9892
+ <!-- =============== -->
9691
9893
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9692
9894
 
9693
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
9694
-
9695
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
9696
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
9697
- </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">
9698
9898
 
9699
- <xsl:if test="ancestor::*[local-name() = 'example']">
9700
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
9701
- </xsl:if>
9899
+ <!-- 9 -->
9702
9900
 
9703
- <xsl:copy-of select="@id"/>
9704
-
9705
- <xsl:if test="parent::*[local-name() = 'note']">
9706
- <xsl:attribute name="margin-left">
9707
- <xsl:choose>
9708
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
9709
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
9710
- </xsl:choose>
9711
- </xsl:attribute>
9712
-
9713
- </xsl:if>
9714
- <fo:block-container margin-left="0mm">
9715
-
9716
- <fo:block xsl:use-attribute-sets="sourcecode-style">
9717
- <xsl:variable name="_font-size">
9718
-
9719
- <!-- 9 -->
9720
-
9721
- <!-- <xsl:if test="$namespace = 'ieee'">
9722
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
9723
- </xsl:if> -->
9901
+ <!-- <xsl:if test="$namespace = 'ieee'">
9902
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
9903
+ </xsl:if> -->
9724
9904
 
9725
9905
  </xsl:variable>
9726
9906
 
@@ -9735,14 +9915,60 @@
9735
9915
  </xsl:choose>
9736
9916
  </xsl:attribute>
9737
9917
  </xsl:if>
9918
+ </xsl:element>
9919
+ </xsl:variable>
9738
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>
9739
9928
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9740
- </fo:block>
9929
+ </xsl:when>
9741
9930
 
9742
- <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">
9743
9933
 
9744
- </fo:block-container>
9745
- </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>
9746
9972
  </xsl:template>
9747
9973
 
9748
9974
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -9984,8 +10210,22 @@
9984
10210
  </fo:block>
9985
10211
  </xsl:if>
9986
10212
  </xsl:template>
9987
- <!-- ====== -->
9988
- <!-- ====== -->
10213
+ <!-- =============== -->
10214
+ <!-- END sourcecode -->
10215
+ <!-- =============== -->
10216
+
10217
+ <!-- =============== -->
10218
+ <!-- pre -->
10219
+ <!-- =============== -->
10220
+ <xsl:template match="*[local-name()='pre']" name="pre">
10221
+ <fo:block xsl:use-attribute-sets="pre-style">
10222
+ <xsl:copy-of select="@id"/>
10223
+ <xsl:apply-templates/>
10224
+ </fo:block>
10225
+ </xsl:template>
10226
+ <!-- =============== -->
10227
+ <!-- pre -->
10228
+ <!-- =============== -->
9989
10229
 
9990
10230
  <!-- ========== -->
9991
10231
  <!-- permission -->
@@ -11495,7 +11735,7 @@
11495
11735
  <xsl:apply-templates select="*[local-name() = 'note']"/>
11496
11736
 
11497
11737
  <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
11498
-
11738
+ <xsl:text>,</xsl:text>
11499
11739
  <xsl:text> </xsl:text>
11500
11740
  </xsl:if>
11501
11741
 
@@ -12016,7 +12256,9 @@
12016
12256
  <!-- ===================================== -->
12017
12257
  <!-- Update xml -->
12018
12258
  <!-- ===================================== -->
12259
+ <!-- =========================================================================== -->
12019
12260
  <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12261
+ <!-- =========================================================================== -->
12020
12262
  <xsl:template match="@*|node()" mode="update_xml_step1">
12021
12263
  <xsl:copy>
12022
12264
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -12108,10 +12350,13 @@
12108
12350
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12109
12351
  <xsl:apply-templates mode="update_xml_step1"/>
12110
12352
  </xsl:template>
12111
-
12353
+ <!-- =========================================================================== -->
12112
12354
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12355
+ <!-- =========================================================================== -->
12113
12356
 
12357
+ <!-- =========================================================================== -->
12114
12358
  <!-- STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12359
+ <!-- =========================================================================== -->
12115
12360
  <xsl:template match="@*|node()" mode="update_xml_step2">
12116
12361
  <xsl:copy>
12117
12362
  <xsl:apply-templates select="@*|node()" mode="update_xml_step2"/>
@@ -12190,8 +12435,6 @@
12190
12435
  </xsl:copy>
12191
12436
  </xsl:template>
12192
12437
 
12193
- <!-- END STEP2: add 'fn' after 'eref' and 'origin', if referenced to bibitem with 'note' = Withdrawn.' or 'Cancelled and replaced...' -->
12194
-
12195
12438
  <!-- enclose sequence of 'char x' + 'combining char y' to <lang_none>xy</lang_none> -->
12196
12439
  <xsl:variable name="regex_combining_chars">(.[̀-ͯ])</xsl:variable>
12197
12440
  <xsl:variable name="element_name_lang_none">lang_none</xsl:variable>
@@ -12207,7 +12450,15 @@
12207
12450
  </xsl:call-template>
12208
12451
  </xsl:template>
12209
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
+ <!-- =========================================================================== -->
12210
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
+ <!-- =========================================================================== -->
12211
12462
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
12212
12463
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
12213
12464
  <xsl:copy>
@@ -12223,10 +12474,15 @@
12223
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">
12224
12475
 
12225
12476
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
12226
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
12227
12477
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12228
12478
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12229
- <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>
12230
12486
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
12231
12487
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12232
12488
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -12242,7 +12498,11 @@
12242
12498
  </xsl:variable>
12243
12499
 
12244
12500
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12245
- <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>
12246
12506
  <xsl:variable name="text3">
12247
12507
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
12248
12508
  <xsl:choose>
@@ -12306,9 +12566,8 @@
12306
12566
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
12307
12567
  </xsl:choose>
12308
12568
  </xsl:template>
12309
-
12310
12569
  <!-- ===================================== -->
12311
- <!-- End Update xml -->
12570
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
12312
12571
  <!-- ===================================== -->
12313
12572
 
12314
12573
  <!-- for correct rendering combining chars -->
@@ -12694,13 +12953,14 @@
12694
12953
  </xsl:template>
12695
12954
 
12696
12955
  <xsl:template name="setId">
12956
+ <xsl:param name="prefix"/>
12697
12957
  <xsl:attribute name="id">
12698
12958
  <xsl:choose>
12699
12959
  <xsl:when test="@id">
12700
- <xsl:value-of select="@id"/>
12960
+ <xsl:value-of select="concat($prefix, @id)"/>
12701
12961
  </xsl:when>
12702
12962
  <xsl:otherwise>
12703
- <xsl:value-of select="generate-id()"/>
12963
+ <xsl:value-of select="concat($prefix, generate-id())"/>
12704
12964
  </xsl:otherwise>
12705
12965
  </xsl:choose>
12706
12966
  </xsl:attribute>