metanorma-ogc 2.3.2 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -685,14 +685,14 @@
685
685
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
686
686
 
687
687
  <!--
688
- <misc-container>
688
+ <metanorma-extension>
689
689
  <presentation-metadata>
690
690
  <papersize>letter</papersize>
691
691
  </presentation-metadata>
692
- </misc-container>
692
+ </metanorma-extension>
693
693
  -->
694
694
 
695
- <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
695
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
696
696
  <xsl:variable name="papersize_width_">
697
697
  <xsl:choose>
698
698
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -809,7 +809,7 @@
809
809
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
810
810
 
811
811
  <xsl:variable name="title-list-tables">
812
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
812
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
813
813
  <xsl:value-of select="$toc_table_title"/>
814
814
  <xsl:if test="normalize-space($toc_table_title) = ''">
815
815
  <xsl:call-template name="getTitle">
@@ -819,7 +819,7 @@
819
819
  </xsl:variable>
820
820
 
821
821
  <xsl:variable name="title-list-figures">
822
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
822
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
823
823
  <xsl:value-of select="$toc_figure_title"/>
824
824
  <xsl:if test="normalize-space($toc_figure_title) = ''">
825
825
  <xsl:call-template name="getTitle">
@@ -829,7 +829,7 @@
829
829
  </xsl:variable>
830
830
 
831
831
  <xsl:variable name="title-list-recommendations">
832
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
832
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
833
833
  <xsl:value-of select="$toc_requirement_title"/>
834
834
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
835
835
  <xsl:call-template name="getTitle">
@@ -901,7 +901,7 @@
901
901
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
902
902
 
903
903
  <xsl:variable name="additional_fonts_">
904
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
904
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
905
905
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
906
906
  </xsl:for-each>
907
907
  </xsl:variable>
@@ -2070,10 +2070,10 @@
2070
2070
 
2071
2071
  <xsl:template name="processTablesFigures_Contents">
2072
2072
  <xsl:param name="always"/>
2073
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2073
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2074
2074
  <xsl:call-template name="processTables_Contents"/>
2075
2075
  </xsl:if>
2076
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2076
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2077
2077
  <xsl:call-template name="processFigures_Contents"/>
2078
2078
  </xsl:if>
2079
2079
  </xsl:template>
@@ -2422,6 +2422,7 @@
2422
2422
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2423
2423
 
2424
2424
  <xsl:choose>
2425
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
2425
2426
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2426
2427
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
2427
2428
  </xsl:choose>
@@ -2439,6 +2440,8 @@
2439
2440
 
2440
2441
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
2441
2442
 
2443
+ <xsl:call-template name="setBordersTableArray"/>
2444
+
2442
2445
  </xsl:element>
2443
2446
  </xsl:variable>
2444
2447
 
@@ -2538,7 +2541,7 @@
2538
2541
  <xsl:variable name="isDeleted" select="@deleted"/>
2539
2542
 
2540
2543
  <xsl:choose>
2541
- <xsl:when test="@width">
2544
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
2542
2545
 
2543
2546
  <!-- centered table when table name is centered (see table-name-style) -->
2544
2547
 
@@ -2582,6 +2585,10 @@
2582
2585
 
2583
2586
  </xsl:template>
2584
2587
 
2588
+ <xsl:template name="setBordersTableArray">
2589
+
2590
+ </xsl:template>
2591
+
2585
2592
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2586
2593
  <xsl:param name="continued"/>
2587
2594
  <xsl:if test="normalize-space() != ''">
@@ -2856,6 +2863,7 @@
2856
2863
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2857
2864
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2858
2865
  <!-- difference between the available space and the minimum table width -->
2866
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
2859
2867
  <xsl:variable name="W" select="$page_width - @width_min"/>
2860
2868
  <W><xsl:value-of select="$W"/></W>
2861
2869
  <!-- difference between maximum and minimum width of the table -->
@@ -3056,6 +3064,8 @@
3056
3064
  <fo:table-row>
3057
3065
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3058
3066
 
3067
+ <xsl:call-template name="setBordersTableArray"/>
3068
+
3059
3069
  <!-- fn will be processed inside 'note' processing -->
3060
3070
 
3061
3071
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -3177,6 +3187,8 @@
3177
3187
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3178
3188
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3179
3189
 
3190
+ <xsl:call-template name="setBordersTableArray"/>
3191
+
3180
3192
  <xsl:call-template name="setTableRowAttributes"/>
3181
3193
 
3182
3194
  <xsl:apply-templates/>
