metanorma-ogc 2.3.14 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1184,7 +1184,7 @@
1184
1184
  </xsl:if>
1185
1185
  </xsl:template>
1186
1186
 
1187
- <xsl:template match="*[local-name()='th']//text()" priority="2">
1187
+ <xsl:template match="*[local-name()='th']//text()[not(ancestor::ogc:fn)]" priority="2">
1188
1188
  <xsl:variable name="text">
1189
1189
  <xsl:call-template name="add-zero-spaces-java"/>
1190
1190
  </xsl:variable>
@@ -1822,11 +1822,26 @@
1822
1822
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
1823
1823
  </xsl:if>
1824
1824
 
1825
- <xsl:value-of select="."/>
1825
+ <xsl:variable name="font_family" select="."/>
1826
1826
 
1827
- <xsl:if test="$additional_fonts != ''">
1828
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1829
- </xsl:if>
1827
+ <xsl:choose>
1828
+ <xsl:when test="$additional_fonts = ''">
1829
+ <xsl:value-of select="$font_family"/>
1830
+ </xsl:when>
1831
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
1832
+ <xsl:choose>
1833
+ <xsl:when test="contains($font_family, ',')">
1834
+ <xsl:value-of select="substring-before($font_family, ',')"/>
1835
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1836
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
1837
+ </xsl:when>
1838
+ <xsl:otherwise>
1839
+ <xsl:value-of select="$font_family"/>
1840
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1841
+ </xsl:otherwise>
1842
+ </xsl:choose>
1843
+ </xsl:otherwise>
1844
+ </xsl:choose>
1830
1845
  </xsl:attribute>
1831
1846
  </xsl:when>
1832
1847
  <xsl:otherwise>
@@ -4480,21 +4495,21 @@
4480
4495
 
4481
4496
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4482
4497
 
4483
- <fo:block xsl:use-attribute-sets="table-note-style">
4498
+ <fo:block xsl:use-attribute-sets="table-note-style">
4484
4499
 
4485
- <xsl:call-template name="refine_table-note-style"/>
4500
+ <xsl:call-template name="refine_table-note-style"/>
4486
4501
 
4487
- <!-- Table's note/example name (NOTE, for example) -->
4488
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
4502
+ <!-- Table's note/example name (NOTE, for example) -->
4503
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
4489
4504
 
4490
- <xsl:call-template name="refine_table-note-name-style"/>
4505
+ <xsl:call-template name="refine_table-note-name-style"/>
4491
4506
 
4492
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4507
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
4493
4508
 
4494
- </fo:inline>
4509
+ </fo:inline>
4495
4510
 
4496
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4497
- </fo:block>
4511
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4512
+ </fo:block>
4498
4513
 
4499
4514
  </xsl:template> <!-- table/note -->
4500
4515
 
@@ -5577,6 +5592,9 @@
5577
5592
  <!-- END Definition List -->
5578
5593
  <!-- ===================== -->
5579
5594
 
5595
+ <!-- default: ignore title in sections/p -->
5596
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
5597
+
5580
5598
  <!-- ========================= -->
5581
5599
  <!-- Rich text formatting -->
5582
5600
  <!-- ========================= -->
@@ -7634,8 +7652,12 @@
7634
7652
  <xsl:variable name="isAdded" select="../@added"/>
7635
7653
  <xsl:variable name="isDeleted" select="../@deleted"/>
7636
7654
  <xsl:choose>
7637
- <xsl:when test="ancestor::*[local-name() = 'title']">
7655
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7638
7656
  <fo:inline padding-left="1mm" padding-right="1mm">
7657
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7658
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
7659
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
7660
+ </xsl:if>
7639
7661
  <xsl:variable name="src">
7640
7662
  <xsl:call-template name="image_src"/>
7641
7663
  </xsl:variable>
@@ -7668,25 +7690,45 @@
7668
7690
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7669
7691
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7670
7692
 
