lib/isodoc/itu/itu.service-publication.xsl in metanorma-itu-2.2.8 vs lib/isodoc/itu/itu.service-publication.xsl in metanorma-itu-2.2.9
- old
+ new
@@ -2761,15 +2761,21 @@
<!-- ========================== -->
<!-- ========================== -->
<!-- Definition's list styles -->
<!-- ========================== -->
+
+ <xsl:attribute-set name="dl-block-style">
+
+ </xsl:attribute-set>
+
<xsl:attribute-set name="dt-row-style">
</xsl:attribute-set>
<xsl:attribute-set name="dt-cell-style">
+
</xsl:attribute-set>
<xsl:attribute-set name="dt-block-style">
<xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -2785,10 +2791,11 @@
</xsl:attribute-set> <!-- dl-name-style -->
<xsl:attribute-set name="dd-cell-style">
<xsl:attribute name="padding-left">2mm</xsl:attribute>
+
</xsl:attribute-set>
<!-- ========================== -->
<!-- END Definition's list styles -->
<!-- ========================== -->
@@ -2908,10 +2915,14 @@
<xsl:attribute name="space-after">6pt</xsl:attribute>
<xsl:attribute name="keep-with-previous">always</xsl:attribute>
</xsl:attribute-set>
+ <xsl:attribute-set name="figure-source-style">
+
+ </xsl:attribute-set>
+
<!-- Formula's styles -->
<xsl:attribute-set name="formula-style">
<xsl:attribute name="margin-top">6pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -3455,11 +3466,11 @@
</xsl:if>
</xsl:template>
<xsl:template name="processTables_Contents">
<tables>
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
<table id="{@id}" alt-text="{*[local-name() = 'name']}">
<xsl:copy-of select="*[local-name() = 'name']"/>
</table>
</xsl:for-each>
</tables>
@@ -3820,11 +3831,11 @@
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
<xsl:if test="$isNoteOrFnExist = 'true'">
<xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
</xsl:if>
<xsl:choose>
@@ -3864,11 +3875,11 @@
<xsl:choose>
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
</xsl:when>
<xsl:otherwise>
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
@@ -3968,10 +3979,15 @@
</fo:block>
</xsl:if>
</xsl:template> <!-- table/name -->
+ <!-- SOURCE: ... -->
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
+ <xsl:call-template name="termsource"/>
+ </xsl:template>
+
<xsl:template name="calculate-columns-numbers">
<xsl:param name="table-row"/>
<xsl:variable name="columns-count" select="count($table-row/*)"/>
<xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
@@ -4324,11 +4340,11 @@
<xsl:apply-templates/>
</fo:table-header>
</xsl:template> <!-- thead -->
- <!-- template is using for iso, jcgm, bsi only -->
+ <!-- template is using for iec, iso, jcgm, bsi only -->
<xsl:template name="table-header-title">
<xsl:param name="cols-count"/>
<!-- row for title -->
<fo:table-row>
<fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
@@ -4367,11 +4383,11 @@
<xsl:template name="insertTableFooterInSeparateTable">
<xsl:param name="table_attributes"/>
<xsl:param name="colwidths"/>
<xsl:param name="colgroup"/>
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
<xsl:variable name="isNoteOrFnExistShowAfterTable">
</xsl:variable>
@@ -4456,10 +4472,11 @@
<!-- except gb and bsi -->
<xsl:apply-templates select="../*[local-name()='dl']"/>
<xsl:apply-templates select="../*[local-name()='note']"/>
+ <xsl:apply-templates select="../*[local-name()='source']"/>
<xsl:variable name="isDisplayRowSeparator">
</xsl:variable>
@@ -5125,18 +5142,30 @@
<!-- ===================== -->
<xsl:template match="*[local-name()='dl']">
<xsl:variable name="isAdded" select="@added"/>
<xsl:variable name="isDeleted" select="@deleted"/>
<!-- <dl><xsl:copy-of select="."/></dl> -->
- <fo:block-container>
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
<xsl:call-template name="setBlockSpanAll"/>
<xsl:if test="not(ancestor::*[local-name() = 'quote'])">
<xsl:attribute name="margin-left">0mm</xsl:attribute>
</xsl:if>
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
+ <!-- set font-size as sourcecode font-size -->
+ <xsl:variable name="sourcecode_attributes">
+ <xsl:call-template name="get_sourcecode_attributes"/>
+ </xsl:variable>
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:for-each>
+ </xsl:if>
+
<xsl:if test="parent::*[local-name() = 'note']">
<xsl:attribute name="margin-left">
<xsl:choose>
<xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
@@ -5572,10 +5601,11 @@
<xsl:template match="*[local-name()='dt']">
<xsl:param name="key_iso"/>
<xsl:param name="split_keep-within-line"/>
<fo:table-row xsl:use-attribute-sets="dt-row-style">
+
<xsl:call-template name="insert_dt_cell">
<xsl:with-param name="key_iso" select="$key_iso"/>
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
</xsl:call-template>
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
@@ -5593,10 +5623,11 @@
<xsl:if test="$isGenerateTableIF = 'true'">
<!-- border is mandatory, to calculate real width -->
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
<xsl:attribute name="text-align">left</xsl:attribute>
+
</xsl:if>
<xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
<xsl:attribute name="padding-right">3mm</xsl:attribute>
</xsl:if>
@@ -6045,10 +6076,11 @@
<xsl:choose>
<xsl:when test="$styles/style">
<fo:inline>
<xsl:for-each select="$styles/style">
<xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
+
</xsl:for-each>
<xsl:apply-templates/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
@@ -7550,10 +7582,17 @@
<fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
+ <!-- SOURCE: ... -->
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
+
+ <xsl:call-template name="termsource"/>
+
+ </xsl:template>
+
<xsl:template match="*[local-name() = 'image']">
<xsl:variable name="isAdded" select="../@added"/>
<xsl:variable name="isDeleted" select="../@deleted"/>
<xsl:choose>
<xsl:when test="ancestor::*[local-name() = 'title']">
@@ -8681,13 +8720,15 @@
<xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
<xsl:attribute name="margin-top">0pt</xsl:attribute>
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
</xsl:if>
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
</fo:block>
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
+
<xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
</fo:block-container>
</fo:block-container>
</xsl:otherwise>
@@ -8715,15 +8756,26 @@
</xsl:template>
<!-- add sourcecode highlighting -->
<xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
<xsl:variable name="class" select="@class"/>
+
+ <!-- Example: <1> -->
+ <xsl:variable name="is_callout">
+ <xsl:if test="parent::*[local-name() = 'dt']">
+ <xsl:variable name="dt_id" select="../@id"/>
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
+ </xsl:if>
+ </xsl:variable>
+
<xsl:choose>
<xsl:when test="$sourcecode_css//class[@name = $class]">
<fo:inline>
<xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
+ <xsl:if test="$is_callout = 'true'"><</xsl:if>
<xsl:apply-templates/>
+ <xsl:if test="$is_callout = 'true'">></xsl:if>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
@@ -9143,10 +9195,14 @@
<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() = 'div']">
+ <fo:block><xsl:apply-templates/></fo:block>
+ </xsl:template>
+
<xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
<fo:block xsl:use-attribute-sets="inherit-style">
<xsl:text>Dependency </xsl:text><xsl:apply-templates/>
</fo:block>
</xsl:template>
@@ -9837,17 +9893,12 @@
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="*[local-name() = 'deprecates']">
- <xsl:variable name="title-deprecated">
- <xsl:call-template name="getLocalizedString">
- <xsl:with-param name="key">deprecated</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
<fo:block xsl:use-attribute-sets="deprecates-style">
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
+ <xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template name="setStyle_preferred">
<xsl:if test="*[local-name() = 'strong']">
@@ -11102,9 +11153,26 @@
<xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
<xsl:copy-of select="."/>
</xsl:template>
+
+ <!-- add @id, redundant for table auto-layout algorithm -->
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:call-template name="add_id"/>
+ <xsl:apply-templates mode="update_xml_step1"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template name="add_id">
+ <xsl:if test="not(@id)">
+ <!-- add @id - first element with @id plus '_element_name' -->
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
<!-- =========================================================================== -->
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
<!-- =========================================================================== -->
<!-- =========================================================================== -->
\ No newline at end of file