@@ -3200,6 +3212,8 @@
3200
3212
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3201
3213
  </xsl:if>
3202
3214
 
3215
+ <xsl:call-template name="setBordersTableArray"/>
3216
+
3203
3217
  <xsl:call-template name="setTableRowAttributes"/>
3204
3218
  <xsl:apply-templates/>
3205
3219
  </fo:table-row>
@@ -3219,6 +3233,8 @@
3219
3233
  <xsl:with-param name="default">center</xsl:with-param>
3220
3234
  </xsl:call-template>
3221
3235
 
3236
+ <xsl:call-template name="setBordersTableArray"/>
3237
+
3222
3238
  <xsl:if test="$lang = 'ar'">
3223
3239
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3224
3240
  </xsl:if>
@@ -3271,6 +3287,8 @@
3271
3287
 
3272
3288
  <!-- bsi -->
3273
3289
 
3290
+ <xsl:call-template name="setBordersTableArray"/>
3291
+
3274
3292
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3275
3293
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3276
3294
  </xsl:if>
@@ -3463,17 +3481,20 @@
3463
3481
  <xsl:for-each select="xalan:nodeset($references)//fn">
3464
3482
  <xsl:variable name="reference" select="@reference"/>
3465
3483
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3466
- <fo:block xsl:use-attribute-sets="table-fn-style">
3467
3484
 
3468
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3485
+ <fo:block xsl:use-attribute-sets="table-fn-style">
3469
3486
 
3470
- <xsl:value-of select="@reference"/>
3487
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
3488
+
3489
+ <xsl:value-of select="@reference"/>
3490
+
3491
+ </fo:inline>
3492
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3493
+ <xsl:copy-of select="./node()"/>
3494
+ </fo:inline>
3495
+
3496
+ </fo:block>
3471
3497
 
3472
- </fo:inline>
3473
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
3474
- <xsl:copy-of select="./node()"/>
3475
- </fo:inline>
3476
- </fo:block>
3477
3498
  </xsl:if>
3478
3499
  </xsl:for-each>
3479
3500
  </xsl:template>
@@ -4425,12 +4446,12 @@
4425
4446
  <xsl:param name="value"/>
4426
4447
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
4427
4448
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
4428
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4429
- <xsl:attribute name="height">5mm</xsl:attribute>
4449
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
4450
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
4430
4451
  <xsl:attribute name="content-width">100%</xsl:attribute>
4431
4452
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4432
4453
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4433
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4454
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4434
4455
  <g>
4435
4456
  <xsl:if test="$type = 'closing' or $type = 'end'">
4436
4457
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -4444,6 +4465,27 @@
4444
4465
  </xsl:if>
4445
4466
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4446
4467
  </text>
4468
+ </svg> -->
4469
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4470
+ <g>
4471
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4472
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4473
+ </xsl:if>
4474
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
4475
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
4476
+ </g>
4477
+ <xsl:variable name="text_x">
4478
+ <xsl:choose>
4479
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
4480
+ <xsl:otherwise>22</xsl:otherwise>
4481
+ </xsl:choose>
4482
+ </xsl:variable>
4483
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
4484
+ <xsl:value-of select="$kind"/>
4485
+ </text>
4486
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
4487
+ <xsl:value-of select="$value"/>
4488
+ </text>
4447
4489
  </svg>
4448
4490
  </fo:instream-foreign-object>
4449
4491
  </xsl:template>
@@ -4698,18 +4740,23 @@
4698
4740
 
4699
4741
  <xsl:template name="add-zero-spaces-java">
4700
4742
  <xsl:param name="text" select="."/>