7671
- <xsl:variable name="img_src">
7672
- <xsl:choose>
7673
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7674
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7675
- </xsl:choose>
7676
- </xsl:variable>
7693
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7694
+ <xsl:attribute name="width">
7695
+ <xsl:value-of select="@width"/>
7696
+ </xsl:attribute>
7697
+ </xsl:if>
7677
7698
 
7678
- <xsl:variable name="image_width_effective">
7699
+ <xsl:if test="@height != '' and @height != 'auto'">
7700
+ <xsl:attribute name="height">
7701
+ <xsl:value-of select="@height"/>
7702
+ </xsl:attribute>
7703
+ </xsl:if>
7679
7704
 
7680
- <xsl:value-of select="$width_effective"/>
7705
+ <xsl:choose>
7706
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
7707
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
7708
+ </xsl:when>
7709
+ <xsl:otherwise>
7681
7710
 
7682
- </xsl:variable>
7711
+ <xsl:variable name="img_src">
7712
+ <xsl:choose>
7713
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7714
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7715
+ </xsl:choose>
7716
+ </xsl:variable>
7683
7717
 
7684
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7685
- <xsl:if test="number($scale) &lt; 100">
7718
+ <xsl:variable name="image_width_effective">
7686
7719
 
7687
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7720
+ <xsl:value-of select="$width_effective"/>
7688
7721
 
7689
- </xsl:if>
7722
+ </xsl:variable>
7723
+
7724
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7725
+ <xsl:if test="number($scale) &lt; 100">
7726
+
7727
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7728
+
7729
+ </xsl:if>
7730
+ </xsl:otherwise>
7731
+ </xsl:choose>
7690
7732
 
7691
7733
  </xsl:if>
7692
7734
 
@@ -11387,7 +11429,7 @@
11387
11429
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
11388
11430
  <xsl:apply-templates mode="update_xml_step1"/>
11389
11431
  </xsl:template>
11390
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11432
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11391
11433
  <xsl:copy>
11392
11434
  <xsl:copy-of select="@*"/>
11393
11435
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -1184,7 +1184,7 @@
1184
1184
  </xsl:if>
1185
1185
  </xsl:template>
1186
1186
 
1187
- <xsl:template match="*[local-name()='th']//text()" priority="2">
1187
+ <xsl:template match="*[local-name()='th']//text()[not(ancestor::ogc:fn)]" priority="2">
1188
1188
  <xsl:variable name="text">
1189
1189
  <xsl:call-template name="add-zero-spaces-java"/>
1190
1190
  </xsl:variable>
@@ -1822,11 +1822,26 @@
1822
1822
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
1823
1823
  </xsl:if>
1824
1824
 
1825
- <xsl:value-of select="."/>
1825
+ <xsl:variable name="font_family" select="."/>
1826
1826
 
1827
- <xsl:if test="$additional_fonts != ''">
1828
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1829
- </xsl:if>
1827
+ <xsl:choose>
1828
+ <xsl:when test="$additional_fonts = ''">
1829
+ <xsl:value-of select="$font_family"/>
1830
+ </xsl:when>
1831
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
1832
+ <xsl:choose>
1833
+ <xsl:when test="contains($font_family, ',')">
1834
+ <xsl:value-of select="substring-before($font_family, ',')"/>
1835
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1836
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
1837
+ </xsl:when>
1838
+ <xsl:otherwise>
1839
+ <xsl:value-of select="$font_family"/>
1840
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1841
+ </xsl:otherwise>
1842
+ </xsl:choose>
1843
+ </xsl:otherwise>
1844
+ </xsl:choose>
1830
1845
  </xsl:attribute>
1831
1846
  </xsl:when>
1832
1847
  <xsl:otherwise>
@@ -4480,21 +4495,21 @@
4480
4495
 
4481
4496
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4482
4497
 
