Skip to content

Commit

Permalink
Merge branch 'main' into fix/indexsect
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Dec 18, 2024
2 parents b52098c + 796eb47 commit ca94362
Show file tree
Hide file tree
Showing 7 changed files with 949 additions and 629 deletions.
96 changes: 66 additions & 30 deletions lib/isodoc/bipm/bipm.brochure.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,15 @@
</xsl:variable> -->

<xsl:variable name="update_xml_pres">
<xsl:apply-templates mode="update_xml_pres"/>
<xsl:apply-templates select="." mode="update_xml_pres"/>
</xsl:variable>

<xsl:if test="$debug = 'true'">
<redirect:write file="update_xml_pres.xml">
<xsl:copy-of select="xalan:nodeset($update_xml_pres)"/>
</redirect:write>
</xsl:if>

<xsl:message>START flatxml_</xsl:message>
<xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
<xsl:variable name="flatxml__">
Expand Down Expand Up @@ -477,9 +483,15 @@
</xsl:variable> -->

<xsl:variable name="update_xml_pres">
<xsl:apply-templates mode="update_xml_pres"/>
<xsl:apply-templates select="." mode="update_xml_pres"/>
</xsl:variable>

<xsl:if test="$debug = 'true'">
<redirect:write file="update_xml_pres.xml">
<xsl:copy-of select="xalan:nodeset($update_xml_pres)"/>
</redirect:write>
</xsl:if>

<xsl:variable name="flatxml__">
<!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
<!-- <xsl:apply-templates select="." mode="flatxml"/> -->
Expand Down Expand Up @@ -552,6 +564,12 @@

<!-- indexes=<xsl:copy-of select="$indexes"/> -->

<xsl:if test="$debug = 'true'">
<redirect:write file="flatxml.xml">
<xsl:copy-of select="$flatxml"/>
</redirect:write>
</xsl:if>

<xsl:apply-templates select="xalan:nodeset($flatxml)/bipm:bipm-standard" mode="bipm-standard">
<xsl:with-param name="curr_docnum" select="1"/>
</xsl:apply-templates>
Expand Down Expand Up @@ -583,6 +601,20 @@
<!-- END Move eref inside title -->
<!-- ================================= -->

<xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres" priority="2">
<xsl:element name="title" namespace="https://www.metanorma.org/ns/bipm">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="update_xml_pres"/>
</xsl:element>
</xsl:template>

<xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres" priority="2">
<xsl:element name="name" namespace="https://www.metanorma.org/ns/bipm">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="update_xml_pres"/>
</xsl:element>
</xsl:template>

<!-- ================================= -->
<!-- Flattening xml for fit notes at page sides (margins) -->
<!-- ================================= -->
Expand Down Expand Up @@ -1160,10 +1192,10 @@
<!-- <xsl:copy-of select="$contents"/> -->

<xsl:if test="$contents/doc[@id = $docid]//item[@display='true']">
<fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}">
<fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}" role="SKIP">
<fo:table-column column-width="127mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-body>
<fo:table-body role="SKIP">
<xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
<xsl:call-template name="insertContentItem"/>
</xsl:for-each>
Expand Down Expand Up @@ -1838,7 +1870,7 @@

<xsl:template name="insertContentItem">
<xsl:param name="keep-with-next"/>
<fo:table-row>
<fo:table-row role="TOCI">
<xsl:if test="$keep-with-next = 'true'">
<xsl:attribute name="keep-with-next">always</xsl:attribute>
</xsl:if>
Expand All @@ -1856,14 +1888,14 @@
</xsl:choose>
</xsl:variable>

<fo:table-cell>
<fo:table-cell role="SKIP">
<xsl:if test="normalize-space($space-before) != ''">
<xsl:attribute name="padding-top"><xsl:value-of select="normalize-space($space-before)"/></xsl:attribute>
</xsl:if>
<xsl:if test="normalize-space($space-after) != ''">
<xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
</xsl:if>
<fo:block role="TOCI">
<fo:block role="SKIP">
<xsl:if test="@level = 1">
<xsl:attribute name="font-family">Arial</xsl:attribute>
<xsl:attribute name="font-size">10pt</xsl:attribute>
Expand Down Expand Up @@ -1891,7 +1923,7 @@
<xsl:attribute name="space-before">14pt</xsl:attribute>
</xsl:if>

