Skip to content

Commit

Permalink
ISO xslt updated for layout 1951 before 19680101, metanorma/metanorma…
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Jul 25, 2024
1 parent 9bdb5df commit a39a52d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 15 deletions.
12 changes: 11 additions & 1 deletion xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -3759,6 +3759,11 @@
</xsl:if>

<xsl:if test="$namespace = 'iso'">
<xsl:if test="$layoutVersion = '1951'">
<xsl:if test="$revision_date_num &lt; 19680101">
<xsl:attribute name="font-size">8.5pt</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="$layoutVersion = '1972' or $layoutVersion = '1979' or $layoutVersion = '1987' or $layoutVersion = '1989'">
<xsl:attribute name="font-size">9pt</xsl:attribute>
</xsl:if>
Expand Down Expand Up @@ -3867,6 +3872,11 @@
</xsl:if>
<xsl:if test="$namespace = 'iso'">
<xsl:variable name="note_name" select="*[local-name() = 'name']"/>
<xsl:if test="$layoutVersion = '1951'">
<xsl:if test="$revision_date_num &lt; 19680101">
<xsl:attribute name="padding-right">0mm</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="$layoutVersion = '1987'">
<xsl:attribute name="padding-right">1mm</xsl:attribute>
<xsl:if test="not(translate($note_name,'0123456789','') = $note_name)"> <!-- NOTE with number -->
Expand Down Expand Up @@ -10809,7 +10819,7 @@
</fo:inline>
</xsl:template>

<xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
<xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
<!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
<xsl:variable name="text" select="."/>
<xsl:variable name="ratio_">
Expand Down
75 changes: 61 additions & 14 deletions xslt_src/iso.international-standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,10 @@
<xsl:when test="$layoutVersion = '1951'">
<fo:page-sequence master-reference="cover-page_1951" force-page-count="no-force">
<fo:static-content flow-name="cover-page-header" font-family="Times New Roman" font-size="8.5pt" font-weight="bold">
<xsl:if test="$revision_date_num &lt; 19680101">
<xsl:attribute name="font-family">Arial</xsl:attribute>
<xsl:attribute name="font-size">8pt</xsl:attribute>
</xsl:if>
<fo:block-container height="99%" display-align="after">
<fo:block text-align-last="justify" role="SKIP">
<!-- Example: UDC 669.7 : 620.178.1 -->
Expand Down Expand Up @@ -1533,14 +1537,20 @@
<xsl:if test="$revision_date_num &lt; 19680101">
<xsl:attribute name="font-size">14pt</xsl:attribute>
</xsl:if>
<xsl:call-template name="insertTitlesLangMain"/>

<xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
<xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/>
<fo:block font-size="11pt" text-transform="uppercase" margin-top="2mm">
<xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
</fo:block>

</fo:block>
</fo:block-container>

<fo:block-container margin-top="8.5mm" font-size="10pt"> <!-- height="40mm" display-align="center" -->
<!-- Example: 1st EDITION -->
<!-- <fo:block><xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:edition[@language != '']" /></fo:block> -->
<fo:block font-weight="bold"><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:edition[@language != '']" /></fo:block>
<fo:block><xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:edition[@language != '']" /></fo:block> <!-- font-weight="bold" -->
<!-- <fo:block>&#xa0;</fo:block> -->
<!-- Example: October 1971 -->
<fo:block margin-top="2mm" font-size="9pt">
Expand Down Expand Up @@ -2819,6 +2829,19 @@
</xsl:if>
</xsl:template>

<!-- transform NOTE to Note for smallcaps feature working -->
<xsl:template match="iso:note/iso:name/text()" mode="update_xml_step1" priority="3">
<xsl:choose>
<xsl:when test="$layoutVersion = '1951' and $revision_date_num &lt; 19680101">
<xsl:value-of select="substring(., 1, 1)"/>
<xsl:value-of select="java:toLowerCase(java:java.lang.String.new(substring(., 2)))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="insertLogoImages2024">
<xsl:variable name="content-height">20</xsl:variable>
<xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:copyright/iso:owner/iso:organization">
Expand Down Expand Up @@ -3301,9 +3324,19 @@
</xsl:template>

