lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.3.7 vs lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.3.8

- old
+ new

@@ -44,10 +44,12 @@ <xsl:choose> <xsl:when test="$selectedStyle = '2'">rgb(0, 177, 255)</xsl:when> <xsl:otherwise>rgb(246, 223, 140)</xsl:otherwise> </xsl:choose> </xsl:variable> + <xsl:variable name="color_dl_dt">rgb(215,243,255)</xsl:variable> + <xsl:variable name="color_dl_dd">rgb(242,251,255)</xsl:variable> <xsl:variable name="color_blue">rgb(33, 55, 92)</xsl:variable> <xsl:variable name="toc_recommendations_"> <xsl:for-each select="//ogc:table[.//ogc:p[@class = 'RecommendationTitle']]"> <xsl:variable name="table_id" select="@id"/> @@ -843,13 +845,12 @@ <xsl:apply-templates/> </fo:block> </xsl:template> <!-- ====== --> - <!-- title --> + <!-- title --> <!-- ====== --> - <xsl:template match="ogc:title" name="title"> <xsl:variable name="level"> <xsl:call-template name="getLevel"/> </xsl:variable> @@ -955,13 +956,13 @@ <xsl:apply-templates/> <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/> </xsl:element> </xsl:otherwise> </xsl:choose> - </xsl:template> <!-- ====== --> + <!-- END: title --> <!-- ====== --> <xsl:template match="ogc:p" name="paragraph"> <xsl:param name="inline" select="'false'"/> <xsl:param name="split_keep-within-line"/> @@ -991,10 +992,13 @@ <xsl:attribute name="line-height">124%</xsl:attribute> <xsl:attribute name="margin-bottom">10pt</xsl:attribute> </xsl:if> <xsl:if test="ancestor::ogc:dd and not(ancestor::ogc:table)"> <xsl:attribute name="margin-bottom">4pt</xsl:attribute> + <xsl:if test="not(ancestor::ogc:dd[1]/following-sibling::ogc:dt)"> + <xsl:attribute name="margin-bottom">0pt</xsl:attribute> + </xsl:if> </xsl:if> <xsl:apply-templates> <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/> </xsl:apply-templates> @@ -2178,17 +2182,29 @@ <!-- ========================== --> <!-- ========================== --> <!-- Definition's list styles --> <!-- ========================== --> + + <xsl:attribute-set name="dl-block-style"> + + <xsl:attribute name="margin-bottom">8pt</xsl:attribute> + + </xsl:attribute-set> + <xsl:attribute-set name="dt-row-style"> <xsl:attribute name="min-height">8.5mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="dt-cell-style"> + + <xsl:attribute name="padding-top">0.5mm</xsl:attribute> + <xsl:attribute name="padding-right">5mm</xsl:attribute> + <xsl:attribute name="padding-left">1mm</xsl:attribute> + </xsl:attribute-set> <xsl:attribute-set name="dt-block-style"> <xsl:attribute name="margin-top">0pt</xsl:attribute> @@ -2205,10 +2221,13 @@ </xsl:attribute-set> <!-- dl-name-style --> <xsl:attribute-set name="dd-cell-style"> <xsl:attribute name="padding-left">2mm</xsl:attribute> + + <xsl:attribute name="padding-top">0.5mm</xsl:attribute> + </xsl:attribute-set> <!-- ========================== --> <!-- END Definition's list styles --> <!-- ========================== --> @@ -2350,10 +2369,14 @@ <xsl:attribute name="keep-with-previous">always</xsl:attribute> <xsl:attribute name="text-align">center</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> @@ -2902,11 +2925,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> @@ -3269,11 +3292,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> @@ -3313,11 +3336,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> @@ -3414,10 +3437,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])"/> @@ -3770,11 +3798,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"> @@ -3813,11 +3841,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> @@ -3883,10 +3911,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> @@ -4540,18 +4569,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> @@ -4981,10 +5022,15 @@ <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:if test="not(following-sibling::ogc:dt) or ancestor::ogc:sourcecode"> <!-- last item --> + <xsl:attribute name="min-height">3mm</xsl:attribute> + </xsl:if> + <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]"> @@ -5002,19 +5048,35 @@ <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:attribute name="padding-left">6mm</xsl:attribute> + <!-- <xsl:attribute name="padding-left">6.5mm</xsl:attribute> --> + </xsl:if> + <xsl:if test="not(ancestor::ogc:sourcecode)"> + <!-- <xsl:attribute name="border-left">1pt solid <xsl:value-of select="$color_design"/></xsl:attribute> --> + <xsl:attribute name="background-color"><xsl:value-of select="$color_dl_dt"/></xsl:attribute> + </xsl:if> + <fo:block xsl:use-attribute-sets="dt-block-style"> <xsl:copy-of select="@id"/> <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="margin-top">0</xsl:attribute> </xsl:if> + <xsl:if test="ancestor::ogc:sourcecode"> + <xsl:attribute name="margin-bottom">2pt</xsl:attribute> + </xsl:if> + <xsl:if test="not(following-sibling::ogc:dt)"> <!-- last dt --> + <xsl:attribute name="margin-bottom">0</xsl:attribute> + </xsl:if> + <xsl:apply-templates> <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/> </xsl:apply-templates> <xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> --> @@ -5030,10 +5092,14 @@ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- border is mandatory, to calculate real width --> <xsl:attribute name="border">0.1pt solid black</xsl:attribute> </xsl:if> + <xsl:if test="not(ancestor::ogc:sourcecode)"> + <xsl:attribute name="background-color"><xsl:value-of select="$color_dl_dd"/></xsl:attribute> + </xsl:if> + <fo:block> <xsl:if test="$isGenerateTableIF = 'true'"> <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> </xsl:if> @@ -5449,10 +5515,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> @@ -6958,10 +7025,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']"> @@ -8118,13 +8192,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 --> <xsl:if test="parent::*[local-name() = 'example']"> <fo:block font-size="1pt" line-height="10%" space-before="6pt"> </fo:block> </xsl:if> @@ -8156,15 +8232,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'">&lt;</xsl:if> <xsl:apply-templates/> + <xsl:if test="$is_callout = 'true'">&gt;</xsl:if> </fo:inline> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> @@ -8592,10 +8679,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> @@ -9298,17 +9389,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']"> @@ -10535,9 +10621,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