4483
- <fo:block xsl:use-attribute-sets="table-note-style">
4498
+ <fo:block xsl:use-attribute-sets="table-note-style">
4484
4499
 
4485
- <xsl:call-template name="refine_table-note-style"/>
4500
+ <xsl:call-template name="refine_table-note-style"/>
4486
4501
 
4487
- <!-- Table's note/example name (NOTE, for example) -->
4488
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
4502
+ <!-- Table's note/example name (NOTE, for example) -->
4503
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
4489
4504
 
4490
- <xsl:call-template name="refine_table-note-name-style"/>
4505
+ <xsl:call-template name="refine_table-note-name-style"/>
4491
4506
 
4492
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4507
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
4493
4508
 
4494
- </fo:inline>
4509
+ </fo:inline>
4495
4510
 
4496
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4497
- </fo:block>
4511
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4512
+ </fo:block>
4498
4513
 
4499
4514
  </xsl:template> <!-- table/note -->
4500
4515
 
@@ -5577,6 +5592,9 @@
5577
5592
  <!-- END Definition List -->
5578
5593
  <!-- ===================== -->
5579
5594
 
5595
+ <!-- default: ignore title in sections/p -->
5596
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
5597
+
5580
5598
  <!-- ========================= -->
5581
5599
  <!-- Rich text formatting -->
5582
5600
  <!-- ========================= -->
@@ -7634,8 +7652,12 @@
7634
7652
  <xsl:variable name="isAdded" select="../@added"/>
7635
7653
  <xsl:variable name="isDeleted" select="../@deleted"/>
7636
7654
  <xsl:choose>
7637
- <xsl:when test="ancestor::*[local-name() = 'title']">
7655
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7638
7656
  <fo:inline padding-left="1mm" padding-right="1mm">
7657
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7658
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
7659
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
7660
+ </xsl:if>
7639
7661
  <xsl:variable name="src">
7640
7662
  <xsl:call-template name="image_src"/>
7641
7663
  </xsl:variable>
@@ -7668,25 +7690,45 @@
7668
7690
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7669
7691
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7670
7692
 
7671
- <xsl:variable name="img_src">
7672
- <xsl:choose>
7673
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7674
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7675
- </xsl:choose>
7676
- </xsl:variable>
7693
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7694
+ <xsl:attribute name="width">
7695
+ <xsl:value-of select="@width"/>
7696
+ </xsl:attribute>
7697
+ </xsl:if>
7677
7698
 
7678
- <xsl:variable name="image_width_effective">
7699
+ <xsl:if test="@height != '' and @height != 'auto'">
7700
+ <xsl:attribute name="height">
7701
+ <xsl:value-of select="@height"/>
7702
+ </xsl:attribute>
7703
+ </xsl:if>
7679
7704
 
7680
- <xsl:value-of select="$width_effective"/>
7705
+ <xsl:choose>
7706
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
7707
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
7708
+ </xsl:when>
7709
+ <xsl:otherwise>
7681
7710
 
7682
- </xsl:variable>
7711
+ <xsl:variable name="img_src">
7712
+ <xsl:choose>
7713
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7714
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7715
+ </xsl:choose>
7716
+ </xsl:variable>
7683
7717
 
7684
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7685
- <xsl:if test="number($scale) &lt; 100">
7718
+ <xsl:variable name="image_width_effective">
7686
7719
 
7687
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7720
+ <xsl:value-of select="$width_effective"/>
7688
7721
 
7689
- </xsl:if>
7722
+ </xsl:variable>
7723
+
7724
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7725
+ <xsl:if test="number($scale) &lt; 100">
7726
+
7727
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7728
+
7729
+ </xsl:if>
7730
+ </xsl:otherwise>
7731
+ </xsl:choose>
7690
7732
 
7691
7733
  </xsl:if>
7692
7734
 
@@ -11387,7 +11429,7 @@
11387
11429
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
11388
11430
  <xsl:apply-templates mode="update_xml_step1"/>
