lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.7.1 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.7.2

- old
+ new

@@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iho="https://www.metanorma.org/ns/iho" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0"> <xsl:output method="xml" encoding="UTF-8" indent="no"/> - <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"/> + <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"/> <xsl:variable name="debug">false</xsl:variable> <xsl:variable name="title-en"> <xsl:apply-templates select="/iho:iho-standard/iho:bibdata/iho:title[@language = 'en']/node()"/> @@ -3425,11 +3425,11 @@ <fn reference="1"> <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p> </fn> --> <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures --> - <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn"> + <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn"> <!-- list of footnotes to calculate actual footnotes number --> <xsl:variable name="p_fn_"> <xsl:call-template name="get_fn_list"/> </xsl:variable> @@ -3482,12 +3482,11 @@ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <xsl:value-of select="$current_fn_number_text"/> </fo:basic-link> </fo:inline> </xsl:variable> - <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/> - gen_id=<xsl:value-of select="$gen_id"/> --> + <xsl:choose> <xsl:when test="normalize-space(@skip_footnote_body) = 'true'"> <xsl:copy-of select="$footnote_inline"/> </xsl:when> <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'"> @@ -3538,11 +3537,11 @@ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*"> <xsl:sort select="@displayorder" data-type="number"/> <!-- commented: .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | because 'fn' there is in biblio-tag --> - <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]"> + <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))][generate-id(.)=generate-id(key('kfn',@reference)[1])]"> <!-- copy unique fn --> <fn gen_id="{generate-id(.)}"> <xsl:copy-of select="@*"/> <xsl:copy-of select="node()"/> </fn> @@ -6152,11 +6151,13 @@ </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:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute> + </xsl:if> </xsl:if> </fo:external-graphic> @@ -7166,10 +7167,16 @@ <xsl:attribute name="{local-name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> + <!-- remove margin between rows in the table with sourcecode line numbers --> + <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> + <xsl:attribute name="margin-top">0pt</xsl:attribute> + <xsl:attribute name="margin-bottom">0pt</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> </fo:block> <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content --> @@ -7214,11 +7221,11 @@ </xsl:otherwise> </xsl:choose> </xsl:template> <!-- outer table with line numbers for sourcecode --> - <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2"> + <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | --> <fo:block> <fo:table width="100%" table-layout="fixed"> <xsl:copy-of select="@id"/> <fo:table-column column-width="8%"/> <fo:table-column column-width="92%"/> @@ -7226,20 +7233,20 @@ <xsl:apply-templates/> </fo:table-body> </fo:table> </fo:block> </xsl:template> - <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2"> + <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | --> <xsl:apply-templates/> </xsl:template> - <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2"> + <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | --> <fo:table-row> <xsl:apply-templates/> </fo:table-row> </xsl:template> <!-- first td with line numbers --> - <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> + <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] --> <fo:table-cell> <fo:block> <!-- set attibutes for line numbers - same as sourcecode --> <xsl:variable name="sourcecode_attributes"> @@ -7255,12 +7262,13 @@ <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template> + <!-- second td with sourcecode --> - <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> + <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] --> <fo:table-cell> <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> @@ -7494,10 +7502,28 @@ <!-- pre --> <!-- =============== --> <xsl:template match="*[local-name()='pre']" name="pre"> <fo:block xsl:use-attribute-sets="pre-style"> <xsl:copy-of select="@id"/> - <xsl:apply-templates/> + <xsl:choose> + + <xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' --> + <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last --> + <xsl:attribute name="margin-top">0pt</xsl:attribute> + <xsl:attribute name="margin-bottom">0pt</xsl:attribute> + </xsl:if> + <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%"> + <math xmlns="http://www.w3.org/1998/Math/MathML"> + <mtext><xsl:value-of select="."/></mtext> + </math> + </fo:instream-foreign-object> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + + </xsl:choose> </fo:block> </xsl:template> <!-- =============== --> <!-- pre --> <!-- =============== --> \ No newline at end of file