lib/isodoc/ogc/ogc.white-paper.xsl in metanorma-ogc-2.2.5 vs lib/isodoc/ogc/ogc.white-paper.xsl in metanorma-ogc-2.2.6

- old
+ new

@@ -1058,10 +1058,18 @@ <xsl:attribute name="keep-with-next">always</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="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> @@ -1206,10 +1214,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="font-size">10pt</xsl:attribute> @@ -1218,12 +1231,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> @@ -2405,10 +2416,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> @@ -3160,10 +3177,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:call-template name="setTableRowAttributes"/> <xsl:apply-templates/> </fo:table-row> </xsl:template> @@ -5138,10 +5159,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"> @@ -5188,18 +5212,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"/> @@ -5212,14 +5279,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)"/> @@ -5288,10 +5355,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> @@ -6625,13 +6715,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']"> @@ -6929,13 +7019,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"> @@ -9494,16 +9598,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