11389
11431
  </xsl:template>
11390
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11432
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11391
11433
  <xsl:copy>
11392
11434
  <xsl:copy-of select="@*"/>
11393
11435
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -1184,7 +1184,7 @@
1184
1184
  </xsl:if>
1185
1185
  </xsl:template>
1186
1186
 
1187
- <xsl:template match="*[local-name()='th']//text()" priority="2">
1187
+ <xsl:template match="*[local-name()='th']//text()[not(ancestor::ogc:fn)]" priority="2">
1188
1188
  <xsl:variable name="text">
1189
1189
  <xsl:call-template name="add-zero-spaces-java"/>
1190
1190
  </xsl:variable>
@@ -1822,11 +1822,26 @@
1822
1822
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
1823
1823
  </xsl:if>
1824
1824
 
1825
- <xsl:value-of select="."/>
1825
+ <xsl:variable name="font_family" select="."/>
1826
1826
 
1827
- <xsl:if test="$additional_fonts != ''">
1828
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1829
- </xsl:if>
1827
+ <xsl:choose>
1828
+ <xsl:when test="$additional_fonts = ''">
1829
+ <xsl:value-of select="$font_family"/>
1830
+ </xsl:when>
1831
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
1832
+ <xsl:choose>
1833
+ <xsl:when test="contains($font_family, ',')">
1834
+ <xsl:value-of select="substring-before($font_family, ',')"/>
1835
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1836
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
1837
+ </xsl:when>
1838
+ <xsl:otherwise>
1839
+ <xsl:value-of select="$font_family"/>
1840
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
1841
+ </xsl:otherwise>
1842
+ </xsl:choose>
1843
+ </xsl:otherwise>
1844
+ </xsl:choose>
1830
1845
  </xsl:attribute>
1831
1846
  </xsl:when>
1832
1847
  <xsl:otherwise>
@@ -4480,21 +4495,21 @@
4480
4495
 
4481
4496
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4482
4497
 
4483
- <fo:block xsl:use-attribute-sets="table-note-style">
4498
+ <fo:block xsl:use-attribute-sets="table-note-style">
4484
4499
 
4485
- <xsl:call-template name="refine_table-note-style"/>
4500
+ <xsl:call-template name="refine_table-note-style"/>
4486
4501
 
4487
- <!-- Table's note/example name (NOTE, for example) -->
4488
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
4502
+ <!-- Table's note/example name (NOTE, for example) -->
4503
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
4489
4504
 
4490
- <xsl:call-template name="refine_table-note-name-style"/>
4505
+ <xsl:call-template name="refine_table-note-name-style"/>
4491
4506
 
4492
- <xsl:apply-templates select="*[local-name() = 'name']"/>
4507
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
4493
4508
 
4494
- </fo:inline>
4509
+ </fo:inline>
4495
4510
 
4496
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4497
- </fo:block>
4511
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
4512
+ </fo:block>
4498
4513
 
4499
4514
  </xsl:template> <!-- table/note -->
4500
4515
 
@@ -5577,6 +5592,9 @@
5577
5592
  <!-- END Definition List -->
5578
5593
  <!-- ===================== -->
5579
5594
 
5595
+ <!-- default: ignore title in sections/p -->
5596
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
5597
+
5580
5598
  <!-- ========================= -->
5581
5599
  <!-- Rich text formatting -->
5582
5600
  <!-- ========================= -->
@@ -7634,8 +7652,12 @@
7634
7652
  <xsl:variable name="isAdded" select="../@added"/>
7635
7653
  <xsl:variable name="isDeleted" select="../@deleted"/>
7636
7654
  <xsl:choose>
7637
- <xsl:when test="ancestor::*[local-name() = 'title']">
7655
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7638
7656
  <fo:inline padding-left="1mm" padding-right="1mm">
7657
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7658
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
7659
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
7660
+ </xsl:if>
7639
7661
  <xsl:variable name="src">