<xsl:template match="iso:bibdata/iso:title[@type = 'title-main']">
<xsl:param name="body">false</xsl:param>
<xsl:choose>
<xsl:when test="$layoutVersion = '1951'">
<fo:block text-transform="uppercase" font-weight="bold" margin-top="5mm"><xsl:apply-templates /></fo:block>
<fo:block text-transform="uppercase" font-weight="bold" margin-top="5mm">
<xsl:if test="$revision_date_num &lt; 19680101">
<xsl:if test="$body = 'false'">
<xsl:attribute name="font-weight">normal</xsl:attribute>
</xsl:if>
<xsl:attribute name="font-size">11pt</xsl:attribute>
<xsl:attribute name="margin-top">3mm</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</fo:block>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
Expand Down Expand Up @@ -3370,7 +3403,7 @@
</xsl:choose>
</xsl:if>
<xsl:choose>
<xsl:when test="$layoutVersion = '1951'"></xsl:when>
<xsl:when test="$layoutVersion = '1951'"><fo:inline font-weight="normal"><xsl:apply-templates /></fo:inline></xsl:when>
<xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979') and $isMainLang = 'true'"/>
<xsl:when test="($layoutVersion = '1972' or $layoutVersion = '1979') and $isMainLang = 'false'">
<fo:inline font-weight="normal"><xsl:apply-templates /></fo:inline>
Expand Down Expand Up @@ -3420,12 +3453,11 @@
<xsl:template match="iso:sections//iso:p[@class = 'zzSTDTitle1']" priority="4">
<xsl:choose>
<xsl:when test="$layoutVersion = '1951'">
<fo:block font-size="13pt" font-weight="bold" text-align="center" margin-top="49mm" margin-bottom="20pt" text-transform="uppercase" line-height="1.1" role="H1">
<fo:block font-size="13pt" font-weight="bold" text-align="center" margin-top="49mm" margin-bottom="20mm" text-transform="uppercase" line-height="1.1" role="H1">
<xsl:if test="$revision_date_num &gt;= 19680101">
<xsl:attribute name="font-family">Arial</xsl:attribute>
<xsl:attribute name="font-size">10.5pt</xsl:attribute>
<xsl:attribute name="margin-top">24mm</xsl:attribute>
<xsl:attribute name="margin-bottom">20mm</xsl:attribute>
</xsl:if>
<xsl:if test="following-sibling::*[1][self::iso:p][starts-with(@class, 'zzSTDTitle')]">
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
Expand All @@ -3437,7 +3469,16 @@
<fo:block space-before="24pt"><xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']"/></fo:block>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>

<xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-intro']"/>
<xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-main']">
<xsl:with-param name="body">true</xsl:with-param>
</xsl:apply-templates>
<fo:block font-size="11pt" text-transform="uppercase" margin-top="2mm">
<xsl:apply-templates select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-part']/node()"/>
</fo:block>

<!-- <xsl:apply-templates/> -->
</xsl:otherwise>
</xsl:choose>

Expand Down Expand Up @@ -3633,7 +3674,7 @@
<xsl:template match="iso:copyright-statement/iso:clause[1]/iso:title" priority="2">
<xsl:choose>
<xsl:when test="$layoutVersion = '1951'">
<fo:block font-weight="bold"><xsl:apply-templates /></fo:block>
<fo:block><xsl:apply-templates /></fo:block> <!-- font-weight="bold" -->
<fo:block>&#xa0;</fo:block>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -3780,6 +3821,7 @@
<xsl:choose>
<xsl:when test="$level = 1 and ancestor::iso:preface and $revision_date_num &gt;= 19680101">9.5pt</xsl:when> <!-- BRIEF HISTORY, FOREWORD -->
<xsl:when test="$level = 1 and ancestor::iso:preface">13pt</xsl:when>
<xsl:when test="$revision_date_num &lt; 19680101 and ancestor::*[local-name() = 'sections'] and not(ancestor::*[local-name() = 'introduction'])">9pt</xsl:when>
<!-- <xsl:when test="$level = 1">9pt</xsl:when> -->
<xsl:otherwise>inherit</xsl:otherwise>
<!-- <xsl:when test="$level = 2">10pt</xsl:when>
Expand Down Expand Up @@ -3903,6 +3945,7 @@
<xsl:attribute name="space-after"> <!-- margin-bottom -->
<xsl:choose>
<xsl:when test="$layoutVersion = '1951' and $level = 1 and ancestor::iso:preface">14.7mm</xsl:when>
<xsl:when test="$layoutVersion = '1951' and parent::iso:introduction and $revision_date_num &lt; 19680101">6mm</xsl:when>
<xsl:when test="$layoutVersion = '1951' and parent::iso:introduction">2mm</xsl:when>
<xsl:when test="$layoutVersion = '1951' and $revision_date_num &gt;= 19680101">4pt</xsl:when>
<xsl:when test="$layoutVersion = '1951' and $level = 1">12pt</xsl:when>
Expand Down Expand Up @@ -4249,6 +4292,10 @@

<xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/text()" priority="5">
<xsl:choose>
<xsl:when test="$layoutVersion = '1951' and $revision_date_num &lt; 19680101">
<xsl:call-template name="smallcaps"/>
<xsl:value-of select="concat('. ', $em_dash, ' ')"/>
</xsl:when>
<xsl:when test="$layoutVersion = '1987' and not(translate(.,'0123456789','') = .)"> <!-- NOTE with number -->
<xsl:value-of select="substring-after(., ' ')"/>
</xsl:when>
Expand Down Expand Up @@ -4312,15 +4359,15 @@


<xsl:template name="processElementContent">
<xsl:variable name="level">
<xsl:for-each select="iso:title">
<xsl:call-template name="getLevel"/>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$layoutVersion = '1951' and $revision_date_num &gt;= 19680101 and ancestor::*[local-name() = 'sections' or local-name() = 'annex'] and not(self::iso:introduction)">
<xsl:when test="$layoutVersion = '1951' and ($revision_date_num &gt;= 19680101 or $level &gt;= 2) and ancestor::*[local-name() = 'sections' or local-name() = 'annex'] and not(self::iso:introduction)">

<fo:list-block role="SKIP">
<xsl:variable name="level">
<xsl:for-each select="iso:title">
<xsl:call-template name="getLevel"/>
</xsl:for-each>
</xsl:variable>
<xsl:attribute name="provisional-distance-between-starts">
<xsl:choose>
<xsl:when test="$level = 2">8mm</xsl:when>
Expand Down

0 comments on commit a39a52d

Please sign in to comment.