lib/isodoc/mpfa/mpfa.circular.xsl in metanorma-mpfa-0.9.1 vs lib/isodoc/mpfa/mpfa.circular.xsl in metanorma-mpfa-0.9.2

- old
+ new

@@ -32,11 +32,11 @@ <item level="1" id="Foreword" display="true">Foreword</item> <item id="term-script" display="false">3.2</item> --> <xsl:variable name="contents_"> <contents> - <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]" mode="contents"/> + <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms' or local-name() = 'note' or local-name() = 'admonition')]" mode="contents"/> <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms" mode="contents"/> <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:sections/*" mode="contents"/> <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:annex" mode="contents"/> @@ -242,15 +242,15 @@ </xsl:for-each> </xsl:if> </fo:block> </fo:block-container> - <xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*"> + <xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]"> <fo:block break-after="page"/> <!-- Foreword, Introduction --> <fo:block> - <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]"/> + <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms' or local-name() = 'note' or local-name() = 'admonition')]"/> <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms"/> </fo:block> </xsl:if> </fo:flow> </fo:page-sequence> @@ -584,18 +584,45 @@ </fo:block-container> </fo:static-content> </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_"> 19 </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_"> 19 </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_"> @@ -1154,10 +1181,28 @@ + </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-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"> @@ -1446,10 +1491,27 @@ + </xsl:attribute-set><xsl:attribute-set name="list-name-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> + + + + + + + + + + + + + + + </xsl:attribute-set><xsl:attribute-set name="list-item-style"> </xsl:attribute-set><xsl:attribute-set name="list-item-label-style"> @@ -1837,17 +1899,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 != ''"> @@ -1909,11 +1971,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']"> @@ -2514,50 +2576,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_"> @@ -2599,37 +2650,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/> @@ -2669,99 +2721,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"> @@ -3535,15 +3541,23 @@ <fo:block> + + <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> @@ -3562,10 +3576,11 @@ </xsl:when> </xsl:choose> + <xsl:choose> <xsl:when test="$isGenerateTableIF = 'true'"> <!-- generate IF for table widths --> <!-- example: <tr> @@ -3690,18 +3705,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> @@ -3950,16 +3982,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"/> @@ -3986,20 +4030,20 @@ + <!-- 10 --> - </xsl:variable> <xsl:variable name="font-size" select="normalize-space($_font-size)"/> <xsl:if test="$font-size != ''"> <xsl:attribute name="font-size"> @@ -6006,14 +6050,14 @@ + <!-- 9 --> - @@ -6090,11 +6134,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="."/> @@ -6140,10 +6184,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"/> @@ -7081,10 +7129,15 @@ <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"> @@ -7095,16 +7148,27 @@ </xsl:if> + <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"/> @@ -7404,30 +7468,27 @@ <!-- start bibitem processing --> <xsl:if test=".//*[local-name() = 'fn']"> <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute> </xsl:if> + + <!-- display document identifier, not number [1] --> <xsl:variable name="docidentifier"> <xsl:choose> <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/> <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise> </xsl:choose> </xsl:variable> - <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline> + <xsl:value-of select="$docidentifier"/> + <xsl:apply-templates select="*[local-name() = 'note']"/> - <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if> - <xsl:choose> - <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $lang]"> - <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $lang]"/> - </xsl:when> - <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']"> - <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select="*[local-name() = 'title']"/> - </xsl:otherwise> - </xsl:choose> + + <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']"> + <xsl:text>,</xsl:text> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:apply-templates select="*[local-name() = 'formattedref']"/> <!-- end bibitem processing --> </xsl:template><xsl:template name="processBibitemDocId"> <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/> @@ -7745,28 +7806,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']"> <!-- processing for admonition/p found in the template for 'p' --> <xsl:call-template name="paragraph"/> </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1"> \ No newline at end of file