7640
7662
  <xsl:call-template name="image_src"/>
7641
7663
  </xsl:variable>
@@ -7668,25 +7690,45 @@
7668
7690
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7669
7691
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7670
7692
 
7671
- <xsl:variable name="img_src">
7672
- <xsl:choose>
7673
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7674
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7675
- </xsl:choose>
7676
- </xsl:variable>
7693
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7694
+ <xsl:attribute name="width">
7695
+ <xsl:value-of select="@width"/>
7696
+ </xsl:attribute>
7697
+ </xsl:if>
7677
7698
 
7678
- <xsl:variable name="image_width_effective">
7699
+ <xsl:if test="@height != '' and @height != 'auto'">
7700
+ <xsl:attribute name="height">
7701
+ <xsl:value-of select="@height"/>
7702
+ </xsl:attribute>
7703
+ </xsl:if>
7679
7704
 
7680
- <xsl:value-of select="$width_effective"/>
7705
+ <xsl:choose>
7706
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
7707
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
7708
+ </xsl:when>
7709
+ <xsl:otherwise>
7681
7710
 
7682
- </xsl:variable>
7711
+ <xsl:variable name="img_src">
7712
+ <xsl:choose>
7713
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7714
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7715
+ </xsl:choose>
7716
+ </xsl:variable>
7683
7717
 
7684
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7685
- <xsl:if test="number($scale) &lt; 100">
7718
+ <xsl:variable name="image_width_effective">
7686
7719
 
7687
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7720
+ <xsl:value-of select="$width_effective"/>
7688
7721
 
7689
- </xsl:if>
7722
+ </xsl:variable>
7723
+
7724
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7725
+ <xsl:if test="number($scale) &lt; 100">
7726
+
7727
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7728
+
7729
+ </xsl:if>
7730
+ </xsl:otherwise>
7731
+ </xsl:choose>
7690
7732
 
7691
7733
  </xsl:if>
7692
7734
 
@@ -11387,7 +11429,7 @@
11387
11429
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
11388
11430
  <xsl:apply-templates mode="update_xml_step1"/>
11389
11431
  </xsl:template>
11390
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11432
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11391
11433
  <xsl:copy>
11392
11434
  <xsl:copy-of select="@*"/>
11393
11435
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -956,11 +956,26 @@
956
956
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
957
957
  </xsl:if>
958
958
 
959
- <xsl:value-of select="."/>
959
+ <xsl:variable name="font_family" select="."/>
960
960
 
961
- <xsl:if test="$additional_fonts != ''">
962
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
963
- </xsl:if>
961
+ <xsl:choose>
962
+ <xsl:when test="$additional_fonts = ''">
963
+ <xsl:value-of select="$font_family"/>
964
+ </xsl:when>
965
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
966
+ <xsl:choose>
967
+ <xsl:when test="contains($font_family, ',')">
968
+ <xsl:value-of select="substring-before($font_family, ',')"/>
969
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
970
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
971
+ </xsl:when>
972
+ <xsl:otherwise>
973
+ <xsl:value-of select="$font_family"/>
974
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
975
+ </xsl:otherwise>
976
+ </xsl:choose>
977
+ </xsl:otherwise>
978
+ </xsl:choose>
964
979
  </xsl:attribute>
965
980
  </xsl:when>
966
981
  <xsl:otherwise>
@@ -3587,21 +3602,21 @@
3587
3602
 
3588
3603
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
3589
3604
 
3590
- <fo:block xsl:use-attribute-sets="table-note-style">
3605
+ <fo:block xsl:use-attribute-sets="table-note-style">
3591
3606
 
3592
- <xsl:call-template name="refine_table-note-style"/>
3607
+ <xsl:call-template name="refine_table-note-style"/>
3593
3608
 