4701
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4702
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4743
+
4744
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
4745
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
4746
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
4747
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
4748
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
4749
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
4703
4750
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
4704
- <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' -->
4751
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
4705
4752
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
4706
- <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' -->
4753
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
4707
4754
  <!-- add zero-width space (#x200B) before character: { -->
4708
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4755
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4709
4756
  <!-- add zero-width space (#x200B) after character: , -->
4710
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4757
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4711
4758
 
4712
- <xsl:value-of select="$text5"/>
4759
+ <xsl:value-of select="$text7"/>
4713
4760
  </xsl:template>
4714
4761
 
4715
4762
  <xsl:template name="add-zero-spaces-link-java">
@@ -4718,7 +4765,9 @@
4718
4765
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4719
4766
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4720
4767
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4721
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4768
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4769
+ <!-- remove zero-width space at the end -->
4770
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
4722
4771
  </xsl:template>
4723
4772
 
4724
4773
  <!-- add zero space after dash character (for table's entries) -->
@@ -4855,7 +4904,7 @@
4855
4904
  </xsl:copy>
4856
4905
  </xsl:template>
4857
4906
 
4858
- <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">
4907
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
4859
4908
  <xsl:copy>
4860
4909
  <xsl:copy-of select="@*"/>
4861
4910
  <p>
@@ -4931,6 +4980,14 @@
4931
4980
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
4932
4981
  </xsl:template>
4933
4982
 
4983
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
4984
+ <xsl:apply-templates mode="table-without-br"/>
4985
+ </xsl:template>
4986
+
4987
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
4988
+ <xsl:apply-templates mode="table-without-br"/>
4989
+ </xsl:template>
4990
+
4934
4991
  <!-- mode="table-without-br" -->
4935
4992
  <!-- ================================== -->
4936
4993
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -5748,7 +5805,7 @@
5748
5805
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
5749
5806
  </xsl:if>
5750
5807
 
5751
- <fo:block-container margin-left="0mm">
5808
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5752
5809
 
5753
5810
  <fo:block>
5754
5811
 
@@ -5924,11 +5981,14 @@
5924
5981
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5925
5982
  </xsl:call-template>
5926
5983
 
5984
+ <!-- Example: Dimensions in millimeters -->
5985
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
5986
+
5927
5987
  <fo:block xsl:use-attribute-sets="figure-style">
5928
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5988
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
5929
5989
  </fo:block>
5930
5990
  <xsl:call-template name="fn_display_figure"/>
5931
- <xsl:for-each select="*[local-name() = 'note']">
5991
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
5932
5992
  <xsl:call-template name="note"/>
5933
5993
  </xsl:for-each>
5934
5994
 
@@ -6185,24 +6245,47 @@
6185
6245
 
6186
6246
  </xsl:when>
6187
6247
  <xsl:otherwise>
6188
- <fo:block xsl:use-attribute-sets="image-style">
6189
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6190
- <xsl:attribute name="width">100%</xsl:attribute>
6191
- <xsl:attribute name="content-height">100%</xsl:attribute>
6192
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6193
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6194
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6195
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6196
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6197
- <!-- effective height / width = 1.48, 1.4 - with title -->
6198
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6199
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6200
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6201
- </xsl:if>
6202
- <xsl:attribute name="scaling">uniform</xsl:attribute>
6203
- <xsl:copy-of select="$svg_content"/>
6204
- </fo:instream-foreign-object>
6205
- </fo:block>
6248
+
6249
+ <xsl:variable name="element">
6250
+ <xsl:choose>
6251
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
6252
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
6253
+ </xsl:when>
6254
+ <xsl:otherwise>
6255
+ <fo:block xsl:use-attribute-sets="image-style">
6256
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
6257
+ <xsl:attribute name="text-align">left</xsl:attribute>
6258
+ </xsl:if>
6259
+ </fo:block>
6260
+ </xsl:otherwise>
6261
+ </xsl:choose>
6262
+ </xsl:variable>
6263
+
6264
+ <xsl:for-each select="xalan:nodeset($element)/*">
6265
+ <xsl:copy>
6266
+ <xsl:copy-of select="@*"/>
6267
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
6268
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
6269
+ <xsl:if test="$isGenerateTableIF = 'false'">
6270
+ <xsl:attribute name="width">100%</xsl:attribute>
6271
+ </xsl:if>
6272
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6273
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6274
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
6275
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
6276
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
6277
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
6278
+ <!-- effective height / width = 1.48, 1.4 - with title -->
6279
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
6280
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
6281
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
6282
+ </xsl:if>
6283
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6284
+ <xsl:copy-of select="$svg_content"/>
6285
+ </fo:instream-foreign-object>
6286
+ <!-- </fo:block> -->
6287
+ </xsl:copy>
6288
+ </xsl:for-each>
6206
6289
  </xsl:otherwise>
6207
6290
  </xsl:choose>
6208
6291
  </xsl:template>
@@ -6294,6 +6377,13 @@
6294
6377
  </xsl:for-each>
6295
6378
  </xsl:template>
6296
6379
 
6380
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
6381
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
6382
+ <xsl:for-each select="*[local-name() = 'svg']">
6383
+ <xsl:call-template name="image_svg"/>
6384
+ </xsl:for-each>
6385
+ </xsl:template>
6386
+
6297
6387
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
6298
6388
  <xsl:variable name="svg_content" select="document(@src)"/>
6299
6389
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -6432,6 +6522,8 @@
6432
6522
  <xsl:value-of select="."/>
6433
6523
  </xsl:template>
6434
6524
 
6525
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
6526
+
6435
6527
  <xsl:template match="node()" mode="contents">
6436
6528
  <xsl:apply-templates mode="contents"/>
6437
6529
  </xsl:template>
@@ -6734,7 +6826,15 @@
6734
6826
  <xsl:value-of select="@section"/>
6735
6827
  <xsl:text> </xsl:text>
6736
6828
  </xsl:if>
6737
- <xsl:value-of select="normalize-space(title)"/>
6829
+ <xsl:variable name="title">
6830
+ <xsl:for-each select="title/node()">
6831
+ <xsl:choose>
6832
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
6833
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6834
+ </xsl:choose>
6835
+ </xsl:for-each>
6836
+ </xsl:variable>
6837
+ <xsl:value-of select="normalize-space($title)"/>
6738
6838
  </fo:bookmark-title>
6739
6839
  <xsl:apply-templates mode="bookmark"/>
6740
6840
  </fo:bookmark>
@@ -6760,6 +6860,12 @@
6760
6860
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
6761
6861
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
6762
6862
 
6863
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
6864
+ <fo:block text-align="right" keep-with-next="always">
6865
+ <xsl:apply-templates/>
6866
+ </fo:block>
6867
+ </xsl:template>
6868
+
6763
6869
  <!-- ====== -->
6764
6870
  <!-- ====== -->
6765
6871
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -6909,6 +7015,10 @@
6909
7015
  </xsl:for-each>
6910
7016
  </xsl:template>
6911
7017
 
7018
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
7019
+ <xsl:value-of select="."/>
7020
+ </xsl:template>
7021
+
6912
7022
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
6913
7023
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
6914
7024
  <xsl:apply-templates mode="contents_item"/>
@@ -6918,7 +7028,7 @@
6918
7028
  <!-- sourcecode -->
6919
7029
  <!-- =============== -->
6920
7030
 
6921
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7031
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
6922
7032
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6923
7033
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6924
7034
 
@@ -9008,8 +9118,8 @@
9008
9118
 
9009
9119
  <xsl:variable name="toc_level">
9010
9120
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
9011
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
9012
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
9121
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
9122
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
9013
9123
  <xsl:choose>
9014
9124
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
9015
9125
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -10001,6 +10111,7 @@
10001
10111
  <xsl:choose>
10002
10112
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
10003
10113
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
10114
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
10004
10115
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
10005
10116
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
10006
10117
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -203,13 +203,13 @@ module IsoDoc
203
203
  display_order_xpath(docxml, "//indexsect", i)
204
204
  end
205
205
 
206
- def norm_ref_entry_code(_ordinal, _idents, _ids, _standard, _datefn)
206
+ def norm_ref_entry_code(_ordinal, _idents, _ids, _standard, _datefn, _bib)
207
207
  ""
208
208
  end
209
209
 
210
210
  # if ids is just a number, only use that ([1] Non-Standard)
211
211
  # else, use both ordinal, as prefix, and ids
212
- def biblio_ref_entry_code(ordinal, ids, _id, standard, datefn)
212
+ def biblio_ref_entry_code(ordinal, ids, _id, standard, datefn, _bib)
213
213
  standard and return "[#{ordinal}]<tab/>"
214
214
  ret = (ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]")
215
215
  prefix_bracketed_ref("#{ret}#{datefn}")
@@ -522,7 +522,6 @@
522
522
  <value>tip</value>
523
523
  <value>important</value>
524
524
  <value>caution</value>
525
- <value>statement</value>
526
525
  </choice>
527
526
  </define>
528
527
  <define name="figure">
@@ -216,6 +216,9 @@
216
216
  <optional>
217
217
  <ref name="fullname"/>
218
218
  </optional>
219
+ <zeroOrMore>
220
+ <ref name="credential"/>
221
+ </zeroOrMore>
219
222
  <zeroOrMore>
220
223
  <ref name="affiliation"/>
221
224
  </zeroOrMore>
@@ -232,6 +235,11 @@
232
235
  <ref name="FullNameType"/>
233
236
  </element>
234
237
  </define>
238
+ <define name="credential">
239
+ <element name="credential">
240
+ <text/>
241
+ </element>
242
+ </define>
235
243
  <define name="FullNameType">
236
244
  <choice>
237
245
  <group>
@@ -305,7 +313,9 @@
305
313
  <zeroOrMore>
306
314
  <ref name="affiliationdescription"/>
307
315
  </zeroOrMore>
308
- <ref name="organization"/>
316
+ <optional>
317
+ <ref name="organization"/>
318
+ </optional>
309
319
  </element>
310
320
  </define>
311
321
  <define name="affiliationname">
@@ -1316,7 +1326,7 @@
1316
1326
  <value>commentaryOf</value>
1317
1327
  <value>hasCommentary</value>
1318
1328
  <value>related</value>
1319
- <value>complements</value>
1329
+ <value>hasComplement</value>
1320
1330
  <value>complementOf</value>
1321
1331
  <value>obsoletes</value>
1322
1332
  <value>obsoletedBy</value>
@@ -145,14 +145,12 @@ module Metanorma
145
145
 
146
146
  PUBLISHER = "./contributor[role/@type = 'publisher']/organization".freeze
147
147
 
148
- OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or " \
149
- "@type = 'ISBN'".freeze
150
-
151
148
  def pub_class(bib)
152
149
  return 1 if bib.at("#{PUBLISHER}[abbreviation = 'OGC']")
153
150
  return 1 if bib.at("#{PUBLISHER}[name = 'Open Geospatial " \
154
151
  "Consortium']")
155
- return 2 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]")
152
+ return 2 if bib.at("./docidentifier[@type][not(#{skip_docid} or " \
153
+ "@type = 'metanorma')]")
156
154
 
157
155
  3
158
156
  end
@@ -195,7 +193,7 @@ module Metanorma
195
193
 
196
194
  def sort_biblio_ids_key(bib)
197
195
  id = bib.at("./docidentifier[@primary]") ||
198
- bib.at("./docidentifier[not(#{OTHERIDS})]")
196
+ bib.at("./docidentifier[not(#{skip_docid} or @type = 'metanorma')]")
199
197
  metaid = bib.at("./docidentifier[@type = 'metanorma']")&.text
200
198
  /\d-(?<partid>\d+)/ =~ id&.text
201
199
  { id: id&.text,
@@ -16,7 +16,7 @@ module Metanorma
16
16
  csv_split(HTMLEntities.new
17
17
  .decode(node.attr("submitting-organizations")), ";")&.each do |org|
18
18
  xml.contributor do |c|
19
- c.role **{ type: "author" }
19
+ c.role type: "author"
20
20
  c.organization do |a|
21
21
  a.name org
22
22
  end
@@ -39,12 +39,12 @@ module Metanorma
39
39
  def personal_role(node, contrib, suffix)
40
40
  type = node.attr("role#{suffix}")&.downcase || "editor"
41
41
  if type == "contributor"
42
- contrib.role **{ type: "author" } do |r|
42
+ contrib.role type: "author" do |r|
43
43
  r.description do |d|
44
44
  d << type
45
45
  end
46
46
  end
47
- else contrib.role **{ type: type }
47
+ else contrib.role type: type
48
48
  end
49
49
  end
50
50
 
@@ -52,7 +52,7 @@ module Metanorma
52
52
  return unless node.attr("editor")
53
53
 
54
54
  xml.contributor do |c|
55
- c.role **{ type: "editor" }
55
+ c.role type: "editor"
56
56
  c.person do |p|
57
57
  p.name do |n|
58
58
  n.completename node.attr("editor")
@@ -114,14 +114,13 @@ module Metanorma
114
114
  end
115
115
 
116
116
  def metadata_id(node, xml)
117
- e = externalid(node) and xml.docidentifier e, **{ type: "ogc-external" }
117
+ e = externalid(node) and xml.docidentifier e, type: "ogc-external"
118
118
  node.attr("referenceurlid") and
119
- xml.docidentifier externalurl(node), **{ type: "ogc-external" }
119
+ xml.docidentifier externalurl(node), type: "ogc-external"
120
120
  docnumber = node.attr("docnumber") || node.attr("docreference")
121
- if docnumber
122
- xml.docidentifier docnumber, **{ type: "ogc-internal" }
123
- xml.docnumber docnumber
124
- end
121
+ id = node.attr("docidentifier") || docnumber
122
+ xml.docidentifier id, type: "ogc-internal"
123
+ docnumber and xml.docnumber docnumber
125
124
  end
126
125
 
127
126
  def externalurl(node)
@@ -153,7 +152,7 @@ module Metanorma
153
152
 
154
153
  def ogc_date(node, xml, ogcname, metanormaname)
155
154
  if node.attr(ogcname)
156
- xml.date **{ type: metanormaname } do |d|
155
+ xml.date type: metanormaname do |d|
157
156
  d.on node.attr(ogcname)
158
157
  end
159
158
  end