lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.10.10 vs lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.10.11

- old
+ new

@@ -1849,10 +1849,14 @@ <xsl:attribute name="text-align">right</xsl:attribute> </xsl:attribute-set> <!-- formula-stem-number-style --> <!-- End Formula's styles --> + <xsl:template name="refine_formula-stem-number-style"> + + </xsl:template> + <xsl:attribute-set name="image-style"> <xsl:attribute name="text-align">center</xsl:attribute> <xsl:attribute name="margin-bottom">12pt</xsl:attribute> <xsl:attribute name="keep-with-next">always</xsl:attribute> @@ -2344,17 +2348,17 @@ <xsl:variable name="ace_tag">ace-tag_</xsl:variable> <xsl:template name="processPrefaceSectionsDefault_Contents"> <xsl:variable name="nodes_preface_"> - <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]"> + <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition' or @type = 'toc')]"> <node id="{@id}"/> </xsl:for-each> </xsl:variable> <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/> - <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]"> + <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition' or @type = 'toc')]"> <xsl:sort select="@displayorder" data-type="number"/> <!-- process Section's title --> <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/> <xsl:if test="$preceding-sibling_id != ''"> @@ -2384,16 +2388,16 @@ </xsl:if> <xsl:apply-templates select="." mode="contents"/> </xsl:for-each> - <xsl:for-each select="/*/*[local-name()='annex']"> + <!-- <xsl:for-each select="/*/*[local-name()='annex']"> <xsl:sort select="@displayorder" data-type="number"/> <xsl:apply-templates select="." mode="contents"/> - </xsl:for-each> + </xsl:for-each> --> - <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]"> + <xsl:for-each select="/*/*[local-name()='annex'] | /*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]"> <xsl:sort select="@displayorder" data-type="number"/> <xsl:apply-templates select="." mode="contents"/> </xsl:for-each> </xsl:template> @@ -2890,11 +2894,11 @@ <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"> + <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP"> <xsl:call-template name="refine_table-name-style"> <xsl:with-param name="continued" select="$continued"/> </xsl:call-template> @@ -3275,21 +3279,21 @@ <!-- template is using for iec, iso, jcgm, bsi only --> <xsl:template name="table-header-title"> <xsl:param name="cols-count"/> <!-- row for title --> - <fo:table-row> - <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black"> + <fo:table-row role="SKIP"> + <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black" role="SKIP"> <xsl:call-template name="refine_table-header-title-style"/> <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']"> <xsl:with-param name="continued">true</xsl:with-param> </xsl:apply-templates> <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name --> - <fo:block/> + <fo:block role="SKIP"/> </xsl:if> </fo:table-cell> </fo:table-row> </xsl:template> <!-- table-header-title --> @@ -3596,11 +3600,11 @@ <xsl:with-param name="default">center</xsl:with-param> </xsl:call-template> <xsl:call-template name="refine_table-header-cell-style"/> - <fo:block> + <fo:block role="SKIP"> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template> <!-- cell in table header row - 'th' --> @@ -3649,11 +3653,11 @@ <xsl:if test="$isGenerateTableIF = 'true'"> <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width --> <xsl:attribute name="text-align">left</xsl:attribute> </xsl:if> - <fo:block> + <fo:block role="SKIP"> <xsl:if test="$isGenerateTableIF = 'true'"> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> </xsl:if> @@ -4512,11 +4516,11 @@ <td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td> </tr> --> <fo:table-row> <fo:table-cell number-columns-spanned="2"> - <fo:block> + <fo:block role="SKIP"> <xsl:call-template name="note"/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:template> <!-- END: dl/note --> @@ -4577,11 +4581,11 @@ </xsl:if> <xsl:call-template name="refine_dt-cell-style"/> - <fo:block xsl:use-attribute-sets="dt-block-style"> + <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP"> <xsl:copy-of select="@id"/> <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="margin-top">0</xsl:attribute> </xsl:if> @@ -4607,11 +4611,11 @@ <xsl:attribute name="border">0.1pt solid black</xsl:attribute> </xsl:if> <xsl:call-template name="refine_dd-cell-style"/> - <fo:block> + <fo:block role="SKIP"> <xsl:if test="$isGenerateTableIF = 'true'"> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> </xsl:if> @@ -4980,15 +4984,45 @@ </fo:inline> </xsl:template> <xsl:template match="text()[ancestor::*[local-name()='smallcap']]"> <xsl:variable name="text" select="normalize-space(.)"/> - <fo:inline font-size="75%"> + <fo:inline font-size="75%" role="SKIP"> <xsl:if test="string-length($text) &gt; 0"> - <xsl:call-template name="recursiveSmallCaps"> - <xsl:with-param name="text" select="$text"/> - </xsl:call-template> + <xsl:variable name="smallCapsText"> + <xsl:call-template name="recursiveSmallCaps"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <!-- merge neighboring fo:inline --> + <xsl:for-each select="xalan:nodeset($smallCapsText)/node()"> + <xsl:choose> + <xsl:when test="self::fo:inline and preceding-sibling::node()[1][self::fo:inline]"><!-- <xsl:copy-of select="."/> --></xsl:when> + <xsl:when test="self::fo:inline and @font-size"> + <xsl:variable name="curr_pos" select="count(preceding-sibling::node()) + 1"/> + <!-- <curr_pos><xsl:value-of select="$curr_pos"/></curr_pos> --> + <xsl:variable name="next_text_" select="count(following-sibling::node()[not(local-name() = 'inline')][1]/preceding-sibling::node())"/> + <xsl:variable name="next_text"> + <xsl:choose> + <xsl:when test="$next_text_ = 0">99999999</xsl:when> + <xsl:otherwise><xsl:value-of select="$next_text_ + 1"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- <next_text><xsl:value-of select="$next_text"/></next_text> --> + <fo:inline> + <xsl:copy-of select="@*"/> + <xsl:copy-of select="./node()"/> + <xsl:for-each select="following-sibling::node()[position() &lt; $next_text - $curr_pos]"> <!-- [self::fo:inline] --> + <xsl:copy-of select="./node()"/> + </xsl:for-each> + </fo:inline> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> </xsl:if> </fo:inline> </xsl:template> <xsl:template name="recursiveSmallCaps"> @@ -4996,11 +5030,11 @@ <xsl:variable name="char" select="substring($text,1,1)"/> <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> --> <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/> <xsl:choose> <xsl:when test="$char=$upperCase"> - <fo:inline font-size="{100 div 0.75}%"> + <fo:inline font-size="{100 div 0.75}%" role="SKIP"> <xsl:value-of select="$upperCase"/> </fo:inline> </xsl:when> <xsl:otherwise> <xsl:value-of select="$upperCase"/> @@ -5158,18 +5192,26 @@ <xsl:param name="separator" select="' '"/> <xsl:choose> <xsl:when test="not(contains($text, $separator))"> <word> + <xsl:if test="ancestor::*[local-name() = 'p'][@from_dl = 'true']"> + <xsl:text> + </xsl:text> <!-- to add distance between dt and dd --> + </xsl:if> <xsl:call-template name="enclose_text_in_tags"> <xsl:with-param name="text" select="normalize-space($text)"/> <xsl:with-param name="tags" select="$tags"/> </xsl:call-template> </word> </xsl:when> <xsl:otherwise> <word> + <xsl:if test="ancestor::*[local-name() = 'p'][@from_dl = 'true']"> + <xsl:text> + </xsl:text> <!-- to add distance between dt and dd --> + </xsl:if> <xsl:call-template name="enclose_text_in_tags"> <xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/> <xsl:with-param name="tags" select="$tags"/> </xsl:call-template> </word> @@ -5349,10 +5391,14 @@ <!-- Table normalization (colspan,rowspan processing for adding TDs) for column width calculation --> <xsl:template name="getSimpleTable"> <xsl:param name="id"/> + <!-- <test0> + <xsl:copy-of select="."/> + </test0> --> + <xsl:variable name="simple-table"> <!-- Step 0. replace <br/> to <p>...</p> --> <xsl:variable name="table_without_br"> <xsl:apply-templates mode="table-without-br"/> @@ -6394,19 +6440,22 @@ <fo:table-column column-width="95%"/> <fo:table-column column-width="5%"/> <fo:table-body> <fo:table-row> <fo:table-cell display-align="center"> - <fo:block xsl:use-attribute-sets="formula-stem-block-style"> + <fo:block xsl:use-attribute-sets="formula-stem-block-style" role="SKIP"> <xsl:call-template name="refine_formula-stem-block-style"/> <xsl:apply-templates/> </fo:block> </fo:table-cell> <fo:table-cell display-align="center"> - <fo:block xsl:use-attribute-sets="formula-stem-number-style"> + <fo:block xsl:use-attribute-sets="formula-stem-number-style" role="SKIP"> + + <xsl:call-template name="refine_formula-stem-number-style"/> + <xsl:apply-templates select="../*[local-name() = 'name']"/> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> @@ -7924,11 +7973,11 @@ </xsl:template> <!-- second td with sourcecode --> <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> + <fo:block role="SKIP"> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template> <!-- END outer table with line numbers for sourcecode --> @@ -8411,11 +8460,11 @@ <xsl:with-param name="default">left</xsl:with-param> </xsl:call-template> <xsl:call-template name="setTableCellAttributes"/> - <fo:block> + <fo:block role="SKIP"> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template> @@ -8433,11 +8482,11 @@ <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:if> <xsl:call-template name="setTableCellAttributes"/> - <fo:block> + <fo:block role="SKIP"> <xsl:apply-templates/> </fo:block> </fo:table-cell> </xsl:template> @@ -9211,11 +9260,52 @@ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/> <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" --> - <xsl:value-of select="@label"/> + + <xsl:variable name="label"> + + <xsl:variable name="type" select="../@type"/> + + <xsl:variable name="style_prefix_"> + <xsl:if test="$type = 'roman'"> + <!-- Example: (i) --> + </xsl:if> + </xsl:variable> + <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/> + + <xsl:variable name="style_suffix_"> + <xsl:choose> + <xsl:when test="$type = 'arabic'"> + ) + </xsl:when> + <xsl:when test="$type = 'alphabet' or $type = 'alphabetic'"> + ) + </xsl:when> + <xsl:when test="$type = 'alphabet_upper' or $type = 'alphabetic_upper'"> + . + </xsl:when> + <xsl:when test="$type = 'roman'"> + ) + </xsl:when> + <xsl:when test="$type = 'roman_upper'">.</xsl:when> <!-- Example: I. --> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style_suffix" select="normalize-space($style_suffix_)"/> + + <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))"> + <xsl:value-of select="$style_prefix"/> + </xsl:if> + <xsl:value-of select="@label"/> + <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))"> + <xsl:value-of select="$style_suffix"/> + </xsl:if> + </xsl:variable> + + <xsl:value-of select="normalize-space($label)"/> + </xsl:when> <xsl:otherwise> <!-- for ordered lists 'ol' --> <!-- Example: for BSI <?list-start 2?> --> <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/> @@ -9408,11 +9498,11 @@ <xsl:copy-of select="@id"/> <xsl:call-template name="refine_list-item-style"/> <fo:list-item-label end-indent="label-end()"> - <fo:block xsl:use-attribute-sets="list-item-label-style"> + <fo:block xsl:use-attribute-sets="list-item-label-style" role="SKIP"> <xsl:call-template name="refine_list-item-label-style"/> <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' --> <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]"> @@ -9422,11 +9512,11 @@ <xsl:call-template name="getListItemFormat"/> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style"> - <fo:block> + <fo:block role="SKIP"> <xsl:call-template name="refine_list-item-body-style"/> <xsl:apply-templates/> @@ -9701,14 +9791,14 @@ <fo:table-column column-width="107mm"/> <fo:table-column column-width="15mm"/> <fo:table-body> <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white"> - <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell> - <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell> - <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell> - <fo:table-cell border="1pt solid black"><fo:block>Pages</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid black"><fo:block role="SKIP">Date</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid black"><fo:block role="SKIP">Type</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid black"><fo:block role="SKIP">Change</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid black"><fo:block role="SKIP">Pages</fo:block></fo:table-cell> </fo:table-row> <xsl:apply-templates/> </fo:table-body> </fo:table> </xsl:template> @@ -9719,11 +9809,11 @@ </fo:table-row> </xsl:template> <xsl:template match="*[local-name() = 'errata']/*[local-name() = 'row']/*"> <fo:table-cell border="1pt solid black" padding-left="1mm" padding-top="0.5mm"> - <fo:block><xsl:apply-templates/></fo:block> + <fo:block role="SKIP"><xsl:apply-templates/></fo:block> </fo:table-cell> </xsl:template> <!-- ============ --> <!-- END errata --> <!-- ============ --> @@ -10001,11 +10091,11 @@ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> --> <xsl:variable name="target" select="@target"/> <xsl:for-each select="*[local-name() = 'tab']"> <xsl:variable name="current_id" select="generate-id()"/> <fo:table-cell> - <fo:block line-height-shift-adjustment="disregard-shifts"> + <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP"> <xsl:call-template name="insert_basic_link"> <xsl:with-param name="element"> <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}"> <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]"> <xsl:choose> @@ -10019,10 +10109,10 @@ </fo:block> </fo:table-cell> </xsl:for-each> <!-- last column - for page numbers --> <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial"> - <fo:block> + <fo:block role="SKIP"> <xsl:call-template name="insert_basic_link"> <xsl:with-param name="element"> <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}"> <fo:page-number-citation ref-id="{$target}"/> </fo:basic-link> \ No newline at end of file