lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.10.2 vs lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.10.3

- old
+ new

@@ -873,18 +873,18 @@ <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt. You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>, 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 --> <!-- - <misc-container> + <metanorma-extension> <presentation-metadata> <papersize>letter</papersize> </presentation-metadata> - </misc-container> + </metanorma-extension> --> - <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'])))"/> + <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'])))"/> <xsl:variable name="papersize_width_"> <xsl:choose> <xsl:when test="$papersize = 'letter'">215.9</xsl:when> <xsl:when test="$papersize = 'a4'">210</xsl:when> </xsl:choose> @@ -997,31 +997,31 @@ </xsl:variable> <xsl:variable name="titles" select="xalan:nodeset($titles_)"/> <xsl:variable name="title-list-tables"> - <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/> + <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/> <xsl:value-of select="$toc_table_title"/> <xsl:if test="normalize-space($toc_table_title) = ''"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="'title-list-tables'"/> </xsl:call-template> </xsl:if> </xsl:variable> <xsl:variable name="title-list-figures"> - <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/> + <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/> <xsl:value-of select="$toc_figure_title"/> <xsl:if test="normalize-space($toc_figure_title) = ''"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="'title-list-figures'"/> </xsl:call-template> </xsl:if> </xsl:variable> <xsl:variable name="title-list-recommendations"> - <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/> + <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/> <xsl:value-of select="$toc_requirement_title"/> <xsl:if test="normalize-space($toc_requirement_title) = ''"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="'title-list-recommendations'"/> </xsl:call-template> @@ -1089,11 +1089,11 @@ <xsl:template name="insertRootStyle"> <xsl:param name="root-style"/> <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/> <xsl:variable name="additional_fonts_"> - <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']"> + <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']"> <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if> </xsl:for-each> </xsl:variable> <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/> @@ -2127,14 +2127,14 @@ </xsl:for-each> </xsl:template> <xsl:template name="processTablesFigures_Contents"> <xsl:param name="always"/> - <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'"> + <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'"> <xsl:call-template name="processTables_Contents"/> </xsl:if> - <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'"> + <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'"> <xsl:call-template name="processFigures_Contents"/> </xsl:if> </xsl:template> <xsl:template name="processTables_Contents"> @@ -2476,10 +2476,12 @@ <xsl:if test="$margin-side != 0"> <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute> <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute> </xsl:if> + <xsl:call-template name="setBordersTableArray"/> + <xsl:if test="ancestor::*[local-name()='sections']"> <xsl:attribute name="border-top">1.5pt solid black</xsl:attribute> <xsl:attribute name="border-bottom">1.5pt solid black</xsl:attribute> </xsl:if> @@ -2622,10 +2624,14 @@ </xsl:otherwise> </xsl:choose> </xsl:template> + <xsl:template name="setBordersTableArray"> + + </xsl:template> + <xsl:template match="*[local-name()='table']/*[local-name() = 'name']"> <xsl:param name="continued"/> <xsl:if test="normalize-space() != ''"> <fo:block xsl:use-attribute-sets="table-name-style"> @@ -3096,10 +3102,12 @@ <fo:table-body> <fo:table-row> <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}"> + <xsl:call-template name="setBordersTableArray"/> + <!-- fn will be processed inside 'note' processing --> <!-- for BSI (not PAS) display Notes before footnotes --> <!-- except gb and bsi --> @@ -3217,10 +3225,12 @@ <!-- ===================== --> <!-- row in table header (thead) --> <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2"> <fo:table-row xsl:use-attribute-sets="table-header-row-style"> + <xsl:call-template name="setBordersTableArray"/> + <xsl:call-template name="setTableRowAttributes"/> <xsl:apply-templates/> </fo:table-row> </xsl:template> @@ -3240,10 +3250,12 @@ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only --> <xsl:attribute name="keep-with-next">always</xsl:attribute> </xsl:if> + <xsl:call-template name="setBordersTableArray"/> + <xsl:call-template name="setTableRowAttributes"/> <xsl:apply-templates/> </fo:table-row> </xsl:template> @@ -3259,10 +3271,12 @@ <fo:table-cell xsl:use-attribute-sets="table-header-cell-style"> <!-- text-align="{@align}" --> <xsl:call-template name="setTextAlignment"> <xsl:with-param name="default">center</xsl:with-param> </xsl:call-template> + <xsl:call-template name="setBordersTableArray"/> + <xsl:if test="ancestor::*[local-name()='sections']"> <xsl:attribute name="border">solid black 0pt</xsl:attribute> <xsl:attribute name="display-align">before</xsl:attribute> <xsl:attribute name="padding-top">1mm</xsl:attribute> </xsl:if> @@ -3326,10 +3340,12 @@ <xsl:attribute name="padding-right">1mm</xsl:attribute> </xsl:if> <!-- bsi --> + <xsl:call-template name="setBordersTableArray"/> + <xsl:if test="ancestor::*[local-name()='sections']"> <xsl:attribute name="border">solid black 0pt</xsl:attribute> <xsl:attribute name="padding-top">1mm</xsl:attribute> </xsl:if> @@ -6992,11 +7008,11 @@ <!-- =============== --> <!-- sourcecode --> <!-- =============== --> - <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/> + <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/> <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/> <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/> <xsl:template match="*[local-name() = 'property']" mode="css"> <xsl:attribute name="{@name}"> @@ -9037,12 +9053,12 @@ <!-- Table of Contents (ToC) processing --> <!-- =================== --> <xsl:variable name="toc_level"> <!-- https://www.metanorma.org/author/ref/document-attributes/ --> - <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:--> - <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 --> + <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:--> + <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 --> <xsl:choose> <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml --> <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml --> <xsl:otherwise><!-- default value --> 3 @@ -10035,9 +10051,10 @@ <xsl:variable name="align" select="normalize-space(@align)"/> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when> <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when> + <xsl:when test="$align = 'justified'">justify</xsl:when> <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when> <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when> <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when> <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise> </xsl:choose> \ No newline at end of file