lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.6.0 vs lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.6.1

- old
+ new

@@ -1349,10 +1349,11 @@ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style"> + </xsl:attribute-set><xsl:attribute-set name="link-style"> </xsl:attribute-set><xsl:attribute-set name="sourcecode-style"> @@ -1658,17 +1659,29 @@ </xsl:attribute-set><xsl:attribute-set name="deprecates-style"> </xsl:attribute-set><xsl:attribute-set name="definition-style"> - </xsl:attribute-set><xsl:attribute-set name="add-style"> + </xsl:attribute-set><xsl:variable name="color-added-text"> + <xsl:text>rgb(0, 255, 0)</xsl:text> + </xsl:variable><xsl:attribute-set name="add-style"> <xsl:attribute name="color">red</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> - </xsl:attribute-set><xsl:attribute-set name="del-style"> - <xsl:attribute name="color">red</xsl:attribute> + <!-- <xsl:attribute name="color">black</xsl:attribute> + <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute> + <xsl:attribute name="padding-top">1mm</xsl:attribute> + <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> --> + </xsl:attribute-set><xsl:variable name="color-deleted-text"> + <xsl:text>red</xsl:text> + </xsl:variable><xsl:attribute-set name="del-style"> + <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> <xsl:attribute name="text-decoration">line-through</xsl:attribute> - </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents"> + </xsl:attribute-set><xsl:attribute-set name="mathml-style"> + <xsl:attribute name="font-family">STIX Two Math</xsl:attribute> + + + </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:template name="processPrefaceSectionsDefault_Contents"> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/> @@ -1709,20 +1722,21 @@ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1"> <!-- <xsl:call-template name="add-zero-spaces"/> --> <xsl:call-template name="add-zero-spaces-java"/> </xsl:template><xsl:template match="*[local-name()='table']" name="table"> + <xsl:variable name="table-preamble"> + + + </xsl:variable> + <xsl:variable name="table"> <xsl:variable name="simple-table"> <xsl:call-template name="getSimpleTable"/> </xsl:variable> - - - - <!-- <xsl:if test="$namespace = 'bipm'"> <fo:block>&#xA0;</fo:block> </xsl:if> --> <!-- $namespace = 'iso' or --> @@ -1733,11 +1747,11 @@ <xsl:call-template name="fn_name_display"/> - <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/> + <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/> <!-- <xsl:variable name="cols-count"> <xsl:choose> <xsl:when test="*[local-name()='thead']"> <xsl:call-template name="calculate-columns-numbers"> @@ -1752,12 +1766,10 @@ </xsl:choose> </xsl:variable> --> <!-- cols-count=<xsl:copy-of select="$cols-count"/> --> <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> --> - - <xsl:variable name="colwidths"> <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])"> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="table" select="$simple-table"/> @@ -1781,10 +1793,11 @@ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> + <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm"> @@ -1820,10 +1833,11 @@ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute> + <attribute name="border-top">0.5pt solid black</attribute> @@ -1911,25 +1925,56 @@ </fo:block-container> </xsl:variable> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> - <xsl:choose> <xsl:when test="@width"> <!-- centered table when table name is centered (see table-name-style) --> - <xsl:copy-of select="$table"/> + <xsl:choose> + <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'"> + <xsl:copy-of select="$table-preamble"/> + <fo:block> + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <xsl:copy-of select="$table"/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$table-preamble"/> + <xsl:copy-of select="$table"/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:otherwise> - <xsl:copy-of select="$table"/> + <xsl:choose> + <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'"> + <xsl:copy-of select="$table-preamble"/> + <fo:block> + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <xsl:copy-of select="$table"/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$table-preamble"/> + <xsl:copy-of select="$table"/> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation"> <xsl:if test="normalize-space() != ''"> @@ -1986,11 +2031,11 @@ </width> </xsl:for-each> </xsl:when> <xsl:otherwise> - <xsl:for-each select="xalan:nodeset($table)//tr"> + <xsl:for-each select="xalan:nodeset($table)/*/tr"> <xsl:variable name="td_text"> <xsl:apply-templates select="td[$curr-col]" mode="td_text"/> <!-- <xsl:if test="$namespace = 'bipm'"> <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']"> @@ -2330,11 +2375,12 @@ </xsl:template><xsl:template match="*[local-name()='th']"> <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center"> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@align"> - <xsl:value-of select="@align"/> + <xsl:call-template name="setAlignment"/> + <!-- <xsl:value-of select="@align"/> --> </xsl:when> <xsl:otherwise>center</xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -2356,10 +2402,13 @@ <xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute> <xsl:attribute name="text-indent">0mm</xsl:attribute> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -2387,15 +2436,19 @@ </xsl:template><xsl:template match="*[local-name()='td']"> <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm"> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@align"> - <xsl:value-of select="@align"/> + <xsl:call-template name="setAlignment"/> + <!-- <xsl:value-of select="@align"/> --> </xsl:when> <xsl:otherwise>left</xsl:otherwise> </xsl:choose> </xsl:attribute> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> @@ -2411,10 +2464,13 @@ <xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute> <xsl:attribute name="text-indent">0mm</xsl:attribute> + <xsl:if test=".//*[local-name() = 'table']"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -2548,17 +2604,17 @@ <xsl:value-of select="substring-before(name(/*), '-')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> --> - <xsl:element name="{$ns}:table"> + <!-- <xsl:element name="{$ns}:table"> --> <xsl:for-each select="*[local-name() = 'dl'][1]"> <tbody> <xsl:apply-templates mode="dl"/> </tbody> </xsl:for-each> - </xsl:element> + <!-- </xsl:element> --> </xsl:variable> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="2"/> <xsl:with-param name="table" select="$html-table"/> @@ -2645,10 +2701,12 @@ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='dl']"> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> <fo:block-container> <xsl:if test="not(ancestor::*[local-name() = 'quote'])"> <xsl:attribute name="margin-left">0mm</xsl:attribute> </xsl:if> @@ -2661,10 +2719,16 @@ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:if> + + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <fo:block-container> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> @@ -2768,15 +2832,15 @@ <xsl:value-of select="substring-before(name(/*), '-')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> --> - <xsl:element name="{$ns}:table"> + <!-- <xsl:element name="{$ns}:table"> --> <tbody> <xsl:apply-templates mode="dl"/> </tbody> - </xsl:element> + <!-- </xsl:element> --> </xsl:variable> <!-- html-table<xsl:copy-of select="$html-table"/> --> <xsl:variable name="colwidths"> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="2"/> @@ -3040,13 +3104,75 @@ </xsl:template><xsl:template match="*[local-name()='underline']"> <fo:inline text-decoration="underline"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='add']"> - <fo:inline xsl:use-attribute-sets="add-style"> - <xsl:apply-templates/> - </fo:inline> + <xsl:choose> + <xsl:when test="@amendment"> + <fo:inline> + <xsl:call-template name="insertTag"> + <xsl:with-param name="kind">A</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param> + </xsl:call-template> + <xsl:apply-templates/> + <xsl:call-template name="insertTag"> + <xsl:with-param name="type">closing</xsl:with-param> + <xsl:with-param name="kind">A</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param> + </xsl:call-template> + </fo:inline> + </xsl:when> + <xsl:when test="@corrigenda"> + <fo:inline> + <xsl:call-template name="insertTag"> + <xsl:with-param name="kind">C</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param> + </xsl:call-template> + <xsl:apply-templates/> + <xsl:call-template name="insertTag"> + <xsl:with-param name="type">closing</xsl:with-param> + <xsl:with-param name="kind">C</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param> + </xsl:call-template> + </fo:inline> + </xsl:when> + <xsl:otherwise> + <fo:inline xsl:use-attribute-sets="add-style"> + <xsl:apply-templates/> + </fo:inline> + </xsl:otherwise> + </xsl:choose> + + </xsl:template><xsl:template name="insertTag"> + <xsl:param name="type"/> + <xsl:param name="kind"/> + <xsl:param name="value"/> + <xsl:variable name="add_width" select="string-length($value) * 20"/> + <xsl:variable name="maxwidth" select="60 + $add_width"/> + <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" --> + <!-- <xsl:attribute name="width">7mm</xsl:attribute> + <xsl:attribute name="content-height">100%</xsl:attribute> --> + <xsl:attribute name="height">5mm</xsl:attribute> + <xsl:attribute name="content-width">100%</xsl:attribute> + <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <xsl:attribute name="scaling">uniform</xsl:attribute> + <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80"> + <g> + <xsl:if test="$type = 'closing'"> + <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute> + </xsl:if> + <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/> + <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/> + </g> + <text font-family="Arial" x="15" y="57" font-size="40pt"> + <xsl:if test="$type = 'closing'"> + <xsl:attribute name="x">25</xsl:attribute> + </xsl:if> + <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan> + </text> + </svg> + </fo:instream-foreign-object> </xsl:template><xsl:template match="*[local-name()='del']"> <fo:inline xsl:use-attribute-sets="del-style"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='hi']"> @@ -3385,17 +3511,27 @@ </xsl:template><xsl:template name="capitalize"> <xsl:param name="str"/> <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/> <xsl:value-of select="substring($str, 2)"/> </xsl:template><xsl:template match="mathml:math"> - <fo:inline font-family="STIX Two Math"> <!-- --> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> + + <fo:inline xsl:use-attribute-sets="mathml-style"> + + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <xsl:variable name="mathml"> <xsl:apply-templates select="." mode="mathml"/> </xsl:variable> <fo:instream-foreign-object fox:alt-text="Math"> + <!-- <xsl:copy-of select="."/> --> <xsl:copy-of select="xalan:nodeset($mathml)"/> </fo:instream-foreign-object> </fo:inline> </xsl:template><xsl:template match="@*|node()" mode="mathml"> @@ -3648,12 +3784,19 @@ <xsl:text>.</xsl:text> </xsl:if> --> </fo:inline> </xsl:if> </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure"> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> <fo:block-container id="{@id}"> + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <fo:block> <xsl:apply-templates/> </fo:block> <xsl:call-template name="fn_display_figure"/> <xsl:for-each select="*[local-name() = 'note']"> @@ -3669,10 +3812,12 @@ </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']"> <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style"> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'image']"> + <xsl:variable name="isAdded" select="../@added"/> + <xsl:variable name="isDeleted" select="../@deleted"/> <xsl:choose> <xsl:when test="ancestor::*[local-name() = 'title']"> <fo:inline padding-left="1mm" padding-right="1mm"> <xsl:variable name="src"> <xsl:call-template name="image_src"/> @@ -3684,11 +3829,30 @@ <fo:block xsl:use-attribute-sets="image-style"> <xsl:variable name="src"> <xsl:call-template name="image_src"/> </xsl:variable> - <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/> + + <xsl:choose> + <xsl:when test="$isDeleted = 'true'"> + <!-- enclose in svg --> + <fo:instream-foreign-object fox:alt-text="Image {@alt}"> + <xsl:attribute name="width">100%</xsl:attribute> + <xsl:attribute name="content-height">100%</xsl:attribute> + <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <xsl:attribute name="scaling">uniform</xsl:attribute> + + + <xsl:apply-templates select="." mode="cross_image"/> + + </fo:instream-foreign-object> + </xsl:when> + <xsl:otherwise> + <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/> + </xsl:otherwise> + </xsl:choose> + </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="image_src"> <xsl:choose> @@ -3700,10 +3864,59 @@ </xsl:when> <xsl:otherwise> <xsl:value-of select="@src"/> </xsl:otherwise> </xsl:choose> + </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image"> + <xsl:choose> + <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]"> + <xsl:variable name="src"> + <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/> + </xsl:variable> + <xsl:variable name="width" select="document($src)/@width"/> + <xsl:variable name="height" select="document($src)/@height"/> + <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1"> + <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/> + </svg> + </xsl:when> + <xsl:when test="not(starts-with(@src, 'data:'))"> + <xsl:variable name="src"> + <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/> + </xsl:variable> + <xsl:variable name="file" select="java:java.io.File.new(@src)"/> + <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/> + <xsl:variable name="width" select="java:getWidth($bufferedImage)"/> + <xsl:variable name="height" select="java:getHeight($bufferedImage)"/> + <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1"> + <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/> + </svg> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/> + <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/> + <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/> + <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/> + <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/> + <xsl:variable name="width" select="java:getWidth($bufferedImage)"/> + <!-- width=<xsl:value-of select="$width"/> --> + <xsl:variable name="height" select="java:getHeight($bufferedImage)"/> + <!-- height=<xsl:value-of select="$height"/> --> + <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1"> + <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/> + <xsl:call-template name="svg_cross"> + <xsl:with-param name="width" select="$width"/> + <xsl:with-param name="height" select="$height"/> + </xsl:call-template> + </svg> + </xsl:otherwise> + </xsl:choose> + + </xsl:template><xsl:template name="svg_cross"> + <xsl:param name="width"/> + <xsl:param name="height"/> + <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/> + <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents"> <xsl:apply-templates mode="contents"/> <xsl:text> </xsl:text> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks"> <xsl:apply-templates mode="bookmarks"/> @@ -4242,18 +4455,19 @@ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation"> <xsl:variable name="element"> block + <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if> </xsl:variable> <xsl:choose> <xsl:when test="ancestor::*[local-name() = 'appendix']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:when> - <xsl:when test="normalize-space($element) = 'block'"> + <xsl:when test="contains(normalize-space($element), 'block')"> <fo:block xsl:use-attribute-sets="example-name-style"> <xsl:apply-templates/> </fo:block> </xsl:when> <xsl:otherwise> @@ -4462,11 +4676,12 @@ <xsl:with-param name="count" select="$padding-right"/> </xsl:call-template> </fo:inline> </xsl:when> <xsl:otherwise> - <fo:inline padding-right="{$padding-right}mm">​</fo:inline> + <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable> + <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="insertNonBreakSpaces"> <xsl:param name="count"/> @@ -5180,6 +5395,46 @@ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> </xsl:when> <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise> </xsl:choose> + </xsl:template><xsl:template name="setTrackChangesStyles"> + <xsl:param name="isAdded"/> + <xsl:param name="isDeleted"/> + <xsl:choose> + <xsl:when test="local-name() = 'math'"> + <xsl:if test="$isAdded = 'true'"> + <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute> + </xsl:if> + <xsl:if test="$isDeleted = 'true'"> + <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$isAdded = 'true'"> + <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute> + <xsl:attribute name="padding">2mm</xsl:attribute> + </xsl:if> + <xsl:if test="$isDeleted = 'true'"> + <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute> + <xsl:if test="local-name() = 'table'"> + <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute> + </xsl:if> + <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> --> + <xsl:attribute name="padding">2mm</xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode"> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="writing-mode">rl-tb</xsl:attribute> + </xsl:if> + </xsl:template><xsl:template name="setAlignment"> + <xsl:param name="align" select="normalize-space(@align)"/> + <xsl:choose> + <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when> + <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when> + <xsl:when test="$align != ''"> + <xsl:value-of select="$align"/> + </xsl:when> + </xsl:choose> </xsl:template></xsl:stylesheet> \ No newline at end of file