lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.3.7 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.3.8

- old
+ new

@@ -1245,11 +1245,13 @@ <xsl:attribute name="padding-right">5mm</xsl:attribute> - </xsl:attribute-set><xsl:attribute-set name="table-name-style"> + </xsl:attribute-set><xsl:variable name="table-border_"> + + </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style"> <xsl:attribute name="keep-with-next">always</xsl:attribute> @@ -1565,10 +1567,12 @@ <!-- <xsl:if test="$namespace = 'bipm'"> <fo:block>&#xA0;</fo:block> </xsl:if> --> + + <!-- Display table's name before table as standalone block --> <!-- $namespace = 'iso' or --> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> @@ -1644,10 +1648,16 @@ <xsl:attribute name="margin-right">0mm</xsl:attribute> + + + + <!-- display table's name before table for PAS inside block-container (2-columnn layout) --> + + <xsl:variable name="table_width"> <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) --> 100% @@ -1662,10 +1672,11 @@ + <attribute name="margin-left">0mm</attribute> @@ -2088,10 +2099,12 @@ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute> </xsl:otherwise> </xsl:choose> </xsl:for-each> + + <xsl:choose> <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']"> <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']"> <fo:table-column column-width="{@width}"/> </xsl:for-each> @@ -2124,10 +2137,11 @@ + <!-- for BSI (not PAS) display Notes before footnotes --> <!-- except gb --> @@ -2209,10 +2223,12 @@ + + </xsl:if> <xsl:if test="$parent-name = 'tfoot'"> @@ -2223,10 +2239,12 @@ + + <!-- <xsl:if test="$namespace = 'bipm'"> <xsl:attribute name="height">8mm</xsl:attribute> </xsl:if> --> <xsl:apply-templates/> @@ -3743,11 +3761,28 @@ <xsl:apply-templates select="." mode="cross_image"/> </fo:instream-foreign-object> </xsl:when> <xsl:otherwise> - <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/> + <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"> + <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])"> + + <xsl:variable name="img_src"> + <xsl:choose> + <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when> + <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/> + <xsl:if test="number($scale) &lt; 100"> + <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute> + </xsl:if> + + </xsl:if> + + </fo:external-graphic> </xsl:otherwise> </xsl:choose> </fo:block> </xsl:otherwise> @@ -3914,15 +3949,17 @@ <fo:block xsl:use-attribute-sets="image-style"> <fo:instream-foreign-object fox:alt-text="{$alt-text}"> <xsl:attribute name="width">100%</xsl:attribute> <xsl:attribute name="content-height">100%</xsl:attribute> <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/> + <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/> <!-- effective height 297 - 27.4 - 13 = 256.6 --> <!-- effective width 210 - 12.5 - 25 = 172.5 --> <!-- effective height / width = 1.48, 1.4 - with title --> - <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height --> - <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/> + <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height --> + <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/> <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute> </xsl:if> <xsl:attribute name="scaling">uniform</xsl:attribute> <xsl:copy-of select="$svg_content"/> </fo:instream-foreign-object> @@ -3935,10 +3972,27 @@ </xsl:copy> </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update"> <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink"> <xsl:value-of select="."/> </xsl:attribute> + </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update"> + <xsl:copy> + <xsl:apply-templates select="@*" mode="svg_update"/> + <xsl:variable name="viewbox"> + <xsl:call-template name="split"> + <xsl:with-param name="pText" select="@viewBox"/> + <xsl:with-param name="sep" select="' '"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="width"> + <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/> + </xsl:attribute> + <xsl:attribute name="height"> + <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/> + </xsl:attribute> + <xsl:apply-templates mode="svg_update"/> + </xsl:copy> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2"> <xsl:variable name="svg_content" select="document(@src)"/> <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/> <xsl:for-each select="xalan:nodeset($svg_content)/node()"> <xsl:call-template name="image_svg"> @@ -5726,34 +5780,54 @@ <xsl:with-param name="char" select="$char"/> <xsl:with-param name="count" select="$count - 1"/> </xsl:call-template> </xsl:if> </xsl:template><xsl:template name="getLocalizedString"> - <xsl:param name="key"/> + <xsl:param name="key"/> + <xsl:param name="formatted">false</xsl:param> <xsl:variable name="curr_lang"> <xsl:call-template name="getLang"/> </xsl:variable> - <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/> + <xsl:variable name="data_value"> + <xsl:choose> + <xsl:when test="$formatted = 'true'"> + <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> <xsl:choose> - <xsl:when test="$data_value != ''"> - <xsl:value-of select="$data_value"/> + <xsl:when test="normalize-space($data_value) != ''"> + <xsl:choose> + <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"> - <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> + <xsl:choose> + <xsl:when test="$formatted = 'true'"> + <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:variable name="key_"> <xsl:call-template name="capitalize"> <xsl:with-param name="str" select="translate($key, '_', ' ')"/> </xsl:call-template> </xsl:variable> <xsl:value-of select="$key_"/> </xsl:otherwise> </xsl:choose> - + </xsl:template><xsl:template name="setTrackChangesStyles"> <xsl:param name="isAdded"/> <xsl:param name="isDeleted"/> <xsl:choose> <xsl:when test="local-name() = 'math'"> \ No newline at end of file