lib/isodoc/itu/itu.implementers-guide.xsl in metanorma-itu-2.2.3 vs lib/isodoc/itu/itu.implementers-guide.xsl in metanorma-itu-2.2.4

- old
+ new

@@ -1296,25 +1296,46 @@ <!-- ============================= --> <!-- PREFACE (Summary, History, ...) --> <!-- ============================= --> + <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="3"> + <xsl:choose> + <xsl:when test="preceding-sibling::*"> + <!-- page-break before 2nd and next elements only --> + <fo:block break-after="page"/> + </xsl:when> + <xsl:otherwise> + <fo:block font-size="12pt"> + <xsl:value-of select="$linebreak"/> + <xsl:value-of select="$linebreak"/> + </fo:block> + </xsl:otherwise> + </xsl:choose> + <fo:block> + <xsl:call-template name="setId"/> + <xsl:apply-templates/> + </fo:block> + </xsl:template> + <!-- Summary --> <xsl:template match="itu:itu-standard/itu:preface/itu:abstract[@id = '_summary']" priority="3"> <fo:block font-size="12pt"> <xsl:value-of select="$linebreak"/> <xsl:value-of select="$linebreak"/> </fo:block> - <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt"> - <xsl:variable name="title-summary"> - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-summary'"/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select="$title-summary"/> + <fo:block id="{@id}"> + <fo:block font-weight="bold" keep-with-next="always" margin-top="18pt" margin-bottom="18pt" role="H2"> + <xsl:variable name="title-summary"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-summary'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-summary"/> + </fo:block> + <xsl:apply-templates/> </fo:block> - <xsl:apply-templates/> </xsl:template> <xsl:template match="itu:itu-standard/itu:preface/itu:abstract[@id = '_summary']/itu:title" priority="4"/> <xsl:template match="itu:preface/itu:clause" priority="3"> <xsl:if test="$doctype != 'service-publication'"> @@ -2111,18 +2132,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> @@ -2233,31 +2254,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> @@ -2325,11 +2346,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_)"/> @@ -3047,21 +3068,32 @@ </xsl:attribute-set> <!-- fn-body-num-style --> <!-- admonition --> <xsl:attribute-set name="admonition-style"> + <xsl:attribute name="border">0.5pt solid black</xsl:attribute> + <xsl:attribute name="space-before">12pt</xsl:attribute> + <xsl:attribute name="space-after">12pt</xsl:attribute> + </xsl:attribute-set> <!-- admonition-style --> <xsl:attribute-set name="admonition-container-style"> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> + <xsl:attribute name="padding">2mm</xsl:attribute> + <xsl:attribute name="padding-top">3mm</xsl:attribute> + </xsl:attribute-set> <!-- admonition-container-style --> <xsl:attribute-set name="admonition-name-style"> <xsl:attribute name="keep-with-next">always</xsl:attribute> + <xsl:attribute name="text-align">center</xsl:attribute> + <xsl:attribute name="margin-bottom">6pt</xsl:attribute> + <xsl:attribute name="font-weight">bold</xsl:attribute> + </xsl:attribute-set> <!-- admonition-name-style --> <xsl:attribute-set name="admonition-p-style"> </xsl:attribute-set> <!-- admonition-p-style --> @@ -3379,14 +3411,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"> @@ -3728,10 +3760,12 @@ <xsl:attribute name="margin-right">0mm</xsl:attribute> </xsl:if> <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute> + <xsl:call-template name="setBordersTableArray"/> + <xsl:if test="$doctype = 'service-publication'"> <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> </xsl:if> </xsl:element> @@ -3876,10 +3910,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"> @@ -4365,10 +4403,12 @@ </xsl:if> <xsl:if test="$doctype = 'service-publication'"> <xsl:attribute name="border">none</xsl:attribute> </xsl:if> + <xsl:call-template name="setBordersTableArray"/> + <!-- fn will be processed inside 'note' processing --> <xsl:if test="$doctype = 'service-publication'"> <fo:block margin-top="7pt" margin-bottom="2pt"><fo:inline>____________</fo:inline></fo:block> </xsl:if> @@ -4490,10 +4530,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:if test="$doctype = 'service-publication'"> <xsl:attribute name="border-bottom">1.1pt solid black</xsl:attribute> </xsl:if> <xsl:call-template name="setTableRowAttributes"/> @@ -4517,10 +4559,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> @@ -4540,10 +4584,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()='preface']"> <xsl:if test="$doctype != 'service-publication'"> <xsl:attribute name="border">solid black 0pt</xsl:attribute> </xsl:if> </xsl:if> @@ -4603,10 +4649,12 @@ <xsl:attribute name="padding-right">1mm</xsl:attribute> </xsl:if> <!-- bsi --> + <xsl:call-template name="setBordersTableArray"/> + <xsl:if test="ancestor::*[local-name()='preface']"> <xsl:attribute name="border">solid black 0pt</xsl:attribute> </xsl:if> <xsl:if test="$doctype = 'service-publication'"> <xsl:attribute name="border">1pt solid rgb(211,211,211)</xsl:attribute> @@ -8275,11 +8323,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}"> @@ -10366,12 +10414,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 --> 2 @@ -11359,9 +11407,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