lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.6.9 vs lib/isodoc/un/un.recommendation.xsl in metanorma-un-0.6.10

- old
+ new

@@ -125,11 +125,11 @@ <fo:block font-family="Arial Black" font-size="19pt" margin-top="2mm" letter-spacing="1pt"> <xsl:value-of select="/un:un-standard/un:bibdata/un:contributor/un:organization/un:name"/> </fo:block> </fo:block> <fo:block-container absolute-position="fixed" left="50mm" top="30mm" width="139mm" height="40mm" text-align="right" display-align="after"> - <fo:block font-family="Arial" font-size="24.5pt" font-weight="bold" margin-right="3mm"> <!-- margin-top="19mm" --> + <fo:block font-family="Arial" font-size="24.5pt" font-weight="bold" margin-right="3mm" role="H1"> <!-- margin-top="19mm" --> <xsl:if test="string-length($title) &gt; 70"> <xsl:attribute name="font-size">22pt</xsl:attribute> </xsl:if> <xsl:value-of select="$title"/> </fo:block> @@ -140,11 +140,11 @@ <fo:page-sequence master-reference="document-preface"> <fo:flow flow-name="xsl-region-body" font-family="Arial"> <fo:block font-size="14pt" font-weight="bold" text-align="center">United Nations Economic Commission for Europe</fo:block> <fo:block font-size="12pt" font-weight="normal" text-align="center" margin-top="46pt" margin-bottom="128pt" keep-together="always">United Nations Centre for Trade Facilitation and Electronic Business</fo:block> - <fo:block font-size="22pt" font-weight="bold" text-align="center"> + <fo:block font-size="22pt" font-weight="bold" text-align="center" role="H1"> <xsl:value-of select="$title"/> <xsl:value-of select="$linebreak"/> <xsl:value-of select="$doctypenumber"/> </fo:block> @@ -198,21 +198,21 @@ <xsl:variable name="title-toc"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="'title-toc'"/> </xsl:call-template> </xsl:variable> - <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt"><xsl:value-of select="$title-toc"/></fo:block> + <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block> <xsl:variable name="title-page"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="'title-page'"/> </xsl:call-template> </xsl:variable> <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block> - <fo:block> + <fo:block role="TOC"> <xsl:for-each select="xalan:nodeset($contents)//item[not (@type = 'annex' or @parent = 'annex') and @display = 'true']"> - <fo:block> + <fo:block role="TOCI"> <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm"> <xsl:if test="@level = 2 and @section != ''"> <xsl:attribute name="margin-left">20mm</xsl:attribute> </xsl:if> @@ -247,11 +247,11 @@ </xsl:for-each> <xsl:if test="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']"> <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt">ANNEXES</fo:block> <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']"> - <fo:block> + <fo:block role="TOCI"> <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm"> <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}"> <xsl:if test="@section != ''"> <fo:inline padding-right="3mm"> <xsl:choose> @@ -421,11 +421,14 @@ <!-- ============================= --> <xsl:template match="un:legal-statement//un:clause/un:title"> - <fo:block font-weight="bold"> + <xsl:variable name="level"> + <xsl:call-template name="getLevel"/> + </xsl:variable> + <fo:block font-weight="bold" role="H{$level}"> <xsl:choose> <xsl:when test="text() = 'Note'"> <xsl:attribute name="font-size">14pt</xsl:attribute> <xsl:attribute name="margin-top">28pt</xsl:attribute> <xsl:attribute name="margin-bottom">34pt</xsl:attribute> @@ -565,11 +568,14 @@ </fo:list-item> </fo:list-block> </xsl:template> <xsl:template match="un:title" mode="inline-header"> - <fo:inline> + <xsl:variable name="level"> + <xsl:call-template name="getLevel"/> + </xsl:variable> + <fo:inline role="H{$level}"> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="un:p"> @@ -737,12 +743,13 @@ <xsl:when test="$level = 1 and ancestor::un:preface">17pt</xsl:when> <xsl:when test="$level = 2">14pt</xsl:when> <xsl:otherwise>12pt</xsl:otherwise> </xsl:choose> </xsl:variable> - <fo:block font-size="{$font-size}" font-weight="bold" margin-top="30pt" margin-bottom="16pt" keep-with-next="always"> + <fo:block font-size="{$font-size}" font-weight="bold" margin-top="30pt" margin-bottom="16pt" keep-with-next="always" role="H{$level}"> <xsl:apply-templates/> + <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </fo:block> </xsl:template> <xsl:template match="un:annex//un:title" priority="3"> <xsl:variable name="level"> @@ -756,16 +763,17 @@ </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="$level = 1"> - <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-top="12pt" margin-bottom="16pt" keep-with-next="always" line-height="18pt"> + <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-top="12pt" margin-bottom="16pt" keep-with-next="always" line-height="18pt" role="H{$level}"> <xsl:apply-templates/> + <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </fo:block> </xsl:when> <xsl:when test="$level &gt;= 2"> - <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always"> <!-- line-height="14.5pt" text-indent="-9.5mm" --> + <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always" role="H{$level}"> <!-- line-height="14.5pt" text-indent="-9.5mm" --> <xsl:if test="$level = 2"> <xsl:attribute name="margin-top">16pt</xsl:attribute> </xsl:if> <xsl:if test="$level = 3"> <xsl:attribute name="margin-top">16pt</xsl:attribute> @@ -794,11 +802,11 @@ <xsl:choose> <xsl:when test="ancestor::un:sections"> - <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always"> <!-- line-height="14.5pt" text-indent="-9.5mm" --> + <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always" role="H{$level}"> <!-- line-height="14.5pt" text-indent="-9.5mm" --> <xsl:if test="$level = 1"> <!-- <xsl:attribute name="margin-left">-8.5mm</xsl:attribute> --> <xsl:attribute name="margin-top">18pt</xsl:attribute> <xsl:attribute name="margin-bottom">16pt</xsl:attribute> </xsl:if> @@ -811,12 +819,13 @@ <xsl:call-template name="insertTitleAsListItem"/> </fo:block> </xsl:when> <xsl:otherwise> - <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always"> + <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always" role="H{$level}"> <xsl:apply-templates/> + <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- ====== --> @@ -1015,33 +1024,33 @@ </xsl:template> <!-- ============================ --> <!-- ============================ --> <xsl:template name="insertHeaderPreface"> - <fo:static-content flow-name="header"> + <fo:static-content flow-name="header" role="artifact"> <fo:block-container height="25.5mm" display-align="before" border-bottom="0.5pt solid black"> <fo:block font-weight="bold" padding-top="20.5mm" text-align="center"> <!-- <xsl:text>UN/CEFACT </xsl:text> --> <xsl:value-of select="$doctypenumber"/> </fo:block> </fo:block-container> </fo:static-content> </xsl:template> <xsl:template name="insertHeader"> - <fo:static-content flow-name="header"> + <fo:static-content flow-name="header" role="artifact"> <fo:block-container height="28.5mm" display-align="before" border-bottom="0.5pt solid black"> <fo:block font-weight="bold" padding-top="20.5mm" text-align="center"> <!-- <xsl:text>UN/CEFACT </xsl:text> --> <xsl:value-of select="$doctypenumber"/> </fo:block> </fo:block-container> </fo:static-content> </xsl:template> <xsl:template name="insertFooter"> - <fo:static-content flow-name="footer"> + <fo:static-content flow-name="footer" role="artifact"> <fo:block-container height="29mm" display-align="after"> <fo:block font-size="9pt" font-weight="bold" text-align="center" padding-bottom="24mm"><fo:page-number/></fo:block> </fo:block-container> </fo:static-content> </xsl:template> @@ -1225,10 +1234,11 @@ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style"> <xsl:attribute name="white-space">pre</xsl:attribute> <xsl:attribute name="wrap-option">wrap</xsl:attribute> + <xsl:attribute name="role">Code</xsl:attribute> @@ -1250,12 +1260,17 @@ </xsl:attribute-set><xsl:attribute-set name="requirement-name-style"> </xsl:attribute-set><xsl:attribute-set name="requirement-label-style"> - </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style"> - </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style"> + </xsl:attribute-set><xsl:attribute-set name="subject-style"> + </xsl:attribute-set><xsl:attribute-set name="inherit-style"> + </xsl:attribute-set><xsl:attribute-set name="description-style"> + </xsl:attribute-set><xsl:attribute-set name="specification-style"> + </xsl:attribute-set><xsl:attribute-set name="measurement-target-style"> + </xsl:attribute-set><xsl:attribute-set name="verification-style"> + </xsl:attribute-set><xsl:attribute-set name="import-style"> </xsl:attribute-set><xsl:attribute-set name="recommendation-style"> </xsl:attribute-set><xsl:attribute-set name="recommendation-name-style"> @@ -1452,11 +1467,12 @@ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style"> - </xsl:attribute-set><xsl:attribute-set name="quote-style"> + </xsl:attribute-set><xsl:attribute-set name="quote-style"> + <xsl:attribute name="role">BlockQuote</xsl:attribute> @@ -1643,12 +1659,14 @@ <!-- Display table's name before table as standalone block --> <!-- $namespace = 'iso' or --> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> - + + + <xsl:call-template name="fn_name_display"/> <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/> @@ -3535,20 +3553,72 @@ <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:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/> + <xsl:variable name="comment_text_"> + <xsl:choose> + <xsl:when test="normalize-space($comment_text_following) != ''"> + <xsl:value-of select="$comment_text_following"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/> + + <xsl:if test="normalize-space($comment_text) != ''"> + <!-- put Mathin Alternate Text --> + <xsl:attribute name="fox:alt-text"> + <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/> + </xsl:attribute> + </xsl:if> + + <xsl:variable name="mathml_content"> + <xsl:apply-templates select="." mode="mathml_actual_text"/> + </xsl:variable> + <!-- put MathML in Actual Text --> + <xsl:attribute name="fox:actual-text"> + <xsl:value-of select="$mathml_content"/> + </xsl:attribute> + + <!-- <xsl:copy-of select="."/> --> <xsl:copy-of select="xalan:nodeset($mathml)"/> </fo:instream-foreign-object> </fo:inline> + </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text"> + <!-- <xsl:text>a+b</xsl:text> --> + <xsl:text>&lt;</xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:if test="local-name() = 'math'"> + <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text> + </xsl:if> + <xsl:for-each select="@*"> + <xsl:text> </xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:text>="</xsl:text> + <xsl:value-of select="."/> + <xsl:text>"</xsl:text> + </xsl:for-each> + <xsl:text>&gt;</xsl:text> + <xsl:apply-templates mode="mathml_actual_text"/> + <xsl:text>&lt;/</xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:text>&gt;</xsl:text> + </xsl:template><xsl:template match="text()" mode="mathml_actual_text"> + <xsl:value-of select="normalize-space()"/> </xsl:template><xsl:template match="@*|node()" mode="mathml"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="mathml"/> </xsl:copy> </xsl:template><xsl:template match="mathml:mtext" mode="mathml"> @@ -3606,11 +3676,14 @@ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style"> <xsl:apply-templates select="*[local-name()='title']" mode="process"/> </fo:block> <xsl:apply-templates/> </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process"> - <fo:inline><xsl:apply-templates/></fo:inline> + <xsl:variable name="level"> + <xsl:call-template name="getLevel"/> + </xsl:variable> + <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2"> <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style"> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> </fo:block> <xsl:apply-templates/> @@ -3641,13 +3714,14 @@ <xsl:with-param name="name" select="'title-modified'"/> </xsl:call-template> </xsl:variable> + <xsl:variable name="text"><xsl:apply-templates/></xsl:variable> <xsl:choose> - <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when> - <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise> + <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when> + <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise> </xsl:choose> <xsl:apply-templates/> </xsl:template><xsl:template match="*[local-name() = 'xref']"> <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style"> @@ -3804,11 +3878,14 @@ <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation"> <xsl:if test="normalize-space() != ''"> - <fo:inline> + <xsl:variable name="level"> + <xsl:call-template name="getLevelTermName"/> + </xsl:variable> + <fo:inline role="H{$level}"> <xsl:apply-templates/> <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'"> <xsl:text>.</xsl:text> </xsl:if> --> </fo:inline> @@ -4440,10 +4517,11 @@ <xsl:when test="*[local-name() = 'tab']"> <xsl:apply-templates select="*[local-name() = 'tab'][1]/following-sibling::node()"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> + <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </xsl:otherwise> </xsl:choose> </fo:block> </fo:list-item-body> </fo:list-item> @@ -4580,18 +4658,10 @@ </fo:block> </xsl:template><xsl:template match="*[local-name() = 'requirement']/@obligation" mode="presentation"> <fo:block> <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/> </fo:block> - </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation"> - <fo:block xsl:use-attribute-sets="requirement-subject-style"> - <xsl:text>Target Type </xsl:text><xsl:apply-templates/> - </fo:block> - </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']"> - <fo:block xsl:use-attribute-sets="requirement-inherit-style"> - <xsl:text>Dependency </xsl:text><xsl:apply-templates/> - </fo:block> </xsl:template><xsl:template match="*[local-name() = 'recommendation']"> <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style"> <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/> <xsl:apply-templates/> </fo:block> @@ -4604,10 +4674,42 @@ </xsl:if> </xsl:template><xsl:template match="*[local-name() = 'recommendation']/*[local-name() = 'label']"> <fo:block xsl:use-attribute-sets="recommendation-label-style"> <xsl:apply-templates/> </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation"> + <fo:block xsl:use-attribute-sets="subject-style"> + <xsl:text>Target Type </xsl:text><xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'subject']"> + <fo:block xsl:use-attribute-sets="subject-style"> + <xsl:text>Target Type </xsl:text><xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']"> + <fo:block xsl:use-attribute-sets="inherit-style"> + <xsl:text>Dependency </xsl:text><xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']"> + <fo:block xsl:use-attribute-sets="description-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']"> + <fo:block xsl:use-attribute-sets="specification-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']"> + <fo:block xsl:use-attribute-sets="measurement-target-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']"> + <fo:block xsl:use-attribute-sets="verification-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']"> + <fo:block xsl:use-attribute-sets="import-style"> + <xsl:apply-templates/> + </fo:block> </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']"> <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt"> <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']"> <xsl:attribute name="margin-bottom">0pt</xsl:attribute> </xsl:if> @@ -5476,10 +5578,13 @@ </fo:inline> </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']"> <fo:block-container border="1pt solid black" width="50%"> <fo:block> </fo:block> </fo:block-container> + </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"> + <fo:inline padding-right="5mm"> </fo:inline> + <fo:inline><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template name="convertDate"> <xsl:param name="date"/> <xsl:param name="format" select="'short'"/> <xsl:variable name="year" select="substring($date, 1, 4)"/> <xsl:variable name="month" select="substring($date, 6, 2)"/> @@ -5712,9 +5817,29 @@ <xsl:value-of select="$level_total - 1"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="$level"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:template name="getLevelTermName"> + <xsl:choose> + <xsl:when test="normalize-space(../@depth) != ''"> + <xsl:value-of select="../@depth"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="title_level_"> + <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]"> + <xsl:call-template name="getLevel"/> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="title_level" select="normalize-space($title_level_)"/> + <xsl:choose> + <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when> + <xsl:otherwise> + <xsl:call-template name="getLevel"/> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="split"> <xsl:param name="pText" select="."/> <xsl:param name="sep" select="','"/> \ No newline at end of file