lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.2.5 vs lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.2.6

- old
+ new

@@ -1141,11 +1141,11 @@ </xsl:template> <xsl:template name="insertHeaderFooter"> <xsl:param name="color" select="$color_blue"/> <fo:static-content flow-name="footer" role="artifact"> - <fo:block-container font-size="8pt" height="100%" color="{$color}" padding-top="6mm"> + <fo:block-container font-size="8pt" color="{$color}" padding-top="6mm"> <fo:table table-layout="fixed" width="100%"> <fo:table-column column-width="90%"/> <fo:table-column column-width="10%"/> <fo:table-body> <fo:table-row> @@ -1881,10 +1881,19 @@ <xsl:attribute name="margin-bottom">6pt</xsl:attribute> <xsl:attribute name="line-height">113%</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="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute> + <xsl:attribute name="line-height">113%</xsl:attribute> + + </xsl:attribute-set> + <xsl:attribute-set name="permission-style"> <xsl:attribute name="margin-top">6pt</xsl:attribute> </xsl:attribute-set> @@ -2024,10 +2033,15 @@ <xsl:variable name="table-border_"> </xsl:variable> <xsl:variable name="table-border" select="normalize-space($table-border_)"/> + <xsl:variable name="table-cell-border_"> + + </xsl:variable> + <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/> + <xsl:attribute-set name="table-container-style"> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> <xsl:attribute name="space-after">12pt</xsl:attribute> @@ -2035,12 +2049,10 @@ </xsl:attribute-set> <!-- table-container-style --> <xsl:attribute-set name="table-style"> <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute> <xsl:attribute name="table-layout">fixed</xsl:attribute> - <xsl:attribute name="margin-left">0mm</xsl:attribute> - <xsl:attribute name="margin-right">0mm</xsl:attribute> </xsl:attribute-set><!-- table-style --> <xsl:attribute-set name="table-name-style"> <xsl:attribute name="keep-with-next">always</xsl:attribute> @@ -3206,10 +3218,16 @@ </xsl:variable> <xsl:variable name="table_attributes"> <xsl:element name="table_attributes" use-attribute-sets="table-style"> + + <xsl:if test="$margin-side != 0"> + <xsl:attribute name="margin-left">0mm</xsl:attribute> + <xsl:attribute name="margin-right">0mm</xsl:attribute> + </xsl:if> + <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute> </xsl:element> </xsl:variable> @@ -3959,10 +3977,14 @@ <!-- 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:attribute name="keep-with-next">always</xsl:attribute> + </xsl:if> + <xsl:variable name="number"><xsl:number/></xsl:variable> <xsl:attribute name="background-color"> <xsl:choose> <xsl:when test="$number mod 2 = 0">rgb(252, 246, 222)</xsl:when> <xsl:otherwise>rgb(254, 252, 245)</xsl:otherwise> @@ -5951,10 +5973,13 @@ <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> + <!-- ======================================= --> + <!-- math --> + <!-- ======================================= --> <xsl:template match="mathml:math"> <xsl:variable name="isAdded" select="@added"/> <xsl:variable name="isDeleted" select="@deleted"/> <fo:inline xsl:use-attribute-sets="mathml-style"> @@ -6001,18 +6026,61 @@ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/> <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/> <xsl:value-of select="$comment_text"/> </xsl:template> + <xsl:template match="*[local-name() = 'asciimath']"> + <xsl:param name="process" select="'false'"/> + <xsl:if test="$process = 'true'"> + <xsl:apply-templates/> + </xsl:if> + </xsl:template> + + <xsl:template match="*[local-name() = 'latexmath']"/> + + <xsl:template name="getMathml_asciimath_text"> + <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/> + <xsl:variable name="latexmath"> + + </xsl:variable> + <xsl:variable name="asciimath_text_following"> + <xsl:choose> + <xsl:when test="normalize-space($latexmath) != ''"> + <xsl:value-of select="$latexmath"/> + </xsl:when> + <xsl:when test="normalize-space($asciimath) != ''"> + <xsl:value-of select="$asciimath"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="following-sibling::node()[1][self::comment()]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="asciimath_text_"> + <xsl:choose> + <xsl:when test="normalize-space($asciimath_text_following) != ''"> + <xsl:value-of select="$asciimath_text_following"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/> + <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/> + <xsl:value-of select="$asciimath_text"/> + </xsl:template> + <xsl:template name="mathml_instream_object"> - <xsl:param name="comment_text"/> + <xsl:param name="asciimath_text"/> <xsl:param name="mathml_content"/> - <xsl:variable name="comment_text_"> + <xsl:variable name="asciimath_text_"> <xsl:choose> - <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when> - <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> + <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when> + <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> --> + <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="mathml"> <xsl:apply-templates select="." mode="mathml"/> @@ -6025,14 +6093,14 @@ <xsl:attribute name="fox:actual-text"> <xsl:value-of select="$mathml_content"/> </xsl:attribute> <!-- <xsl:if test="$add_math_as_text = 'true'"> --> - <xsl:if test="normalize-space($comment_text_) != ''"> + <xsl:if test="normalize-space($asciimath_text_) != ''"> <!-- put Mathin Alternate Text --> <xsl:attribute name="fox:alt-text"> - <xsl:value-of select="$comment_text_"/> + <xsl:value-of select="$asciimath_text_"/> </xsl:attribute> </xsl:if> <!-- </xsl:if> --> <xsl:copy-of select="xalan:nodeset($mathml)"/> @@ -6101,10 +6169,33 @@ <!-- patch: slash in the mtd wrong rendering --> <xsl:template match="mathml:mtd/mathml:mo/text()[. = '/']" mode="mathml"> <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/> </xsl:template> + <!-- Examples: + <stem type="AsciiMath">x = 1</stem> + <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem> + <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem> + --> + <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3"> + <fo:inline xsl:use-attribute-sets="mathml-style"> + + <xsl:choose> + <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when> + <xsl:otherwise> + <xsl:apply-templates> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + + </fo:inline> + </xsl:template> + <!-- ======================================= --> + <!-- END: math --> + <!-- ======================================= --> + <xsl:template match="*[local-name()='localityStack']"/> <xsl:template match="*[local-name()='link']" name="link"> <xsl:variable name="target"> <xsl:choose> @@ -7465,13 +7556,13 @@ <!-- 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:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']"> @@ -7781,13 +7872,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"> @@ -10339,16 +10444,17 @@ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="setId"> + <xsl:param name="prefix"/> <xsl:attribute name="id"> <xsl:choose> <xsl:when test="@id"> - <xsl:value-of select="@id"/> + <xsl:value-of select="concat($prefix, @id)"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="generate-id()"/> + <xsl:value-of select="concat($prefix, generate-id())"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:template> \ No newline at end of file