lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.9.12 vs lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.9.13

- old
+ new

@@ -728,10 +728,12 @@ <xsl:variable name="Image-Recycle"> <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJNaWNyb3NvZnTCriBXb3JkIDIwMTYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzM0NUVBQ0U2RUMzMTFFQUIzQjg4RDg3OEE1NEI2QzAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzM0NUVBQ0Y2RUMzMTFFQUIzQ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HrKK4IkCd9g6NQAQPIi8vz4f5o72tANZVgO/GMpe59RvrtQvt7JMQLS0dAyI9sst1m7uTuL28gqwJBqfh8pTaWOTqTIvSblYxVtTe2RnbvHlzg/fsEofcLK4oasda9edCs9An49viDe3tm3sS2YHA/gAL39Le/tU2lGFS0mphWYsBlhI432690j5UQnnB0DjXjuv/Pkr/knwu5fQOx46PR+RzPKz5FG+vOtVFmJn08mQq/ix17K4bM722kS3f8O0J0IOnwddK6jo7zqrx5f7EdckzAOrK/5erFeIorlh4YH/pthHXfac7449A8DVAaRXYTgUQ4wdj/xgw8ytFk7xSqrdd135+AIqVLd+k6ICjZETxZhgY8HLnv3VGvTZa/+9kz/qlzuHctP4A89UE73L1sCJO8nXeWcqW3QOHeLyryF/Q4L3BoEhzW+fOO0A12vewbTZxj6/yWeCqz4J31WY1ny3/F6UYkeY68LIzhtsxa8myZailU1K6HlxN/x9kjcPp+HcBBgAS2JZd+kqHSQAAAABJRU5ErkJggg==</xsl:text> </xsl:variable> + <xsl:strip-space elements="un:xref"/> + <!-- external parameters --> <xsl:param name="svg_images"/> <!-- svg images array --> <xsl:variable name="images" select="document($svg_images)"/> <xsl:param name="basepath"/> <!-- base path for images --> @@ -1140,10 +1142,18 @@ <xsl:attribute name="margin-top">6pt</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> </xsl:attribute-set> + <xsl:attribute-set name="pre-style"> + <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute> + <xsl:attribute name="margin-bottom">6pt</xsl:attribute> + + <xsl:attribute name="margin-top">6pt</xsl:attribute> + + </xsl:attribute-set> + <xsl:attribute-set name="permission-style"> </xsl:attribute-set> <xsl:attribute-set name="permission-name-style"> @@ -2095,21 +2105,26 @@ <xsl:sort select="@displayorder" data-type="number"/> <xsl:apply-templates select="."/> </xsl:for-each> </xsl:template> + <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable> <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable> <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable> <xsl:template match="text()" name="text"> - <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable> - <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/> - <xsl:call-template name="replace_fo_inline_tags"> - <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/> - <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/> - <xsl:with-param name="text" select="$text"/> - </xsl:call-template> + <xsl:choose> + <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> + <xsl:otherwise> + <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/> + <xsl:call-template name="replace_fo_inline_tags"> + <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/> + <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template name="replace_fo_inline_tags"> <xsl:param name="tag_open"/> @@ -3133,11 +3148,11 @@ <!-- row in table's body (tbody) --> <xsl:template match="*[local-name()='tr']"> <fo:table-row xsl:use-attribute-sets="table-body-row-style"> - <xsl:if test="*[local-name() = 'th']"> + <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="setTableRowAttributes"/> <xsl:apply-templates/> @@ -4100,18 +4115,66 @@ <tr> <td> <xsl:copy-of select="node()"/> </td> <td> - <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> + <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> --> + <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/> <!-- 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="*" mode="dl_if"> + <xsl:copy-of select="."/> + </xsl:template> + + <xsl:template match="*[local-name() = 'p']" mode="dl_if"> + <xsl:param name="indent"/> + <p> + <xsl:copy-of select="@*"/> + <xsl:value-of select="$indent"/> + <xsl:copy-of select="node()"/> + </p> + + </xsl:template> + + <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if"> + <xsl:variable name="list_rendered_"> + <xsl:apply-templates select="."/> + </xsl:variable> + <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/> + + <xsl:variable name="indent"> + <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]"> + <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/> + </xsl:for-each> + </xsl:variable> + + <xsl:apply-templates mode="dl_if"> + <xsl:with-param name="indent" select="$indent"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="*[local-name() = 'li']" mode="dl_if"> + <xsl:param name="indent"/> + <xsl:apply-templates mode="dl_if"> + <xsl:with-param name="indent" select="$indent"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="@provisional-distance-between-starts" mode="dl_if"> + <xsl:variable name="value" select="round(substring-before(.,'mm'))"/> + <!-- emulate left indent for list item --> + <xsl:call-template name="repeat"> + <xsl:with-param name="char" select="'x'"/> + <xsl:with-param name="count" select="$value"/> + </xsl:call-template> + </xsl:template> + <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> @@ -4501,10 +4564,11 @@ <xsl:with-param name="tags" select="$tags"/> </xsl:call-template> </word> <xsl:call-template name="tokenize_with_tags"> <xsl:with-param name="text" select="substring-after($text, $separator)"/> + <xsl:with-param name="tags" select="$tags"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -4540,12 +4604,22 @@ </xsl:for-each> </xsl:template> <xsl:template name="add-zero-spaces-java"> <xsl:param name="text" select="."/> - <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space --> - <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/> + <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right --> + <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/> + <!-- add zero-width space (#x200B) after characters: 'great than' --> + <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' --> + <!-- add zero-width space (#x200B) before characters: 'less than' --> + <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' --> + <!-- add zero-width space (#x200B) before character: { --> + <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' --> + <!-- add zero-width space (#x200B) after character: , --> + <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit --> + + <xsl:value-of select="$text5"/> </xsl:template> <xsl:template name="add-zero-spaces-link-java"> <xsl:param name="text" select="."/> @@ -4687,11 +4761,11 @@ <xsl:copy> <xsl:apply-templates select="@*|node()" mode="table-without-br"/> </xsl:copy> </xsl:template> - <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br"> + <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br"> <xsl:copy> <xsl:copy-of select="@*"/> <p> <xsl:copy-of select="node()"/> </p> @@ -4735,10 +4809,32 @@ </p> </xsl:if> </xsl:for-each> </xsl:template> + <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br"> + <xsl:apply-templates mode="table-without-br"/> + </xsl:template> + + <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br"> + + <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable> + <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/> + <xsl:variable name="items"> + <xsl:call-template name="split"> + <xsl:with-param name="pText" select="$sourcecode_text"/> + <xsl:with-param name="sep" select="$sep"/> + <xsl:with-param name="normalize-space">false</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:for-each select="xalan:nodeset($items)/*"> + <p> + <sourcecode><xsl:copy-of select="node()"/></sourcecode> + </p> + </xsl:for-each> + </xsl:template> + <!-- remove redundant white spaces --> <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br"> <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/> <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/> </xsl:template> @@ -5045,10 +5141,11 @@ <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if> <xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if> <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if> <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if> <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if> + <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if> <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if> </tags> </xsl:template> <!-- =============================== --> <!-- END mode="td_text_with_formatting" --> @@ -5533,10 +5630,16 @@ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style"> <fo:block-container margin-left="0mm"> + <!-- <xsl:if test="$namespace = 'iho'"> + <xsl:if test="ancestor::iho:td"> + <xsl:attribute name="font-size">12pt</xsl:attribute> + </xsl:if> + </xsl:if> --> + <fo:block> <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="text-indent">0</xsl:attribute> <xsl:attribute name="padding-top">1.5mm</xsl:attribute> @@ -6680,48 +6783,26 @@ <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output --> <xsl:template match="*[local-name() = 'span']" mode="contents_item"> <xsl:apply-templates mode="contents_item"/> </xsl:template> - <!-- ====== --> - <!-- sourcecode --> - <!-- ====== --> + <!-- =============== --> + <!-- sourcecode --> + <!-- =============== --> <xsl:template match="*[local-name()='sourcecode']" name="sourcecode"> - <fo:block-container xsl:use-attribute-sets="sourcecode-container-style"> + <xsl:variable name="sourcecode_attributes"> + <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style"> + <xsl:variable name="_font-size"> - <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']"> - <xsl:attribute name="margin-left">0mm</xsl:attribute> - </xsl:if> + <!-- 9 --> - <xsl:if test="ancestor::*[local-name() = 'example']"> - <xsl:attribute name="margin-right">0mm</xsl:attribute> - </xsl:if> + <!-- <xsl:if test="$namespace = 'ieee'"> + <xsl:if test="$current_template = 'standard'">8</xsl:if> + </xsl:if> --> - <xsl:copy-of select="@id"/> - - <xsl:if test="parent::*[local-name() = 'note']"> - <xsl:attribute name="margin-left"> - <xsl:choose> - <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when> - <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise> - </xsl:choose> - </xsl:attribute> - - </xsl:if> - <fo:block-container margin-left="0mm"> - - <fo:block xsl:use-attribute-sets="sourcecode-style"> - <xsl:variable name="_font-size"> - - <!-- 9 --> - - <!-- <xsl:if test="$namespace = 'ieee'"> - <xsl:if test="$current_template = 'standard'">8</xsl:if> - </xsl:if> --> - - 10 + 10 </xsl:variable> <xsl:variable name="font-size" select="normalize-space($_font-size)"/> <xsl:if test="$font-size != ''"> <xsl:attribute name="font-size"> @@ -6731,18 +6812,64 @@ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when> <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:if> + </xsl:element> + </xsl:variable> + <xsl:choose> + <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"> + <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*"> + <xsl:attribute name="{local-name()}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> - </fo:block> + </xsl:when> - <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content --> + <xsl:otherwise> + <fo:block-container xsl:use-attribute-sets="sourcecode-container-style"> - </fo:block-container> - </fo:block-container> + <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']"> + <xsl:attribute name="margin-left">0mm</xsl:attribute> + </xsl:if> + + <xsl:if test="ancestor::*[local-name() = 'example']"> + <xsl:attribute name="margin-right">0mm</xsl:attribute> + </xsl:if> + + <xsl:copy-of select="@id"/> + + <xsl:if test="parent::*[local-name() = 'note']"> + <xsl:attribute name="margin-left"> + <xsl:choose> + <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + </xsl:if> + <fo:block-container margin-left="0mm"> + + <fo:block xsl:use-attribute-sets="sourcecode-style"> + + <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*"> + <xsl:attribute name="{local-name()}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> + + <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> + </fo:block> + + <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content --> + + </fo:block-container> + </fo:block-container> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="*[local-name()='sourcecode']/text()" priority="2"> <xsl:choose> <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting --> @@ -6980,13 +7107,27 @@ <fo:block xsl:use-attribute-sets="sourcecode-name-style"> <xsl:apply-templates/> </fo:block> </xsl:if> </xsl:template> - <!-- ====== --> - <!-- ====== --> + <!-- =============== --> + <!-- END sourcecode --> + <!-- =============== --> + <!-- =============== --> + <!-- pre --> + <!-- =============== --> + <xsl:template match="*[local-name()='pre']" name="pre"> + <fo:block xsl:use-attribute-sets="pre-style"> + <xsl:copy-of select="@id"/> + <xsl:apply-templates/> + </fo:block> + </xsl:template> + <!-- =============== --> + <!-- pre --> + <!-- =============== --> + <!-- ========== --> <!-- permission --> <!-- ========== --> <xsl:template match="*[local-name() = 'permission']"> <fo:block id="{@id}" xsl:use-attribute-sets="permission-style"> @@ -8917,11 +9058,13 @@ <!-- ================ --> <!-- ===================================== --> <!-- Update xml --> <!-- ===================================== --> + <!-- =========================================================================== --> <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder --> + <!-- =========================================================================== --> <xsl:template match="@*|node()" mode="update_xml_step1"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/> </xsl:copy> </xsl:template> @@ -9009,14 +9152,19 @@ </xsl:template> <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output --> <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1"> <xsl:apply-templates mode="update_xml_step1"/> </xsl:template> - + <!-- =========================================================================== --> <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder --> + <!-- =========================================================================== --> + <!-- =========================================================================== --> <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' --> + <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b --> + <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY --> + <!-- =========================================================================== --> <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> --> <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/> </xsl:copy> @@ -9028,14 +9176,19 @@ <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable> <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line"> <!-- enclose standard's number into tag 'keep-together_within-line' --> - <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable> <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable> <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable> - <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/> + <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/> + <xsl:variable name="text_"> + <xsl:choose> + <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells --> + <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags"> <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/> <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/> <xsl:with-param name="text" select="$text_"/> </xsl:call-template></text></xsl:variable> @@ -9047,11 +9200,15 @@ <xsl:copy-of select="."/> </xsl:for-each></text> </xsl:variable> <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b --> - <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> + <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) --> + <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> --> + <!-- add &lt; and &gt; to \S --> + <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable> + <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable> <xsl:variable name="text3"> <text><xsl:for-each select="xalan:nodeset($text2)/text/node()"> <xsl:choose> <xsl:when test="self::text()"> <xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/> @@ -9111,12 +9268,11 @@ </xsl:call-template> </xsl:when> <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise> </xsl:choose> </xsl:template> - <!-- ===================================== --> - <!-- End Update xml --> + <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' --> <!-- ===================================== --> <!-- for correct rendering combining chars --> <xsl:template match="*[local-name() = 'lang_none']"> <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline> \ No newline at end of file