lib/isodoc/m3aawg/m3aawg.policy.xsl in metanorma-m3aawg-2.1.11 vs lib/isodoc/m3aawg/m3aawg.policy.xsl in metanorma-m3aawg-2.1.12

- old
+ new

@@ -49,13 +49,13 @@ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/> <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/> </fo:simple-page-master> <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> - <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/> + <fo:region-body margin-top="20mm" margin-bottom="54mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/> <fo:region-before region-name="header" extent="{$marginTop}mm"/> - <fo:region-after region-name="footer-last" extent="53mm"/> + <fo:region-after region-name="footer-last" extent="53.2mm"/> <fo:region-start region-name="left-region" extent="17.3mm"/> <fo:region-end region-name="right-region" extent="17.3mm"/> </fo:simple-page-master> <fo:page-sequence-master master-name="document"> @@ -102,11 +102,11 @@ <fo:inline color="blue" text-decoration="underline">www.m3aawg.org</fo:inline> </fo:block> </fo:block-container> </fo:static-content> <fo:static-content flow-name="footer" role="artifact"> - <fo:block-container height="31mm" font-size="10pt"> + <fo:block-container font-size="10pt"> <fo:block text-align-last="justify" margin-top="2mm"> <fo:inline font-weight="bold"> <fo:inline>M<fo:inline font-size="6.5pt" vertical-align="super">3</fo:inline>AAWG </fo:inline> <xsl:value-of select="$title-en"/> </fo:inline> @@ -214,11 +214,11 @@ <fo:block font-size="12pt" font-weight="bold" text-decoration="underline" margin-bottom="4pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block> <fo:block font-size="10pt" role="TOC"> <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface --> <xsl:choose> <xsl:when test="@section = ''"> - <fo:table table-layout="fixed" width="100%"> + <fo:table table-layout="fixed" width="100%" id="__internal_layout__price_toc_{generate-id()}"> <fo:table-column column-width="180mm"/> <fo:table-body> <fo:table-row height="6mm"> <fo:table-cell> <fo:block text-align-last="justify" role="TOCI"> @@ -239,11 +239,11 @@ </fo:table-row> </fo:table-body> </fo:table> </xsl:when> <xsl:otherwise> - <fo:table table-layout="fixed" width="100%"> + <fo:table table-layout="fixed" width="100%" id="__internal_layout__price_toc_{generate-id()}"> <fo:table-column column-width="5mm"/> <!-- 25mm --> <fo:table-column column-width="175mm"/> <!-- 155mm --> <fo:table-body> <fo:table-row height="6mm"> <fo:table-cell> @@ -1049,10 +1049,18 @@ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute> <xsl:attribute name="margin-bottom">12pt</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-bottom">12pt</xsl:attribute> + + </xsl:attribute-set> + <xsl:attribute-set name="permission-style"> </xsl:attribute-set> <xsl:attribute-set name="permission-name-style"> @@ -1158,21 +1166,24 @@ <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-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> @@ -2264,14 +2275,22 @@ </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:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute> - <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute> + <xsl:if test="$margin-side != 0"> + <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute> + <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute> + </xsl:if> </xsl:element> </xsl:variable> <xsl:if test="$isGenerateTableIF = 'true'"> @@ -3023,10 +3042,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> @@ -4990,10 +5013,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"> @@ -5040,18 +5066,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"/> @@ -5064,14 +5133,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)"/> @@ -5140,10 +5209,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> @@ -6482,13 +6574,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']"> @@ -6781,13 +6873,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"> @@ -9337,16 +9443,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