lib/isodoc/itu/itu.recommendation-supplement.xsl in metanorma-itu-2.1.1 vs lib/isodoc/itu/itu.recommendation-supplement.xsl in metanorma-itu-2.1.2

- old
+ new

@@ -1697,32 +1697,11 @@ </xsl:if> <xsl:apply-templates/> </xsl:element> </xsl:template> - - <!-- Examples: - [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018). - [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag. - --> - <xsl:template match="itu:annex//itu:bibitem" priority="3"> - <fo:block margin-top="6pt" margin-left="10mm" text-indent="-10mm"> - <fo:inline id="{@id}" padding-right="5mm">[<xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>]</fo:inline> - <xsl:text> </xsl:text> - <xsl:apply-templates select="itu:docidentifier[not(@type = 'metanorma-ordinal')]" mode="content"/> - <xsl:if test="node()[local-name(.) != current()/itu:docidentifier]">, </xsl:if> - <xsl:apply-templates/> - </fo:block> - </xsl:template> - - <xsl:template match="itu:docidentifier" mode="content"> - <xsl:apply-templates/> - </xsl:template> - <xsl:template match="itu:docidentifier"/> - - <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol" mode="list" priority="2"> <xsl:if test="preceding-sibling::*[1][local-name() = 'title'] and $doctype != 'service-publication'"> <fo:block padding-top="-8pt" font-size="1pt"> </fo:block> </xsl:if> <xsl:choose> @@ -2069,18 +2048,45 @@ <xsl:with-param name="text" select="substring($text, 2)"/> </xsl:call-template> </xsl:if> </xsl:template> -<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_"> +<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_"> + <xsl:for-each select="$table_widths_from_if//table"> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/> + </xsl:copy> + </xsl:for-each> + </xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_"> false </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang"> <xsl:call-template name="getLang"/> - </xsl:variable><xsl:variable name="pageWidth_"> - 210 + </xsl:variable><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_width_"> + <xsl:choose> + <xsl:when test="$papersize = 'letter'">215.9</xsl:when> + <xsl:when test="$papersize = 'a4'">210</xsl:when> + </xsl:choose> + </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_"> + <xsl:choose> + <xsl:when test="$papersize = 'letter'">279.4</xsl:when> + <xsl:when test="$papersize = 'a4'">297</xsl:when> + </xsl:choose> + </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_"> + <xsl:choose> + <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when> + <xsl:otherwise> + 210 + </xsl:otherwise> + </xsl:choose> </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_"> - 297 + <xsl:choose> + <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when> + <xsl:otherwise> + 297 + </xsl:otherwise> + </xsl:choose> </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_"> 20 </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_"> 20 </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_"> @@ -2649,10 +2655,29 @@ + </xsl:attribute-set><xsl:attribute-set name="dl-name-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> + <xsl:attribute name="margin-bottom">6pt</xsl:attribute> + + + <xsl:attribute name="font-weight">bold</xsl:attribute> + + + + + + + + + + + + + </xsl:attribute-set><xsl:attribute-set name="dd-cell-style"> <xsl:attribute name="padding-left">2mm</xsl:attribute> </xsl:attribute-set><xsl:attribute-set name="appendix-style"> @@ -2958,10 +2983,28 @@ + </xsl:attribute-set><xsl:attribute-set name="list-name-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> + + + <xsl:attribute name="font-weight">bold</xsl:attribute> + + + + + + + + + + + + + </xsl:attribute-set><xsl:attribute-set name="list-item-style"> </xsl:attribute-set><xsl:attribute-set name="list-item-label-style"> @@ -3357,17 +3400,17 @@ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><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']/*"> + <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]"> <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']/*"> + <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]"> <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 != ''"> @@ -3429,11 +3472,11 @@ <xsl:copy-of select="*[local-name() = 'name']"/> </figure> </xsl:for-each> </figures> </xsl:template><xsl:template name="processPrefaceSectionsDefault"> - <xsl:for-each select="/*/*[local-name()='preface']/*"> + <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]"> <xsl:sort select="@displayorder" data-type="number"/> <xsl:apply-templates select="."/> </xsl:for-each> </xsl:template><xsl:template name="processMainSectionsDefault"> <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']"> @@ -4055,50 +4098,39 @@ <xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each> </xsl:variable> <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces --> </xsl:if> </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm"> - <xsl:param name="table"/> - <xsl:param name="if">false</xsl:param> <!-- via intermediate format --> + <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step --> + + <!-- via intermediate format --> <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table --> <!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. --> <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. --> <!-- get current table id --> <xsl:variable name="table_id" select="@id"/> <!-- find table by id in the file 'table_widths' --> - <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/> - <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> + <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/> + <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> --> - <!-- table='<xsl:copy-of select="$table"/>' --> <!-- table_id='<xsl:value-of select="$table_id"/>\ --> <!-- table-if='<xsl:copy-of select="$table-if"/>' --> <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' --> <xsl:variable name="table_with_cell_widths_"> - <xsl:choose> - <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF --> - - <!-- Example: <column>10</column> - <column>11</column> - --> - <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/> - </xsl:otherwise> - </xsl:choose> + <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF --> </xsl:variable> <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/> - <xsl:if test="$table_if_debug = 'true'"> + <!-- <xsl:if test="$table_if_debug = 'true'"> <xsl:copy-of select="$table_with_cell_widths"/> - </xsl:if> + </xsl:if> --> <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. --> <xsl:variable name="column_widths_"> @@ -4140,37 +4172,38 @@ </xsl:variable> <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/> <xsl:variable name="page_width"> <xsl:choose> - <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when> - <xsl:otherwise>75</xsl:otherwise> + <xsl:when test="$parent_table_page-width != ''"> + <xsl:value-of select="$parent_table_page-width"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@page-width"/> + </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$table_if_debug = 'true'"> <table_width> <xsl:copy-of select="$table_widths"/> </table_width> - <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug> - <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug> - --> <debug>$page_width=<xsl:value-of select="$page_width"/></debug> </xsl:if> <!-- There are three cases: --> <xsl:choose> <!-- 1. The minimum table width is equal to or wider than the available space --> <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below --> <!-- call old algorithm --> <case1/> - <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/> + <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/> <xsl:call-template name="calculate-column-widths-proportional"> <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="table" select="$table"/> - </xsl:call-template> + </xsl:call-template> --> </xsl:when> <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. --> <xsl:when test="$table_widths/table/@width_max &lt;= $page_width"> <case2/> <autolayout/> @@ -4210,99 +4243,53 @@ </xsl:when> <xsl:otherwise><unknown_case/></xsl:otherwise> </xsl:choose> + </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm"> - </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths"> - <xsl:copy> - <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/> - </xsl:copy> - </xsl:template><xsl:template match="td | th" mode="determine_cell_widths"> - <xsl:copy> - <xsl:copy-of select="@*"/> + <!-- if nested 'dl' or 'table' --> + <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/> + <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id> - <!-- The maximum width is given by the widest line. --> - <xsl:variable name="widths_max"> - <xsl:for-each select=".//*[local-name() = 'p']"> - <xsl:call-template name="add_width"/> - </xsl:for-each> - <xsl:if test="not(*[local-name() = 'p'])"> - <xsl:call-template name="add_width"/> - </xsl:if> - </xsl:variable> - <xsl:variable name="width_max"> - <xsl:for-each select="xalan:nodeset($widths_max)//width"> - <xsl:sort select="." data-type="number" order="descending"/> - <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if> - </xsl:for-each> - </xsl:variable> - <xsl:attribute name="width_max"> - <xsl:value-of select="$width_max"/> - </xsl:attribute> + <parent_element><xsl:value-of select="local-name(..)"/></parent_element> - <!-- The minimum width is given by the widest text element (word, image, etc.) --> - <!-- To do: image width --> - <xsl:variable name="td_text"> - <xsl:apply-templates select="." mode="td_text"/> - </xsl:variable> - <xsl:variable name="words"> - <xsl:variable name="string_with_added_zerospaces"> - <xsl:call-template name="add-zero-spaces-java"> - <xsl:with-param name="text" select="$td_text"/> - </xsl:call-template> + <xsl:variable name="parent_table_page-width_"> + <xsl:if test="$parent_table_id != ''"> + <!-- determine column number in the parent table --> + <xsl:variable name="parent_table_column_number"> + <xsl:choose> + <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> + <xsl:otherwise> <!-- parent is table --> + <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/> + </xsl:otherwise> + </xsl:choose> </xsl:variable> - <xsl:call-template name="tokenize"> - <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space --> - </xsl:call-template> - </xsl:variable> - - <xsl:variable name="max_word_length"> - <xsl:call-template name="max_length"> - <xsl:with-param name="words" select="xalan:nodeset($words)"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="width_min"> - <xsl:value-of select="$max_word_length"/> - </xsl:variable> - <xsl:attribute name="width_min"> - <xsl:value-of select="$width_min"/> - </xsl:attribute> - <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals --> - <xsl:if test="$width_min &gt; $width_max"> - <xsl:attribute name="width_max"> - <xsl:value-of select="$width_min"/> - </xsl:attribute> + <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> --> + <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/> </xsl:if> - <xsl:if test="$width_min = 0"> - <xsl:attribute name="width_min">1</xsl:attribute> - </xsl:if> - - <xsl:apply-templates select="node()" mode="determine_cell_widths"/> - - </xsl:copy> - </xsl:template><xsl:template name="add_width"> - <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable> - <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/> - - <xsl:variable name="p_text_len"> - <xsl:choose> - <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters --> - <xsl:value-of select="$p_text_len_ * 1.5"/> - </xsl:when> - <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise> - </xsl:choose> </xsl:variable> + <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/> - <xsl:variable name="math_addon_text"> - <xsl:for-each select=".//*[local-name() = 'math']"> - <xsl:apply-templates mode="td_text"/> - </xsl:for-each> - </xsl:variable> - <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% --> + <!-- get current table id --> + <xsl:variable name="table_id" select="@id"/> - <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width> + <xsl:choose> + <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''"> + <!-- find table by id in the file 'table_widths' and get all `<column>...</column> --> + <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/> + </xsl:when> + <xsl:otherwise> + <!-- recalculate columns width based on parent table width --> + <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]"> + <xsl:call-template name="calculate-column-widths-autolayout-algorithm"> + <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000--> + </xsl:call-template> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/> </xsl:copy> </xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if"> @@ -5138,15 +5125,23 @@ <xsl:attribute name="margin-left">7.4mm</xsl:attribute> </xsl:if> + + <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']"> + <xsl:attribute name="margin-top">0</xsl:attribute> + </xsl:if> + <fo:block> + <xsl:apply-templates select="*[local-name() = 'name']"> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> <xsl:if test="$isGenerateTableIF = 'true'"> <!-- to determine start of table --> <fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block> </xsl:if> @@ -5165,10 +5160,11 @@ </xsl:when> </xsl:choose> + <xsl:choose> <xsl:when test="$isGenerateTableIF = 'true'"> <!-- generate IF for table widths --> <!-- example: <tr> @@ -5293,18 +5289,35 @@ </fo:block> </fo:block> </xsl:if> <!-- END: a few components --> </fo:block-container> </fo:block-container> + + <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' --> + <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/> + </xsl:if> + + </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']"> + <xsl:param name="process">false</xsl:param> + <xsl:if test="$process = 'true'"> + <fo:block xsl:use-attribute-sets="dl-name-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:if> </xsl:template><xsl:template name="setColumnWidth_dl"> <xsl:param name="colwidths"/> <xsl:param name="maxlength_dt"/> <xsl:param name="isContainsKeepTogetherTag"/> <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> --> <xsl:choose> + <xsl:when test="xalan:nodeset($colwidths)/autolayout"> + <xsl:call-template name="insertTableColumnWidth"> + <xsl:with-param name="colwidths" select="$colwidths"/> + </xsl:call-template> + </xsl:when> <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table --> <fo:table-column column-width="50%"/> <fo:table-column column-width="50%"/> </xsl:when> <xsl:otherwise> @@ -5563,16 +5576,28 @@ <td> <xsl:copy-of select="node()"/> </td> <td> - <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/> + <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> + + <!-- get paragraphs from nested 'dl' --> + <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/> + </td> </tr> - </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']"> + </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested"> + <xsl:for-each select="*[local-name() = 'dt']"> + <p> + <xsl:copy-of select="node()"/> + <xsl:text> </xsl:text> + <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/> + </p> + </xsl:for-each> + </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']"> <fo:inline font-style="italic"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']"> <xsl:param name="split_keep-within-line"/> @@ -5599,20 +5624,20 @@ + <!-- 10 --> - </xsl:variable> <xsl:variable name="font-size" select="normalize-space($_font-size)"/> <xsl:if test="$font-size != ''"> <xsl:attribute name="font-size"> @@ -7627,13 +7652,13 @@ + <!-- 9 --> - 10 @@ -7711,11 +7736,11 @@ </xsl:variable> <xsl:for-each select="xalan:nodeset($text_step4)/node()"> <xsl:choose> <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space --> - <xsl:call-template name="interspers"> + <xsl:call-template name="interspers-java"> <xsl:with-param name="str" select="."/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> @@ -7761,10 +7786,14 @@ <xsl:call-template name="interspers"> <xsl:with-param name="str" select="substring($str, 2)"/> <xsl:with-param name="char" select="$char"/> </xsl:call-template> </xsl:if> + </xsl:template><xsl:template name="interspers-java"> + <xsl:param name="str"/> + <xsl:param name="char" select="$zero_width_space"/> + <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. --> </xsl:template><xsl:template match="*" mode="syntax_highlight"> <xsl:apply-templates mode="syntax_highlight"/> </xsl:template><xsl:variable name="syntax_highlight_styles_"> <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/> <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/> @@ -8720,26 +8749,42 @@ <xsl:apply-templates select="." mode="list"/> </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list"> + + <xsl:apply-templates select="*[local-name() = 'name']"> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> + <fo:list-block xsl:use-attribute-sets="list-style"> + <xsl:if test="*[local-name() = 'name']"> + <xsl:attribute name="margin-top">0pt</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="node()[not(local-name() = 'note')]"/> </fo:list-block> <!-- <xsl:for-each select="./iho:note"> <xsl:call-template name="note"/> </xsl:for-each> --> <xsl:apply-templates select="./*[local-name() = 'note']"/> + </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']"> + <xsl:param name="process">false</xsl:param> + <xsl:if test="$process = 'true'"> + <fo:block xsl:use-attribute-sets="list-name-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:if> </xsl:template><xsl:template match="*[local-name()='li']"> <fo:list-item xsl:use-attribute-sets="list-item-style"> <xsl:copy-of select="@id"/> @@ -9015,58 +9060,38 @@ </xsl:template><xsl:template name="processBibitem"> - + <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. --> <xsl:if test="$doctype = 'implementers-guide'"> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="text-indent">0mm</xsl:attribute> </xsl:if> <xsl:variable name="bibitem_label"> - <xsl:choose> - <xsl:when test="itu:docidentifier[@type = 'metanorma']"> - <xsl:value-of select="itu:docidentifier[@type = 'metanorma']"/> - </xsl:when> - <xsl:otherwise> - <fo:inline padding-right="5mm"> - <xsl:text>[</xsl:text> - <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/> - <xsl:text>] </xsl:text> - </fo:inline> - </xsl:otherwise> - </xsl:choose> + <xsl:value-of select="itu:docidentifier[@type = 'metanorma']"/> + <xsl:if test="not(itu:docidentifier[@type = 'metanorma'])"> + <fo:inline padding-right="5mm"> + <xsl:text>[</xsl:text> + <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/> + <xsl:text>] </xsl:text> + </fo:inline> + </xsl:if> </xsl:variable> <xsl:variable name="bibitem_body"> <xsl:text> </xsl:text> <xsl:choose> <xsl:when test="itu:docidentifier[@type = 'metanorma']"> - <xsl:if test="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"> - <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/> - <xsl:text>, </xsl:text> - </xsl:if> + <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/> - <xsl:if test="itu:title"> - <xsl:text>, </xsl:text> - </xsl:if> </xsl:otherwise> </xsl:choose> - <xsl:if test="itu:title"> - <xsl:choose> - <xsl:when test="itu:title[@type = 'main' and @language = 'en']"> - <xsl:apply-templates select="itu:title[@type = 'main' and @language = 'en']"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select="itu:title"/> - </xsl:otherwise> - </xsl:choose> - </xsl:if> <xsl:if test="itu:formattedref and not(itu:docidentifier[@type = 'metanorma'])">, </xsl:if> <xsl:apply-templates select="itu:formattedref"/> </xsl:variable> <xsl:choose> @@ -9079,11 +9104,11 @@ <fo:table-cell><fo:block><xsl:copy-of select="$bibitem_label"/></fo:block></fo:table-cell> <fo:table-cell><fo:block><xsl:copy-of select="$bibitem_body"/></fo:block></fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> - </xsl:when> + </xsl:when> <!-- $doctype = 'implementers-guide' --> <xsl:otherwise> <xsl:copy-of select="$bibitem_label"/> <xsl:copy-of select="$bibitem_body"/> </xsl:otherwise> </xsl:choose> @@ -9404,28 +9429,35 @@ </fo:block-container> </fo:block-container> </xsl:template><xsl:template name="displayAdmonitionName"> - + <xsl:param name="sep"/> <!-- Example: ' - ' --> + <!-- <xsl:choose> + <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'"> + <xsl:choose> + <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*[local-name() = 'name']"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> <xsl:apply-templates select="*[local-name() = 'name']"/> <xsl:if test="not(*[local-name() = 'name'])"> <xsl:apply-templates select="@type"/> </xsl:if> - - </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']"> - <xsl:apply-templates/> - </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type"> - <xsl:variable name="admonition_type_"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param> - </xsl:call-template> + </xsl:otherwise> + </xsl:choose> --> + <xsl:variable name="name"> + <xsl:apply-templates select="*[local-name() = 'name']"/> </xsl:variable> - <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/> - <xsl:value-of select="$admonition_type"/> - <xsl:if test="$admonition_type = ''"> - <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/> + <xsl:copy-of select="$name"/> + <xsl:if test="normalize-space($name) != ''"> + <xsl:value-of select="$sep"/> </xsl:if> + </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']"> + <xsl:apply-templates/> </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']"> <fo:block xsl:use-attribute-sets="admonition-p-style"> \ No newline at end of file