3594
- <!-- Table's note/example name (NOTE, for example) -->
3595
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
3609
+ <!-- Table's note/example name (NOTE, for example) -->
3610
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
3596
3611
 
3597
- <xsl:call-template name="refine_table-note-name-style"/>
3612
+ <xsl:call-template name="refine_table-note-name-style"/>
3598
3613
 
3599
- <xsl:apply-templates select="*[local-name() = 'name']"/>
3614
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
3600
3615
 
3601
- </fo:inline>
3616
+ </fo:inline>
3602
3617
 
3603
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3604
- </fo:block>
3618
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
3619
+ </fo:block>
3605
3620
 
3606
3621
  </xsl:template> <!-- table/note -->
3607
3622
 
@@ -4677,6 +4692,9 @@
4677
4692
  <!-- END Definition List -->
4678
4693
  <!-- ===================== -->
4679
4694
 
4695
+ <!-- default: ignore title in sections/p -->
4696
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
4697
+
4680
4698
  <!-- ========================= -->
4681
4699
  <!-- Rich text formatting -->
4682
4700
  <!-- ========================= -->
@@ -6728,8 +6746,12 @@
6728
6746
  <xsl:variable name="isAdded" select="../@added"/>
6729
6747
  <xsl:variable name="isDeleted" select="../@deleted"/>
6730
6748
  <xsl:choose>
6731
- <xsl:when test="ancestor::*[local-name() = 'title']">
6749
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
6732
6750
  <fo:inline padding-left="1mm" padding-right="1mm">
6751
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
6752
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
6753
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
6754
+ </xsl:if>
6733
6755
  <xsl:variable name="src">
6734
6756
  <xsl:call-template name="image_src"/>
6735
6757
  </xsl:variable>
@@ -6762,25 +6784,45 @@
6762
6784
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
6763
6785
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
6764
6786
 
6765
- <xsl:variable name="img_src">
6766
- <xsl:choose>
6767
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
6768
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
6769
- </xsl:choose>
6770
- </xsl:variable>
6787
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
6788
+ <xsl:attribute name="width">
6789
+ <xsl:value-of select="@width"/>
6790
+ </xsl:attribute>
6791
+ </xsl:if>
6771
6792
 
6772
- <xsl:variable name="image_width_effective">
6793
+ <xsl:if test="@height != '' and @height != 'auto'">
6794
+ <xsl:attribute name="height">
6795
+ <xsl:value-of select="@height"/>
6796
+ </xsl:attribute>
6797
+ </xsl:if>
6773
6798
 
6774
- <xsl:value-of select="$width_effective"/>
6799
+ <xsl:choose>
6800
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
6801
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
6802
+ </xsl:when>
6803
+ <xsl:otherwise>
6775
6804
 
6776
- </xsl:variable>
6805
+ <xsl:variable name="img_src">
6806
+ <xsl:choose>
6807
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
6808
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
6809
+ </xsl:choose>
6810
+ </xsl:variable>
6777
6811
 
6778
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6779
- <xsl:if test="number($scale) &lt; 100">
6812
+ <xsl:variable name="image_width_effective">
6780
6813
 
6781
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6814
+ <xsl:value-of select="$width_effective"/>
6782
6815
 
6783
- </xsl:if>
6816
+ </xsl:variable>
6817
+
6818
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
6819
+ <xsl:if test="number($scale) &lt; 100">
6820
+
6821
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6822
+
6823
+ </xsl:if>
6824
+ </xsl:otherwise>
6825
+ </xsl:choose>
6784
6826
 
6785
6827
  </xsl:if>
6786
6828
 
@@ -10462,7 +10504,7 @@
10462
10504
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10463
10505
  <xsl:apply-templates mode="update_xml_step1"/>
10464
10506
  </xsl:template>
10465
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
10507
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
10466
10508
  <xsl:copy>
10467
10509
  <xsl:copy-of select="@*"/>
10468
10510
  <xsl:apply-templates mode="update_xml_step1"/>