lib/isodoc/cc/cc.standard.xsl in metanorma-cc-1.7.9 vs lib/isodoc/cc/cc.standard.xsl in metanorma-cc-1.7.10

- old
+ new

@@ -149,11 +149,11 @@ <xsl:text> TC </xsl:text> <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:editorialgroup/csd:technical-committee"/> <xsl:text> </xsl:text> </fo:block> </fo:block> - <fo:block font-size="24pt" font-weight="bold" text-align="center"> + <fo:block font-size="24pt" font-weight="bold" text-align="center" role="H1"> <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/> <xsl:value-of select="$linebreak"/> </fo:block> <fo:block> </fo:block> <fo:block margin-bottom="12pt"> </fo:block> @@ -228,54 +228,56 @@ </fo:block> <fo:block break-after="page"/> <fo:block-container font-weight="bold" line-height="115%"> - <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-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block> - - <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface --> + <fo:block role="TOC"> + <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-bottom="15.5pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block> - <fo:block> - <xsl:if test="@level = 1"> - <xsl:attribute name="margin-top">6pt</xsl:attribute> - </xsl:if> + <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface --> - - <fo:list-block> - <xsl:attribute name="provisional-distance-between-starts"> - <xsl:choose> - <!-- skip 0 section without subsections --> - <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') --> - <xsl:otherwise>0mm</xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <fo:list-item> - <fo:list-item-label end-indent="label-end()"> - <fo:block> - <xsl:value-of select="@section"/> - </fo:block> - </fo:list-item-label> - <fo:list-item-body start-indent="body-start()"> - <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm"> - <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}"> - <xsl:apply-templates select="title"/> - <fo:inline keep-together.within-line="always"> - <fo:leader leader-pattern="dots"/> - <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline> - </fo:inline> - </fo:basic-link> - </fo:block> - </fo:list-item-body> - </fo:list-item> - </fo:list-block> - </fo:block> - </xsl:for-each> + <fo:block role="TOCI"> + <xsl:if test="@level = 1"> + <xsl:attribute name="margin-top">6pt</xsl:attribute> + </xsl:if> + + + <fo:list-block> + <xsl:attribute name="provisional-distance-between-starts"> + <xsl:choose> + <!-- skip 0 section without subsections --> + <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') --> + <xsl:otherwise>0mm</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block> + <xsl:value-of select="@section"/> + </fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm"> + <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}"> + <xsl:apply-templates select="title"/> + <fo:inline keep-together.within-line="always"> + <fo:leader leader-pattern="dots"/> + <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline> + </fo:inline> + </fo:basic-link> + </fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + </fo:block> + </xsl:for-each> + </fo:block> </fo:block-container> <!-- Foreword, Introduction --> <xsl:call-template name="processPrefaceSectionsDefault"/> @@ -290,11 +292,11 @@ <fo:leader leader-pattern="rule" leader-length="30%"/> </fo:block> </fo:static-content> <xsl:call-template name="insertHeaderFooter"/> <fo:flow flow-name="xsl-region-body"> - <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt"> + <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt" role="H1"> <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/> </fo:block> <fo:block> <xsl:call-template name="processMainSectionsDefault"/> </fo:block> @@ -364,11 +366,14 @@ <!-- ============================= --> <!-- ============================= --> <xsl:template match="csd:license-statement//csd:title"> - <fo:block text-align="center" font-weight="bold"> + <xsl:variable name="level"> + <xsl:call-template name="getLevel"/> + </xsl:variable> + <fo:block text-align="center" font-weight="bold" role="H{$level}"> <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="csd:license-statement//csd:p"> @@ -444,11 +449,13 @@ <xsl:attribute name="keep-with-next">always</xsl:attribute> <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute> <xsl:if test="ancestor::csd:sections"> <xsl:attribute name="margin-top">13.5pt</xsl:attribute> </xsl:if> + <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute> <xsl:apply-templates/> + <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </xsl:element> </xsl:template> <xsl:template match="csd:p"> @@ -635,11 +642,14 @@ <xsl:choose> <xsl:when test="$level &gt;= 3">11pt</xsl:when> <xsl:otherwise>12pt</xsl:otherwise> </xsl:choose> </xsl:variable> - <fo:block font-size="{$font-size}" line-height="1.1"> + <xsl:variable name="levelTerm"> + <xsl:call-template name="getLevelTermName"/> + </xsl:variable> + <fo:block font-size="{$font-size}" line-height="1.1" role="H{$levelTerm}"> <fo:block font-weight="bold" keep-with-next="always"> <xsl:apply-templates select="ancestor::csd:term/csd:name" mode="presentation"/> </fo:block> <fo:block font-weight="bold" keep-with-next="always"> <xsl:apply-templates/> @@ -752,18 +762,18 @@ </xsl:template> <xsl:template name="insertHeaderFooter"> - <fo:static-content flow-name="header-even"> + <fo:static-content flow-name="header-even" role="artifact"> <fo:block-container height="17mm" display-align="before"> <fo:block padding-top="12.5mm"> <xsl:value-of select="$header"/> </fo:block> </fo:block-container> </fo:static-content> - <fo:static-content flow-name="footer-even"> + <fo:static-content flow-name="footer-even" role="artifact"> <fo:block-container font-size="10pt" height="100%" display-align="after"> <fo:table table-layout="fixed" width="100%"> <fo:table-column column-width="10%"/> <fo:table-column column-width="90%"/> <fo:table-body> @@ -777,18 +787,18 @@ </fo:table-row> </fo:table-body> </fo:table> </fo:block-container> </fo:static-content> - <fo:static-content flow-name="header-odd"> + <fo:static-content flow-name="header-odd" role="artifact"> <fo:block-container height="17mm" display-align="before"> <fo:block text-align="right" padding-top="12.5mm"> <xsl:value-of select="$header"/> </fo:block> </fo:block-container> </fo:static-content> - <fo:static-content flow-name="footer-odd"> + <fo:static-content flow-name="footer-odd" role="artifact"> <fo:block-container font-size="10pt" height="100%" display-align="after"> <fo:table table-layout="fixed" width="100%"> <fo:table-column column-width="90%"/> <fo:table-column column-width="10%"/> <fo:table-body> @@ -976,10 +986,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> <xsl:attribute name="font-family">Source Code Pro</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> @@ -1001,12 +1012,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"> @@ -1215,11 +1231,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> <xsl:attribute name="margin-top">12pt</xsl:attribute> <xsl:attribute name="margin-left">12mm</xsl:attribute> <xsl:attribute name="margin-right">12mm</xsl:attribute> @@ -1416,12 +1433,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)"/> @@ -3268,20 +3287,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"> @@ -3339,11 +3410,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/> @@ -3374,13 +3448,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"> @@ -3520,11 +3595,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> @@ -4151,10 +4229,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> @@ -4291,18 +4370,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> @@ -4315,10 +4386,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> @@ -5194,10 +5297,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)"/> @@ -5430,9 +5536,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