lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-1.0.14 vs lib/isodoc/itu/itu.resolution.xsl in metanorma-itu-1.0.15

- old
+ new

@@ -2,15 +2,18 @@ <xsl:output method="xml" encoding="UTF-8" indent="no"/> + <xsl:key name="kfn" match="itu:p/itu:fn" use="@reference"/> + + <xsl:variable name="debug">false</xsl:variable> <xsl:variable name="pageWidth" select="'210mm'"/> <xsl:variable name="pageHeight" select="'297mm'"/> - + <!-- Rec. ITU-T G.650.1 (03/2018) --> <xsl:variable name="footerprefix" select="'Rec. '"/> <xsl:variable name="docname"> <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier, ' ')"/> <xsl:text> </xsl:text> @@ -364,14 +367,16 @@ <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement"/> <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:license-statement"/> <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:copyright-statement"/> </fo:block> - <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text> - DEBUG - contents=<xsl:copy-of select="xalan:nodeset($contents)"/> - <xsl:text disable-output-escaping="yes">--&gt;</xsl:text> + <xsl:if test="$debug = 'true'"> + <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text> + DEBUG + contents=<xsl:copy-of select="xalan:nodeset($contents)"/> + <xsl:text disable-output-escaping="yes">--&gt;</xsl:text> + </xsl:if> <xsl:if test="xalan:nodeset($contents)//item"> <fo:block break-after="page"/> <fo:block-container> <fo:block margin-top="6pt" text-align="center" font-weight="bold">Table of Contents</fo:block> @@ -877,10 +882,11 @@ calculate counts of '.' in numtmp value - level of nested lists --> <xsl:value-of select="string-length($numtmp) - string-length(translate($numtmp, '.', '')) + 1"/> </xsl:variable> <xsl:choose> + <xsl:when test="local-name(..) = 'ul' and itu:ul and local-name(../../..) != 'ul'">•</xsl:when> <!-- dash &#x2014; --> <xsl:when test="local-name(..) = 'ul'">–</xsl:when> <!-- dash &#x2014; --> <xsl:otherwise> <!-- for Ordered Lists --> <xsl:choose> <xsl:when test="../@type = 'arabic'"> @@ -894,11 +900,13 @@ </xsl:when> <xsl:when test="$level = 2"> <xsl:number format="i)"/> </xsl:when> <xsl:otherwise> - <xsl:number format="1.)"/> + <!-- <xsl:number format="1.)"/> --> + <!-- https://github.com/metanorma/mn-native-pdf/issues/156 --> + <xsl:number format="1)"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -962,10 +970,13 @@ </xsl:template> <xsl:template match="itu:note/itu:p" name="note"> <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/> <fo:block font-size="11pt" space-before="4pt" text-align="justify"> + <xsl:if test="ancestor::itu:figure"> + <xsl:attribute name="keep-with-previous">always</xsl:attribute> + </xsl:if> <xsl:text>NOTE </xsl:text> <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> --> <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1"> <xsl:number count="itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]" level="any"/> </xsl:if> @@ -1257,32 +1268,56 @@ </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template> + <xsl:variable name="p_fn"> + <xsl:for-each select="//itu:p/itu:fn[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> + </xsl:for-each> + </xsl:variable> + <xsl:template match="itu:p/itu:fn" priority="2"> - <fo:footnote> - <xsl:variable name="number"> - <xsl:number level="any" count="itu:p/itu:fn"/> - </xsl:variable> - <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super"> - <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}"> - <!-- <xsl:value-of select="@reference"/> --> - <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/> - </fo:basic-link> - </fo:inline> - <fo:footnote-body> - <fo:block font-size="11pt" margin-bottom="12pt"> - <fo:inline id="footnote_{@reference}_{$number}" font-size="85%" padding-right="2mm" keep-with-next.within-line="always" baseline-shift="30%"> <!-- alignment-baseline="hanging" --> - <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/> + <xsl:variable name="gen_id" select="generate-id(.)"/> + <xsl:variable name="reference" select="@reference"/> + <xsl:variable name="number"> + <!-- <xsl:number level="any" count="itu:p/itu:fn"/> --> + <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]"> + <fo:footnote> + <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super"> + <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}"> + <!-- <xsl:value-of select="@reference"/> --> + <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/> + </fo:basic-link> </fo:inline> - <xsl:for-each select="itu:p"> - <xsl:apply-templates/> - </xsl:for-each> - </fo:block> - </fo:footnote-body> - </fo:footnote> + <fo:footnote-body> + <fo:block font-size="11pt" margin-bottom="12pt"> + <fo:inline id="footnote_{@reference}_{$number}" font-size="85%" padding-right="2mm" keep-with-next.within-line="always" baseline-shift="30%"> + <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/> + </fo:inline> + <xsl:for-each select="itu:p"> + <xsl:apply-templates/> + </xsl:for-each> + </fo:block> + </fo:footnote-body> + </fo:footnote> + </xsl:when> + <xsl:otherwise> + <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super"> + <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}"> + <xsl:value-of select="$number + count(//itu:bibitem/itu:note)"/> + </fo:basic-link> + </fo:inline> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="*[local-name()='tt']" priority="2"> <xsl:variable name="element-name"> @@ -1323,16 +1358,20 @@ <xsl:text>Figure </xsl:text> <xsl:value-of select="$itemnumber"/> </xsl:if> <xsl:if test="itu:name"> <xsl:text> — </xsl:text> - <xsl:value-of select="itu:name"/> + <xsl:apply-templates select="itu:name" mode="process"/> </xsl:if> </fo:block> </fo:block-container> </xsl:template> + <xsl:template match="itu:figure/itu:name" mode="process"> + <xsl:apply-templates/> + </xsl:template> + <xsl:template match="itu:figure/itu:name"/> <xsl:template match="itu:figure/itu:fn" priority="2"/> <xsl:template match="itu:figure/itu:note"/> <!-- itu:figure/itu:image --> @@ -1427,10 +1466,13 @@ <xsl:if test="../preceding-sibling::*[1][local-name() = 'title']"> <xsl:attribute name="margin-left">18mm</xsl:attribute> </xsl:if> <xsl:if test="local-name(..) = 'ul'"> <xsl:attribute name="margin-left">15mm</xsl:attribute> + <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1"> + <xsl:attribute name="margin-left">7mm</xsl:attribute> + </xsl:if> </xsl:if> <fo:block-container margin-left="0mm"> <xsl:apply-templates/> <xsl:apply-templates select=".//itu:note" mode="process"/> </fo:block-container> @@ -1446,29 +1488,20 @@ </xsl:if> --> <xsl:apply-templates/> </fo:block> </xsl:template> - <xsl:template match="itu:link"> + <xsl:template match="itu:link" priority="2"> <fo:inline color="blue"> <xsl:if test="local-name(..) = 'formattedref' or ancestor::itu:preface"> <xsl:attribute name="font-family">Arial</xsl:attribute> <xsl:attribute name="font-size">8pt</xsl:attribute> <xsl:if test="local-name(..) = 'formattedref'"> <xsl:attribute name="text-decoration">underline</xsl:attribute> </xsl:if> </xsl:if> - <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}"> - <xsl:choose> - <xsl:when test="normalize-space(.) = ''"> - <xsl:value-of select="@target"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates/> - </xsl:otherwise> - </xsl:choose> - </fo:basic-link> + <xsl:call-template name="link"/> </fo:inline> </xsl:template> <xsl:template match="itu:termnote"> @@ -1695,22 +1728,25 @@ </xsl:when> <xsl:otherwise> <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text> </xsl:otherwise> </xsl:choose> - <xsl:if test="itu:locality"> - <xsl:text>, </xsl:text> - <xsl:choose> - <xsl:when test="itu:locality/@type = 'section'">Section </xsl:when> - <xsl:otherwise/> - </xsl:choose> - <xsl:apply-templates select="itu:locality"/> - </xsl:if> + + <xsl:apply-templates select="itu:localityStack"/> + </fo:basic-link> </fo:inline> </xsl:template> + <xsl:template match="itu:locality"> + <xsl:choose> + <xsl:when test="@type ='section'">Section</xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:value-of select="itu:referenceFrom"/> + </xsl:template> + <xsl:template match="itu:references[position() &gt; 1]"> <fo:block break-after="page"/> <xsl:apply-templates/> </xsl:template> @@ -2363,15 +2399,18 @@ <xsl:value-of select="concat(local-name(..), '_', text())"/> </xsl:otherwise> </xsl:choose> </xsl:template> -<xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()"> +<xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style"> + + + </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()"> <xsl:value-of select="."/> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']"> <xsl:value-of select="$linebreak"/> - </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="1"> + </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1"> <xsl:call-template name="add-zero-spaces"/> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']"> <xsl:variable name="simple-table"> <!-- <xsl:copy> --> @@ -2385,12 +2424,14 @@ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> --> <fo:block space-before="18pt"> </fo:block> + <!-- <xsl:if test="$namespace = 'iso'"> + <fo:block space-before="6pt">&#xA0;</fo:block> + </xsl:if> --> - <xsl:choose> <xsl:when test="@unnumbered = 'true'"/> <xsl:otherwise> @@ -2399,18 +2440,22 @@ + + <xsl:text>Table </xsl:text> <xsl:choose> <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST --> <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/> </xsl:when> <xsl:when test="ancestor::*[local-name()='annex']"> + + <xsl:choose> <xsl:when test="ancestor::itu:annex[@obligation = 'informative']"> <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/> <!-- Table in Appendix --> <xsl:number format="I-" count="itu:annex[@obligation = 'informative']"/> @@ -2479,15 +2524,15 @@ <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="table" select="$simple-table"/> </xsl:call-template> </xsl:variable> - <xsl:variable name="colwidths2"> + <!-- <xsl:variable name="colwidths2"> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="$cols-count"/> </xsl:call-template> - </xsl:variable> + </xsl:variable> --> <!-- cols-count=<xsl:copy-of select="$cols-count"/> colwidthsNew=<xsl:copy-of select="$colwidths"/> colwidthsOld=<xsl:copy-of select="$colwidths2"/>z --> @@ -2509,11 +2554,12 @@ <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> <xsl:attribute name="space-after">18pt</xsl:attribute> - <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm"> + + <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true"> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> @@ -2521,10 +2567,11 @@ + <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:for-each select="xalan:nodeset($colwidths)//column"> <xsl:choose> @@ -2536,10 +2583,13 @@ </xsl:otherwise> </xsl:choose> </xsl:for-each> <xsl:apply-templates/> </fo:table> + + + </fo:block-container> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process"> <xsl:apply-templates/> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers"> <xsl:param name="table-row"/> @@ -2589,13 +2639,17 @@ </xsl:for-each> </xsl:when> <xsl:otherwise> <xsl:for-each select="xalan:nodeset($table)//tr"> + <xsl:variable name="td_text"> + <xsl:apply-templates select="td[$curr-col]" mode="td_text"/> + </xsl:variable> <xsl:variable name="words"> <xsl:call-template name="tokenize"> - <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> + <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> --> + <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> </xsl:call-template> </xsl:variable> <xsl:variable name="max_length"> <xsl:call-template name="max_length"> <xsl:with-param name="words" select="xalan:nodeset($words)"/> @@ -2632,66 +2686,90 @@ <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="curr-col" select="$curr-col +1"/> <xsl:with-param name="table" select="$table"/> </xsl:call-template> </xsl:if> + </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text"> + <xsl:variable name="zero-space">​</xsl:variable> + <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process"> - <!-- <fo:table-header font-weight="bold"> - <xsl:apply-templates /> - </fo:table-header> --> - <xsl:apply-templates/> + <!-- font-weight="bold" --> + <fo:table-header> + <xsl:apply-templates/> + </fo:table-header> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process"> <xsl:apply-templates/> + </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter"> + <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/> + <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'"> + + <fo:table-footer> + + <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> + + <!-- if there are note(s) or fn(s) then create footer row --> + <xsl:if test="$isNoteOrFnExist = 'true'"> + + <xsl:variable name="cols-count"> + <xsl:choose> + <xsl:when test="../*[local-name()='thead']"> + <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> --> + <xsl:call-template name="calculate-columns-numbers"> + <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> --> + <xsl:call-template name="calculate-columns-numbers"> + <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <fo:table-row> + <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}"> + + + + <xsl:if test="ancestor::*[local-name()='preface']"> + <xsl:attribute name="border">solid black 0pt</xsl:attribute> + </xsl:if> + + <!-- fn will be processed inside 'note' processing --> + + + <!-- except gb --> + + <xsl:apply-templates select="../*[local-name()='note']" mode="process"/> + + + <!-- horizontal row separator --> + + + <!-- fn processing --> + <xsl:call-template name="fn_display"/> + + </fo:table-cell> + </fo:table-row> + + </xsl:if> + </fo:table-footer> + + </xsl:if> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']"> - <xsl:variable name="cols-count"> - <xsl:choose> - <xsl:when test="../*[local-name()='thead']"> - <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> --> - <xsl:call-template name="calculate-columns-numbers"> - <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> --> - <xsl:call-template name="calculate-columns-numbers"> - <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - + + <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/> + + <xsl:call-template name="insertTableFooter"/> + <fo:table-body> - <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/> <xsl:apply-templates/> - <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> - <!-- if there are note(s) or fn(s) then create footer row --> - <xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"> - <fo:table-row> - <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}"> - - - - <xsl:if test="ancestor::*[local-name()='preface']"> - <xsl:attribute name="border">solid black 0pt</xsl:attribute> - </xsl:if> - - <!-- fn will be processed inside 'note' processing --> - - - <xsl:apply-templates select="../*[local-name()='note']" mode="process"/> - - <!-- horizontal row separator --> - - - <!-- fn processing --> - <xsl:call-template name="fn_display"/> - - </fo:table-cell> - </fo:table-row> - - </xsl:if> + <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> --> + </fo:table-body> + </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']"> <xsl:variable name="parent-name" select="local-name(..)"/> <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> --> <fo:table-row min-height="4mm"> <xsl:if test="$parent-name = 'thead'"> @@ -2705,10 +2783,11 @@ <xsl:if test="$parent-name = 'tfoot'"> </xsl:if> + <xsl:apply-templates/> </fo:table-row> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']"> <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center"> @@ -2748,10 +2827,12 @@ + + <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -2780,19 +2861,23 @@ <fo:block font-size="10pt" margin-bottom="12pt"> + <fo:inline padding-right="2mm"> + <xsl:text>NOTE </xsl:text> <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/> <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1"> <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/> </xsl:if> + + </fo:inline> <xsl:apply-templates mode="process"/> </fo:block> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process"> @@ -2815,17 +2900,19 @@ <xsl:variable name="reference" select="@reference"/> <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note--> <fo:block margin-bottom="12pt"> + <fo:inline font-size="80%" padding-right="5mm" id="{@id}"> <xsl:attribute name="vertical-align">super</xsl:attribute> + <xsl:attribute name="padding-right">3mm</xsl:attribute> <xsl:value-of select="@reference"/> @@ -2911,10 +2998,11 @@ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']"> <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> --> <fo:inline font-size="80%" keep-with-previous.within-line="always"> + <xsl:attribute name="vertical-align">super</xsl:attribute> <xsl:attribute name="color">blue</xsl:attribute> <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id--> @@ -2936,11 +3024,11 @@ <xsl:choose> <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component --> <fo:block margin-bottom="12pt" text-align="left"> - + <xsl:text>where </xsl:text> <xsl:apply-templates select="*[local-name()='dt']/*"/> <xsl:text/> <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/> </fo:block> @@ -2951,17 +3039,19 @@ <xsl:attribute name="margin-bottom">6pt</xsl:attribute> + <xsl:text>where</xsl:text> </fo:block> </xsl:when> <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <fo:block font-weight="bold" text-align="left" margin-bottom="12pt"> + <xsl:text>Key</xsl:text> </fo:block> </xsl:when> </xsl:choose> @@ -2973,13 +3063,13 @@ <xsl:if test="local-name(..) = 'li'"> <xsl:attribute name="margin-left">-4mm</xsl:attribute> </xsl:if> - <fo:block> + <!-- create virtual html table for dl/[dt and dd] --> <xsl:variable name="html-table"> <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> <xsl:element name="{$ns}:table"> <tbody> @@ -2995,10 +3085,11 @@ </xsl:call-template> </xsl:variable> <!-- colwidths=<xsl:value-of select="$colwidths"/> --> <fo:table width="95%" table-layout="fixed"> + <xsl:choose> <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"> <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> --> </xsl:when> <xsl:when test="normalize-space($key_iso) = 'true'"> @@ -3094,17 +3185,19 @@ <fo:table-row> <fo:table-cell> <fo:block margin-top="6pt"> + <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="margin-top">0</xsl:attribute> </xsl:if> <xsl:apply-templates/> + </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> @@ -3121,11 +3214,11 @@ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process"> <xsl:apply-templates/> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process"> <xsl:apply-templates/> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline"> - <fo:inline><xsl:apply-templates/></fo:inline> + <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']"> <fo:inline font-style="italic"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']"> @@ -3236,10 +3329,11 @@ <xsl:param name="text" select="."/> <xsl:variable name="zero-space-after-chars">-</xsl:variable> <xsl:variable name="zero-space-after-dot">.</xsl:variable> <xsl:variable name="zero-space-after-colon">:</xsl:variable> <xsl:variable name="zero-space-after-equal">=</xsl:variable> + <xsl:variable name="zero-space-after-underscore">_</xsl:variable> <xsl:variable name="zero-space">​</xsl:variable> <xsl:choose> <xsl:when test="contains($text, $zero-space-after-chars)"> <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/> <xsl:value-of select="$zero-space-after-chars"/> @@ -3270,10 +3364,18 @@ <xsl:value-of select="$zero-space"/> <xsl:call-template name="add-zero-spaces"> <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/> </xsl:call-template> </xsl:when> + <xsl:when test="contains($text, $zero-space-after-underscore)"> + <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/> + <xsl:value-of select="$zero-space-after-underscore"/> + <xsl:value-of select="$zero-space"/> + <xsl:call-template name="add-zero-spaces"> + <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/> + </xsl:call-template> + </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal"> @@ -3445,7 +3547,43 @@ </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math"> <fo:inline font-family="STIX2Math"> <fo:instream-foreign-object fox:alt-text="Math"> <xsl:copy-of select="."/> </fo:instream-foreign-object> + </fo:inline> + </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']"> + <xsl:for-each select="*[local-name()='locality']"> + <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if> + <xsl:apply-templates select="."/> + <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if> + </xsl:for-each> + </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link"> + <xsl:variable name="target"> + <xsl:choose> + <xsl:when test="starts-with(normalize-space(@target), 'mailto:')"> + <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(@target)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <fo:inline xsl:use-attribute-sets="link-style"> + <xsl:choose> + <xsl:when test="$target = ''"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}"> + <xsl:choose> + <xsl:when test="normalize-space(.) = ''"> + <xsl:value-of select="$target"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </fo:basic-link> + </xsl:otherwise> + </xsl:choose> </fo:inline> </xsl:template></xsl:stylesheet> \ No newline at end of file