<fo:list-block>
<fo:list-block role="SKIP">
<xsl:attribute name="provisional-distance-between-starts">
<xsl:choose>
<xsl:when test="@section = '' or @level &gt; 3">0mm</xsl:when>
Expand All @@ -1902,28 +1934,28 @@
</xsl:choose>
</xsl:attribute>

<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:list-item role="SKIP">
<fo:list-item-label end-indent="label-end()" role="SKIP">
<fo:block role="SKIP">
<xsl:if test="@level = 1 or (@level = 2 and not(@parent = 'annex'))">
<xsl:value-of select="@section"/>
<xsl:if test="normalize-space(@section) != '' and @type = 'annex'">.</xsl:if>
</xsl:if>

</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
<fo:list-item-body start-indent="body-start()" role="SKIP">
<fo:block role="SKIP">
<xsl:if test="@level &gt;= 3">
<xsl:attribute name="margin-left">11mm</xsl:attribute>
<xsl:attribute name="text-indent">-11mm</xsl:attribute>
</xsl:if>
<fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
<fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
<xsl:if test="@level &gt;= 3">
<fo:inline padding-right="2mm"><xsl:value-of select="@section"/></fo:inline>
<fo:inline padding-right="2mm" role="SKIP"><xsl:value-of select="@section"/></fo:inline>
</xsl:if>

<fo:inline>
<fo:inline role="SKIP">
<xsl:apply-templates select="title"/>
</fo:inline>

Expand All @@ -1934,16 +1966,16 @@
</fo:list-block>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="right">
<fo:table-cell text-align="right" role="SKIP">
<xsl:if test="normalize-space($space-before) != ''">
<xsl:attribute name="padding-top"><xsl:value-of select="normalize-space($space-before)"/></xsl:attribute>
</xsl:if>
<xsl:if test="normalize-space($space-after) != ''">
<xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
</xsl:if>
<fo:block>
<fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
<fo:inline font-family="Arial" font-weight="bold" font-size="10pt"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
<fo:block role="SKIP">
<fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
<fo:inline font-family="Arial" font-weight="bold" font-size="10pt" role="SKIP"><fo:wrapper role="artifact"><fo:page-number-citation ref-id="{@id}"/></fo:wrapper></fo:inline>
</fo:basic-link>
</fo:block>
</fo:table-cell>
Expand Down Expand Up @@ -2287,6 +2319,10 @@
<xsl:otherwise>
<fo:block role="H{$level}">

<xsl:if test="ancestor::*[local-name() = 'clause'][@type = 'toc'] and $level &gt;= 3">
<xsl:attribute name="role">Caption</xsl:attribute>
</xsl:if>

<xsl:choose>
<xsl:when test="ancestor::bipm:annex and $level &gt;= 2">
<xsl:if test="$level &gt;= 3">
Expand Down Expand Up @@ -3296,7 +3332,7 @@
<!-- Table of Contents (ToC) processing -->
<!-- =================== -->
<xsl:template match="bipm:clause[@type = 'toc']" priority="3">
<fo:block role="TOC">
<fo:block>
<xsl:copy-of select="@id"/>
<xsl:apply-templates select="bipm:title[1]"/>

Expand All @@ -3314,12 +3350,12 @@
</xsl:call-template>
</xsl:variable>

<fo:table width="100%" table-layout="fixed">
<fo:table width="100%" table-layout="fixed" role="TOC">
<fo:table-column column-width="100%"/>
<fo:table-header>
<fo:table-row font-weight="bold">
<fo:table-cell text-align="right" font-size="9pt" font-family="Arial">
<fo:block>
<fo:table-header role="SKIP">
<fo:table-row font-weight="bold" role="SKIP">
<fo:table-cell text-align="right" font-size="9pt" font-family="Arial" role="SKIP">
<fo:block role="Caption">
<xsl:variable name="page">
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">Page.sg</xsl:with-param>
Expand All @@ -3330,10 +3366,10 @@
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:table-body role="SKIP">
<fo:table-row role="SKIP">
<fo:table-cell role="SKIP">
<fo:block role="SKIP">
<xsl:variable name="title_id" select="generate-id(bipm:title[1])"/>
<xsl:apply-templates select="*[not(generate-id() = $title_id)]">
<xsl:with-param name="colwidths" select="$colwidths"/>
Expand Down
Loading

0 comments on commit ca94362

Please sign in to comment.