Skip to content

Commit

Permalink
BIPM and JCGM xslt updated for new title and name format, #770 [skip …
Browse files Browse the repository at this point in the history
…actions]
  • Loading branch information
Intelligent2013 committed Dec 6, 2024
1 parent aa251b3 commit dcdb726
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
49 changes: 33 additions & 16 deletions xslt_src/bipm.brochure.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@
<xsl:with-param name="contents" select="$contents"/>
</xsl:call-template>

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

<xsl:choose>

Expand Down Expand Up @@ -454,9 +456,16 @@
<xsl:apply-templates select="." mode="title_eref"/>
</xsl:variable> -->

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

<xsl:message>START flatxml_</xsl:message>
<xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
<xsl:variable name="flatxml__">
<!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
<xsl:apply-templates select="." mode="flatxml"/>
<!-- <xsl:apply-templates select="." mode="flatxml"/> -->
<xsl:apply-templates select="xalan:nodeset($update_xml_pres)" mode="flatxml"/>
</xsl:variable>
<!-- save flatxml into the file and reload it -->
<xsl:variable name="updated_flatxml_filename" select="concat($output_path,'_flatxml_', java:getTime(java:java.util.Date.new()), '.xml')"/>
Expand Down Expand Up @@ -492,9 +501,14 @@
<xsl:apply-templates select="." mode="title_eref"/>
</xsl:variable> -->

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

<xsl:variable name="flatxml__">
<!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
<xsl:apply-templates select="." mode="flatxml"/>
<!-- <xsl:apply-templates select="." mode="flatxml"/> -->
<xsl:apply-templates select="xalan:nodeset($update_xml_pres)" mode="flatxml"/>
</xsl:variable>
<!-- save flatxml into the file and reload it -->
<xsl:variable name="updated_flatxml_filename" select="concat($output_path,'_flatxml_', java:getTime(java:java.util.Date.new()), '.xml')"/>
Expand Down Expand Up @@ -528,9 +542,20 @@
<xsl:apply-templates mode="title_eref"/>
</xsl:variable> -->

<xsl:variable name="update_xml_pres">
<xsl:apply-templates 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"/>
<!-- <xsl:apply-templates select="." mode="flatxml"/> -->
<xsl:apply-templates select="xalan:nodeset($update_xml_pres)" mode="flatxml"/>
</xsl:variable>

<!-- save flatxml into the file and reload it -->
Expand Down Expand Up @@ -1031,14 +1056,6 @@

<xsl:variable name="curr_lang" select="bipm:bibdata/bipm:language[@current = 'true']"/>

<xsl:if test="$debug = 'true'">
<xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
DEBUG
contents=<xsl:copy-of select="$contents"/>
<xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
</xsl:if>


<xsl:choose>
<xsl:when test="$independentAppendix = '' and not($doctype = 'guide')">

Expand Down Expand Up @@ -2077,10 +2094,10 @@
<!-- ============================= -->

<!-- element with title -->
<xsl:template match="*[bipm:title]" mode="contents">
<xsl:template match="*[bipm:title or bipm:fmt-title]" mode="contents">
<xsl:variable name="level">
<xsl:call-template name="getLevel">
<xsl:with-param name="depth" select="bipm:title/@depth"/>
<xsl:with-param name="depth" select="bipm:fmt-title/@depth | bipm:title/@depth"/>
</xsl:call-template>
</xsl:variable>

Expand Down
6 changes: 3 additions & 3 deletions xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<xsl:choose>
<xsl:when test="$namespace = 'bipm'">
<xsl:strip-space elements="bipm:xref"/>
<!-- <xsl:strip-space elements="bipm:xref"/> -->
</xsl:when>
<xsl:when test="$namespace = 'bsi'">
<!-- <xsl:strip-space elements="bsi:xref"/> -->
Expand Down Expand Up @@ -42,7 +42,7 @@
<!-- <xsl:strip-space elements="itu:xref"/> -->
</xsl:when>
<xsl:when test="$namespace = 'jcgm'">
<xsl:strip-space elements="jcgm:xref"/>
<!-- <xsl:strip-space elements="jcgm:xref"/> -->
</xsl:when>
<xsl:when test="$namespace = 'jis'">
<!-- <xsl:strip-space elements="jis:xref"/> -->
Expand Down Expand Up @@ -13175,7 +13175,7 @@
<fo:inline xsl:use-attribute-sets="termnote-name-style">

<xsl:choose>
<xsl:when test="$namespace = 'bsi' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iho' or $namespace = 'iso' or $namespace = 'itu' or $namespace = 'jis' or $namespace = 'nist-sp' or $namespace = 'nist-cswp' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' or $namespace = 'plateau' or $namespace = 'rsd'"></xsl:when>
<xsl:when test="$namespace = 'bipm' or $namespace = 'bsi' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iho' or $namespace = 'iso' or $namespace = 'itu' or $namespace = 'jcgm' or $namespace = 'jis' or $namespace = 'nist-sp' or $namespace = 'nist-cswp' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' or $namespace = 'plateau' or $namespace = 'rsd'"></xsl:when>
<xsl:otherwise>
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
<xsl:attribute name="padding-right">1mm</xsl:attribute>
Expand Down
4 changes: 2 additions & 2 deletions xslt_src/jcgm.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@
<!-- ============================= -->

<!-- element with title -->
<xsl:template match="*[*[local-name()='title']]" mode="contents">
<xsl:template match="*[*[local-name()='title'] or *[local-name()='fmt-title']]" mode="contents">
<xsl:variable name="level">
<xsl:call-template name="getLevel">
<xsl:with-param name="depth" select="*[local-name()='title']/@depth"/>
<xsl:with-param name="depth" select="*[local-name()='fmt-title']/@depth | *[local-name()='title']/@depth"/>
</xsl:call-template>
</xsl:variable>

Expand Down

0 comments on commit dcdb726

Please sign in to comment.