lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.7.7 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.7.8
- old
+ new
@@ -1518,15 +1518,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>
@@ -1542,10 +1548,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 -->
<!-- ========================== -->
@@ -1682,10 +1689,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>
@@ -2221,11 +2232,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>
@@ -2565,11 +2576,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>
@@ -2609,11 +2620,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>
@@ -2713,10 +2724,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])"/>
@@ -3069,11 +3085,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">
@@ -3112,11 +3128,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>
@@ -3182,10 +3198,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>
@@ -3814,18 +3831,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>
@@ -4261,10 +4290,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]">
@@ -4282,10 +4312,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>
<fo:block xsl:use-attribute-sets="dt-block-style">
<xsl:copy-of select="@id"/>
@@ -4796,10 +4827,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>
@@ -6295,10 +6327,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']">
@@ -7425,13 +7464,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>
@@ -7459,15 +7500,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>
@@ -7887,10 +7939,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>
@@ -8582,17 +8638,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']">
@@ -9812,9 +9863,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