lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.3.11 vs lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.4.0

- old
+ new

@@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:un="https://www.metanorma.org/ns/un" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:barcode="http://barcode4j.krysalis.org/ns" version="1.0"> +<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:un="https://www.metanorma.org/ns/un" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:barcode="http://barcode4j.krysalis.org/ns" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0"> <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/> @@ -60,48 +60,11 @@ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/> </fo:repeatable-page-master-alternatives> </fo:page-sequence-master> </fo:layout-master-set> - <fo:declarations> - <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"> - <pdf:dictionary type="normal" key="ViewerPreferences"> - <pdf:boolean key="DisplayDocTitle">true</pdf:boolean> - </pdf:dictionary> - </pdf:catalog> - <x:xmpmeta xmlns:x="adobe:ns:meta/"> - <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""> - <!-- Dublin Core properties go here --> - <dc:title> - <xsl:choose> - <xsl:when test="$title != ''"> - <xsl:value-of select="$title"/> - </xsl:when> - <xsl:otherwise> - <xsl:text> </xsl:text> - </xsl:otherwise> - </xsl:choose> - </dc:title> - <dc:creator/> - <dc:description> - <xsl:variable name="abstract"> - <xsl:copy-of select="/un:un-standard/un:preface/un:abstract//text()"/> - </xsl:variable> - <xsl:value-of select="normalize-space($abstract)"/> - </dc:description> - <pdf:Keywords> - <xsl:call-template name="insertKeywords"/> - </pdf:Keywords> - </rdf:Description> - <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""> - <!-- XMP properties go here --> - <xmp:CreatorTool/> - </rdf:Description> - </rdf:RDF> - </x:xmpmeta> - </fo:declarations> + <xsl:call-template name="addPDFUAmeta"/> <!-- Cover Page --> <fo:page-sequence master-reference="cover-page" force-page-count="no-force"> <fo:flow flow-name="xsl-region-body"> <fo:block-container border-bottom="0.5pt solid black" margin-bottom="6pt"> @@ -168,11 +131,11 @@ </fo:block> <fo:block font-weight="normal"> <xsl:value-of select="/un:un-standard/un:bibdata/un:ext/un:session/un:date"/> </fo:block> <fo:block font-weight="normal"> - <xsl:text>Item 1 of the </xsl:text><xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:title, $upper, $lower)"/> + <xsl:text>Item 1 of the </xsl:text><xsl:value-of select="java:toLowerCase(java:java.lang.String.new(/un:un-standard/un:sections/un:clause[1]/un:title))"/> </fo:block> <fo:block> <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/> </fo:block> <fo:block><xsl:value-of select="$title"/></fo:block> @@ -299,18 +262,11 @@ <!-- Any node with title element - clause, definition, annex,... --> <xsl:template match="un:title | un:preferred" mode="contents"> <xsl:variable name="id"> - <xsl:choose> - <xsl:when test="../@id"> - <xsl:value-of select="../@id"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="text()"/> - </xsl:otherwise> - </xsl:choose> + <xsl:call-template name="getId"/> </xsl:variable> <xsl:variable name="level"> <xsl:call-template name="getLevel"/> </xsl:variable> @@ -329,11 +285,16 @@ </xsl:variable> <item id="{$id}" level="{$level}" section="{$section}" display="false" type="{$type}"> <xsl:if test="$type = 'clause'"> <xsl:attribute name="section"> - <xsl:text>Clause </xsl:text> + <xsl:variable name="title-clause"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-clause'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-clause"/> <xsl:choose> <xsl:when test="ancestor::un:sections"> <!-- 1, 2, 3, 4, ... from main section (not annex ...) --> <xsl:choose> <xsl:when test="$level = 1"> @@ -353,11 +314,16 @@ </xsl:choose> </xsl:when> <xsl:when test="ancestor::un:annex"> <xsl:choose> <xsl:when test="$level = 1"> - <xsl:text>Annex </xsl:text> + <xsl:variable name="title-annex"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-annex'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-annex"/> <xsl:number format="A" level="any" count="un:annex"/> </xsl:when> <xsl:otherwise> <xsl:variable name="annex_id" select="ancestor::un:annex/@id"/> <xsl:number format="1." count="//un:annex[@id = $annex_id]/un:clause[un:title]"/> @@ -384,11 +350,16 @@ <xsl:template match="un:figure" mode="contents"> <item level="" id="{@id}" type="figure"> <xsl:attribute name="section"> - <xsl:text>Figure </xsl:text> + <xsl:variable name="title-figure"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-figure'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-figure"/> <xsl:choose> <xsl:when test="ancestor::un:annex"> <xsl:choose> <xsl:when test="count(//un:annex) = 1"> <xsl:value-of select="/un:un-standard/un:bibdata/un:ext/un:structuredidentifier/un:annexid"/><xsl:number format="-1" level="any" count="un:annex//un:figure"/> @@ -416,11 +387,16 @@ <xsl:template match="un:table" mode="contents"> <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/> <item level="" id="{@id}" display="false" type="table"> <xsl:attribute name="section"> - <xsl:text>Table </xsl:text> + <xsl:variable name="title-table"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-table'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-table"/> <xsl:choose> <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST --> <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/> </xsl:when> <xsl:when test="ancestor::*[local-name()='annex']"> @@ -439,11 +415,16 @@ <xsl:template match="un:formula" mode="contents"> <item level="" id="{@id}" display="false"> <xsl:attribute name="section"> - <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="un:annex | un:formula"/><xsl:text>)</xsl:text> + <xsl:variable name="title-formula"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-formula'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="un:annex | un:formula"/> </xsl:attribute> </item> </xsl:template> <xsl:template match="un:example" mode="contents"> @@ -468,21 +449,31 @@ <xsl:template match="un:terms" mode="contents"> <item level="" id="{@id}" display="false" type="Terms"> <xsl:if test="ancestor::un:annex"> <xsl:attribute name="section"> - <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/> + <xsl:variable name="title-appendix"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-appendix'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/> </xsl:attribute> </xsl:if> </item> </xsl:template> <xsl:template match="un:references" mode="contents"> <item level="" id="{@id}" display="false" type="References"> <xsl:if test="ancestor::un:annex"> <xsl:attribute name="section"> - <xsl:text>Appendix </xsl:text><xsl:number format="A" count="un:annex"/> + <xsl:variable name="title-appendix"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-appendix'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-appendix"/><xsl:number format="A" count="un:annex"/> </xsl:attribute> </xsl:if> </item> </xsl:template> @@ -490,11 +481,16 @@ <item level="" id="{@id}" display="false" type="Box"> <xsl:attribute name="section"> <xsl:variable name="num"> <xsl:number/> </xsl:variable> - <xsl:text>Box </xsl:text><xsl:value-of select="$num"/> + <xsl:variable name="title-box"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-box'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-box"/><xsl:value-of select="$num"/> </xsl:attribute> </item> </xsl:template> <!-- ============================= --> @@ -512,11 +508,16 @@ <fo:table-column column-width="134mm"/> <fo:table-column column-width="17mm"/> <fo:table-body> <fo:table-row> <fo:table-cell padding-left="6mm" padding-top="2.5mm"> - <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt">Summary</fo:block> + <xsl:variable name="title-summary"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-summary'"/> + </xsl:call-template> + </xsl:variable> + <fo:block font-size="12pt" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-summary"/></fo:block> </fo:table-cell> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell> @@ -659,11 +660,16 @@ </xsl:template> <xsl:template match="un:ul//un:note | un:ol//un:note"/> <xsl:template match="un:ul//un:note/un:p | un:ol//un:note/un:p" mode="process"> <fo:block font-size="11pt" margin-top="4pt"> - <xsl:text>NOTE </xsl:text> + <xsl:variable name="title-note"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-note'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-note"/> <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note"> <xsl:number count="un:note"/><xsl:text> </xsl:text> </xsl:if> <xsl:text>– </xsl:text> <xsl:apply-templates/> @@ -741,16 +747,21 @@ </xsl:choose> </fo:basic-link> </xsl:template> <xsl:template match="un:admonition"> + <xsl:variable name="title-box"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-box'"/> + </xsl:call-template> + </xsl:variable> <fo:block text-align="center" font-style="italic" keep-with-next="always" margin-bottom="6pt"> - <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/> + <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/> </fo:block> <fo:block-container border="0.25pt solid black" margin-left="-3mm" margin-right="-3mm" padding-top="4mm"> <fo:block id="{@id}" font-weight="bold" margin-left="6mm" margin-right="6mm" keep-with-next="always"> - <xsl:text>Box </xsl:text><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/> + <xsl:value-of select="$title-box"/><xsl:number/><xsl:text>: </xsl:text><xsl:apply-templates select="un:name" mode="process"/> </fo:block> <fo:block margin-left="5mm" margin-right="5mm"> <xsl:apply-templates/> </fo:block> </fo:block-container> @@ -813,18 +824,11 @@ </xsl:template> <xsl:template match="un:title"> <xsl:variable name="id"> - <xsl:choose> - <xsl:when test="../@id"> - <xsl:value-of select="../@id"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="text()"/> - </xsl:otherwise> - </xsl:choose> + <xsl:call-template name="getId"/> </xsl:variable> <xsl:variable name="level"> <xsl:call-template name="getLevel"/> </xsl:variable> @@ -931,11 +935,16 @@ <!-- for further use --> <!-- ============================ --> <xsl:template match="un:recommendation"> <fo:block margin-left="20mm"> <fo:block font-weight="bold"> - <xsl:text>Recommendation </xsl:text> + <xsl:variable name="title-recommendation"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-recommendation'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-recommendation"/> <xsl:choose> <xsl:when test="ancestor::un:sections"> <xsl:number level="any" count="un:sections//un:recommendation"/> </xsl:when> <xsl:when test="ancestor::*[local-name()='annex']"> @@ -1001,11 +1010,16 @@ <fo:block> <xsl:apply-templates/> </fo:block> <xsl:if test="un:name"> <fo:block text-align="center" margin-bottom="6pt" keep-with-previous="always"> - <xsl:text>Figure </xsl:text> + <xsl:variable name="title-figure"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-figure'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-figure"/> <xsl:choose> <xsl:when test="ancestor::un:annex"> <xsl:choose> <xsl:when test="count(//un:annex) = 1"> <xsl:value-of select="/un:un-standard/un:bibdata/un:ext/un:structuredidentifier/un:annexid"/><xsl:number format="-1" level="any" count="un:annex//un:figure"/> @@ -1132,27 +1146,37 @@ </xsl:template> <xsl:template match="un:docidentifier"/> <xsl:template match="un:note/un:p | un:annex//un:note/un:p" name="note"> <fo:block font-size="10pt" space-after="12pt" text-indent="0"> - <fo:inline padding-right="4mm"><xsl:text>NOTE </xsl:text> + <xsl:variable name="title-note"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-note'"/> + </xsl:call-template> + </xsl:variable> + <fo:inline padding-right="4mm"><xsl:value-of select="$title-note"/> <xsl:if test="../following-sibling::un:note or ../preceding-sibling::un:note"> <xsl:number count="un:note"/><xsl:text> </xsl:text> </xsl:if> </fo:inline> <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="un:termnote"> <fo:block margin-top="4pt"> - <xsl:text>NOTE </xsl:text> - <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote"> - <xsl:number/><xsl:text> </xsl:text> - </xsl:if> - <xsl:text>– </xsl:text> - <xsl:apply-templates/> + <xsl:variable name="title-note"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-note'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-note"/> + <xsl:if test="following-sibling::un:termnote or preceding-sibling::un:termnote"> + <xsl:number/><xsl:text> </xsl:text> + </xsl:if> + <xsl:text>– </xsl:text> + <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="un:termnote/un:p"> <xsl:apply-templates/> @@ -1176,11 +1200,11 @@ </fo:block> </fo:table-cell> <fo:table-cell> <!-- display-align="center" --> <fo:block text-align="right"> <xsl:if test="not(ancestor::un:annex)"> - <xsl:text>(</xsl:text><xsl:number level="any"/><xsl:text>)</xsl:text> + <xsl:number format="(1)" level="any"/> </xsl:if> <xsl:if test="ancestor::un:annex"> <xsl:variable name="annex-id" select="ancestor::un:annex/@id"/> <xsl:text>(</xsl:text> <xsl:number format="A-" count="un:annex"/> @@ -1200,11 +1224,16 @@ <xsl:template match="un:formula" mode="process"> <xsl:call-template name="formula"/> </xsl:template> <xsl:template match="un:example"> - <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt">EXAMPLE</fo:block> + <xsl:variable name="title-example"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-example'"/> + </xsl:call-template> + </xsl:variable> + <fo:block id="{@id}" font-size="10pt" font-weight="bold" margin-bottom="12pt"><xsl:value-of select="$title-example"/></fo:block> <fo:block font-size="11pt" margin-top="12pt" margin-bottom="12pt" margin-left="15mm"> <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="un:example/un:p"> @@ -1227,22 +1256,32 @@ <xsl:attribute name="vertical-align">super</xsl:attribute> </xsl:if> <xsl:if test="@type = 'inline'"> <xsl:attribute name="text-decoration">underline</xsl:attribute> </xsl:if> - <xsl:text>[</xsl:text><xsl:value-of select="@citeas" disable-output-escaping="yes"/><xsl:text>]</xsl:text> + <xsl:text>[</xsl:text><xsl:value-of select="@citeas"/><xsl:text>]</xsl:text> <!-- disable-output-escaping="yes" --> <xsl:apply-templates select="un:localityStack"/> </fo:basic-link> <!-- </fo:inline> --> </xsl:template> <xsl:template match="un:locality"> + <xsl:variable name="title-section"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-section'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="title-clause"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-clause'"/> + </xsl:call-template> + </xsl:variable> <xsl:choose> - <xsl:when test="@type = 'section'">Section </xsl:when> - <xsl:when test="@type = 'clause'">Clause </xsl:when> + <xsl:when test="@type = 'section'"><xsl:value-of select="$title-section"/></xsl:when> + <xsl:when test="@type = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when> <xsl:otherwise/> </xsl:choose> <xsl:text> </xsl:text><xsl:value-of select="un:referenceFrom"/> </xsl:template> @@ -1257,11 +1296,11 @@ </fo:table-body> </fo:table> </fo:block> </xsl:template> <xsl:template match="un:term" mode="table"> - <fo:table-row> + <fo:table-row id="{@id}"> <fo:table-cell padding-right="1mm"> <fo:block margin-bottom="12pt"> <xsl:apply-templates select="un:preferred"/> </fo:block> </fo:table-cell> @@ -1271,11 +1310,11 @@ </fo:block> </fo:table-cell> </fo:table-row> </xsl:template> <xsl:template match="un:preferred"> - <fo:inline id="{../@id}"> + <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="un:definition/un:p"> <fo:block> @@ -1398,33 +1437,10 @@ <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block> </fo:block-container> </fo:static-content> </xsl:template> - - <xsl:template name="getLevel"> - <xsl:variable name="level_total" select="count(ancestor::*)"/> - <xsl:variable name="level"> - <xsl:choose> - <xsl:when test="ancestor::un:preface"> - <xsl:value-of select="$level_total - 2"/> - </xsl:when> - <xsl:when test="ancestor::un:sections"> - <xsl:value-of select="$level_total - 2"/> - </xsl:when> - <xsl:when test="ancestor::un:bibliography"> - <xsl:value-of select="$level_total - 2"/> - </xsl:when> - <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when> - <xsl:otherwise> - <xsl:value-of select="$level_total - 1"/> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:value-of select="$level"/> - </xsl:template> - <xsl:template name="getSection"> <xsl:variable name="level"> <xsl:call-template name="getLevel"/> </xsl:variable> @@ -1448,16 +1464,21 @@ </xsl:choose> </xsl:when> <xsl:when test="ancestor::un:annex"> <xsl:choose> <xsl:when test="$level = 1"> + <xsl:variable name="title-annex"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-annex'"/> + </xsl:call-template> + </xsl:variable> <xsl:choose> <xsl:when test="local-name() = 'title'"> - <xsl:text>ANNEX </xsl:text> + <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title-annex))"/> <xsl:number format="A" level="any" count="un:annex"/> </xsl:when> - <xsl:otherwise>Annex</xsl:otherwise> + <xsl:otherwise><xsl:value-of select="normalize-space($title-annex)"/></xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:variable name="annex_id" select="ancestor::un:annex/@id"/> <xsl:number format="1." count="//un:annex[@id = $annex_id]/un:clause[un:title]"/> @@ -1554,12 +1575,14 @@ </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> - <xsl:when test="$first = 'true'"> - <xsl:value-of select="translate(substring($value, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($value, 2)"/> + <xsl:when test="$first = 'true'"> + <xsl:call-template name="capitalize"> + <xsl:with-param name="str" select="$value"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$value"/> </xsl:otherwise> </xsl:choose> @@ -1591,12 +1614,12 @@ <xsl:variable name="result" select="normalize-space(concat($day, ' ', $monthStr, ' ', $year))"/> <xsl:value-of select="$result"/> </xsl:template> <xsl:template name="getLanguage"> - <xsl:param name="lang"/> - <xsl:variable name="language" select="translate($lang, $upper, $lower)"/> + <xsl:param name="lang"/> + <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/> <xsl:choose> <xsl:when test="$language = 'en'">English</xsl:when> <xsl:when test="$language = 'de'">Deutsch</xsl:when> <xsl:when test="$language = 'cn'">Chinese</xsl:when> <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise> @@ -2459,80 +2482,219 @@ 8nXeWcqW3QOHeLyryF/Q4L3BoEhzW+fOO0A12vewbTZxj6/yWeCqz4J31WY1ny3/F6UYkeY6 8LIzhtsxa8myZailU1K6HlxN/x9kjcPp+HcBBgAS2JZd+kqHSQAAAABJRU5ErkJggg== </xsl:text> </xsl:variable> -<xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-table"> +<xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_"> - <xsl:text>Table </xsl:text> + <title-table lang="en">Table </title-table> + <title-table lang="fr">Tableau </title-table> + + <title-table lang="zh">Table </title-table> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note"> + + <title-note lang="en">NOTE </title-note> + <title-note lang="fr">NOTE </title-note> - <xsl:text>NOTE </xsl:text> + <title-note lang="zh">NOTE </title-note> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure"> - <xsl:text>Figure </xsl:text> + <title-figure lang="en">Figure </title-figure> + <title-figure lang="fr">Figure </title-figure> + <title-figure lang="zh">Figure </title-figure> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example"> - <xsl:text>EXAMPLE </xsl:text> + <title-example lang="en">EXAMPLE </title-example> + <title-example lang="fr">EXEMPLE </title-example> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-inequality">Inequality </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-equation">Equation </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-annex"> + <title-example lang="zh">EXAMPLE </title-example> - <xsl:text>Annex </xsl:text> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix"> - <xsl:text>Appendix </xsl:text> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause"> + <title-example-xref lang="en">Example </title-example-xref> + <title-example-xref lang="fr">Exemple </title-example-xref> + + <title-section lang="en">Section </title-section> + <title-section lang="fr">Section </title-section> - <xsl:text>Clause </xsl:text> + <title-inequality lang="en">Inequality </title-inequality> + <title-inequality lang="fr">Inequality </title-inequality> + <title-equation lang="en">Equation </title-equation> + <title-equation lang="fr">Equation </title-equation> + + <title-annex lang="en">Annex </title-annex> + <title-annex lang="fr">Annexe </title-annex> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition"> - <xsl:text>Edition </xsl:text> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc"> + <title-annex lang="zh">Annex </title-annex> - </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-page">Page</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-key">Key</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-where">where</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-descriptors">Descriptors</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-en">Part </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-fr">Partie </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-modified">modified</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-source">SOURCE</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-keywords">Keywords</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="link-style"> + <title-appendix lang="en">Appendix </title-appendix> + <title-appendix lang="fr">Appendix </title-appendix> + + <title-clause lang="en">Clause </title-clause> + <title-clause lang="fr">Article </title-clause> - </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style"> + <title-clause lang="zh">Clause </title-clause> + <title-edition lang="en"> + + <xsl:text>Edition </xsl:text> + + + </title-edition> + <title-formula lang="en">Formula </title-formula> + <title-formula lang="fr">Formula </title-formula> + <title-toc lang="en"> + + + + </title-toc> + <title-toc lang="fr">Sommaire</title-toc> + + <title-toc lang="zh">Contents</title-toc> + + + + <title-page lang="en">Page</title-page> + <title-page lang="fr">Page</title-page> + + <title-key lang="en">Key</title-key> + <title-key lang="fr">Légende</title-key> + + <title-where lang="en">where</title-where> + <title-where lang="fr">où</title-where> + + <title-descriptors lang="en">Descriptors</title-descriptors> + + <title-part lang="en"> + + + </title-part> + <title-part lang="fr"> + + + </title-part> + <title-part lang="zh">第 # 部分:</title-part> + + <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry> + <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry> + + <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry> + + + + <title-modified lang="en">modified</title-modified> + <title-modified lang="fr">modifiée</title-modified> + + <title-modified lang="zh">modified</title-modified> + + + + <title-source lang="en">SOURCE</title-source> + + <title-keywords lang="en">Keywords</title-keywords> + + <title-deprecated lang="en">DEPRECATED</title-deprecated> + <title-deprecated lang="fr">DEPRECATED</title-deprecated> + + <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations> + + <title-list-tables lang="en">List of Tables</title-list-tables> + + <title-list-figures lang="en">List of Figures</title-list-figures> + + <title-recommendation lang="en">Recommendation </title-recommendation> + + <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements> + + <title-abstract lang="en">Abstract</title-abstract> + + <title-summary lang="en">Summary</title-summary> + + <title-in lang="en">in </title-in> + + <title-box lang="en">Box </title-box> + + <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes> + <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes> + + <title-completion-date lang="en">Completion date for this manuscript</title-completion-date> + <title-completion-date lang="zh">本稿完成日期</title-completion-date> + + <title-issuance-date lang="en">Issuance Date: #</title-issuance-date> + <title-issuance-date lang="zh"># 发布</title-issuance-date> + + <title-implementation-date lang="en">Implementation Date: #</title-implementation-date> + <title-implementation-date lang="zh"># 实施</title-implementation-date> + + <title-obligation-normative lang="en">normative</title-obligation-normative> + <title-obligation-normative lang="zh">规范性附录</title-obligation-normative> + + <title-caution lang="en">CAUTION</title-caution> + <title-caution lang="zh">注意</title-caution> + + <title-warning lang="en">WARNING</title-warning> + <title-warning lang="zh">警告</title-warning> + + <title-amendment lang="en">AMENDMENT</title-amendment> + </xsl:variable><xsl:template name="getTitle"> + <xsl:param name="name"/> + <xsl:variable name="lang"> + <xsl:call-template name="getLang"/> + </xsl:variable> + <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/> + <xsl:choose> + <xsl:when test="normalize-space($title_) != ''"> + <xsl:value-of select="$title_"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style"> + + + </xsl:attribute-set><xsl:attribute-set name="sourcecode-style"> + + + + + <xsl:attribute name="font-family">Courier</xsl:attribute> <xsl:attribute name="font-size">10pt</xsl:attribute> <xsl:attribute name="margin-top">6pt</xsl:attribute> <xsl:attribute name="margin-bottom">6pt</xsl:attribute> - </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style"> + </xsl:attribute-set><xsl:attribute-set name="appendix-style"> - </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style"> + </xsl:attribute-set><xsl:attribute-set name="appendix-example-style"> - </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()"> + </xsl:attribute-set><xsl:template match="text()"> <xsl:value-of select="."/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']"> + </xsl:template><xsl:template match="*[local-name()='br']"> <xsl:value-of select="$linebreak"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1"> + </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1"> <!-- <xsl:call-template name="add-zero-spaces"/> --> <xsl:call-template name="add-zero-spaces-java"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']"> + </xsl:template><xsl:template match="*[local-name()='table']"> <xsl:variable name="simple-table"> <!-- <xsl:copy> --> <xsl:call-template name="getSimpleTable"/> <!-- </xsl:copy> --> @@ -2566,11 +2728,15 @@ <xsl:attribute name="text-align">left</xsl:attribute> - + <xsl:variable name="title-table"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-table'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-table"/> <xsl:call-template name="getTableNumber"/> @@ -2667,17 +2833,26 @@ <xsl:otherwise> <fo:table-column column-width="proportional-column-width({.})"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> - <xsl:apply-templates/> + + <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/> + </xsl:otherwise> + </xsl:choose> + </fo:table> </fo:block-container> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber"> + </xsl:template><xsl:template name="getTableNumber"> <xsl:choose> <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST --> <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/> </xsl:when> <xsl:when test="ancestor::*[local-name()='annex']"> @@ -2700,19 +2875,19 @@ <xsl:number format="A." count="*[local-name()='annex']"/> <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process"> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers"> + </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])"/> <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths"> + </xsl:template><xsl:template name="calculate-column-widths"> <xsl:param name="table"/> <xsl:param name="cols-count"/> <xsl:param name="curr-col" select="1"/> <xsl:param name="width" select="0"/> @@ -2806,27 +2981,31 @@ <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="curr-col" select="$curr-col +1"/> <xsl:with-param name="table" select="$table"/> </xsl:call-template> </xsl:if> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text"> + </xsl:template><xsl:template match="text()" mode="td_text"> <xsl:variable name="zero-space">​</xsl:variable> <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text"> + </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text"> <xsl:value-of select="*[local-name()='origin']/@citeas"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text"> + </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text"> <xsl:value-of select="@target"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table2']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process"> <xsl:param name="cols-count"/> <!-- font-weight="bold" --> <fo:table-header> <xsl:apply-templates/> </fo:table-header> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody"> + <fo:table-body> + <xsl:apply-templates/> + </fo:table-body> + </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process"> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter"> + </xsl:template><xsl:template name="insertTableFooter"> <xsl:param name="cols-count"/> <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/> <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'"> <fo:table-footer> @@ -2862,11 +3041,11 @@ </xsl:if> </fo:table-footer> </xsl:if> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']"> + </xsl:template><xsl:template match="*[local-name()='tbody']"> <xsl:variable name="cols-count"> <xsl:choose> <xsl:when test="../*[local-name()='thead']"> <xsl:call-template name="calculate-columns-numbers"> @@ -2893,11 +3072,11 @@ <xsl:apply-templates/> <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> --> </fo:table-body> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']"> + </xsl:template><xsl:template match="*[local-name()='tr']"> <xsl:variable name="parent-name" select="local-name(..)"/> <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> --> <fo:table-row min-height="4mm"> <xsl:if test="$parent-name = 'thead'"> <xsl:attribute name="font-weight">bold</xsl:attribute> @@ -2917,11 +3096,11 @@ <xsl:attribute name="min-height">8mm</xsl:attribute> </xsl:if> <xsl:apply-templates/> </fo:table-row> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']"> + </xsl:template><xsl:template match="*[local-name()='th']"> <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center"> @@ -2949,11 +3128,11 @@ </xsl:if> <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']"> + </xsl:template><xsl:template match="*[local-name()='td']"> <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm"> @@ -2994,34 +3173,39 @@ </xsl:otherwise> </xsl:choose> --> </fo:table-cell> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process"> <fo:block font-size="10pt" margin-bottom="12pt"> <fo:inline padding-right="2mm"> + <xsl:variable name="title-note"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-note'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-note"/> <xsl:number format="1 "/> </fo:inline> <xsl:apply-templates mode="process"/> </fo:block> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process"> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display"> + </xsl:template><xsl:template name="fn_display"> <xsl:variable name="references"> <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']"> <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}"> @@ -3054,11 +3238,11 @@ <xsl:apply-templates/> </fo:inline> </fo:block> </xsl:if> </xsl:for-each> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display"> + </xsl:template><xsl:template name="fn_name_display"> <!-- <xsl:variable name="references"> <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']"> <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}"> <xsl:apply-templates /> </fn> @@ -3070,30 +3254,71 @@ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block> <fo:block margin-bottom="12pt"> <xsl:apply-templates/> </fo:block> </xsl:for-each> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure"> + </xsl:template><xsl:template name="fn_display_figure"> <xsl:variable name="key_iso"> <!-- and (not(@class) or @class !='pseudocode') --> </xsl:variable> <xsl:variable name="references"> <xsl:for-each select=".//*[local-name()='fn']"> <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}"> <xsl:apply-templates/> </fn> </xsl:for-each> </xsl:variable> + + <!-- current hierarchy is 'figure' element --> + <xsl:variable name="following_dl_colwidths"> + <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' --> + <xsl:variable name="html-table"> + <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> + <xsl:element name="{$ns}:table"> + <xsl:for-each select="*[local-name() = 'dl'][1]"> + <tbody> + <xsl:apply-templates mode="dl"/> + </tbody> + </xsl:for-each> + </xsl:element> + </xsl:variable> + + <xsl:call-template name="calculate-column-widths"> + <xsl:with-param name="cols-count" select="2"/> + <xsl:with-param name="table" select="$html-table"/> + </xsl:call-template> + + </xsl:if> + </xsl:variable> + + + <xsl:variable name="maxlength_dt"> + <xsl:for-each select="*[local-name() = 'dl'][1]"> + <xsl:call-template name="getMaxLength_dt"/> + </xsl:for-each> + </xsl:variable> + <xsl:if test="xalan:nodeset($references)//fn"> <fo:block> <fo:table width="95%" table-layout="fixed"> <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="font-size">10pt</xsl:attribute> </xsl:if> - <fo:table-column column-width="15%"/> - <fo:table-column column-width="85%"/> + <xsl:choose> + <!-- if there 'dl', then set same columns width --> + <xsl:when test="xalan:nodeset($following_dl_colwidths)//column"> + <xsl:call-template name="setColumnWidth_dl"> + <xsl:with-param name="colwidths" select="$following_dl_colwidths"/> + <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:table-column column-width="15%"/> + <fo:table-column column-width="85%"/> + </xsl:otherwise> + </xsl:choose> <fo:table-body> <xsl:for-each select="xalan:nodeset($references)//fn"> <xsl:variable name="reference" select="@reference"/> <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note--> <fo:table-row> @@ -3121,11 +3346,11 @@ </fo:table-body> </fo:table> </fo:block> </xsl:if> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']"> + </xsl:template><xsl:template match="*[local-name()='fn']"> <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> --> <fo:inline font-size="80%" keep-with-previous.within-line="always"> @@ -3133,15 +3358,15 @@ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id--> <xsl:value-of select="@reference"/> </fo:basic-link> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']"> + </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']"> <fo:inline> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']"> + </xsl:template><xsl:template match="*[local-name()='dl']"> <xsl:variable name="parent" select="local-name(..)"/> <xsl:variable name="key_iso"> <!-- and (not(../@class) or ../@class !='pseudocode') --> </xsl:variable> @@ -3150,10 +3375,15 @@ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component --> <fo:block margin-bottom="12pt" text-align="left"> + <xsl:variable name="title-where"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-where'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-where"/><xsl:text> </xsl:text> <xsl:apply-templates select="*[local-name()='dt']/*"/> <xsl:text/> <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/> </fo:block> @@ -3163,18 +3393,28 @@ <fo:block margin-bottom="12pt" text-align="left"> + <xsl:variable name="title-where"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-where'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-where"/> </fo:block> </xsl:when> <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> - <fo:block font-weight="bold" text-align="left" margin-bottom="12pt"> + <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always"> + <xsl:variable name="title-key"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-key'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-key"/> </fo:block> </xsl:when> </xsl:choose> @@ -3187,27 +3427,10 @@ <fo:block> - <!-- create virtual html table for dl/[dt and dd] --> - <xsl:variable name="html-table"> - <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> - <xsl:element name="{$ns}:table"> - <tbody> - <xsl:apply-templates mode="dl"/> - </tbody> - </xsl:element> - </xsl:variable> - <!-- html-table<xsl:copy-of select="$html-table"/> --> - <xsl:variable name="colwidths"> - <xsl:call-template name="calculate-column-widths"> - <xsl:with-param name="cols-count" select="2"/> - <xsl:with-param name="table" select="$html-table"/> - </xsl:call-template> - </xsl:variable> - <!-- colwidths=<xsl:value-of select="$colwidths"/> --> <fo:table width="95%" table-layout="fixed"> <xsl:choose> <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"> @@ -3216,56 +3439,98 @@ <xsl:when test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="font-size">10pt</xsl:attribute> </xsl:when> </xsl:choose> - <xsl:choose> - <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table --> - <fo:table-column column-width="50%"/> - <fo:table-column column-width="50%"/> - </xsl:when> - <xsl:otherwise> - <xsl:choose> - <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7"> - <fo:table-column column-width="60%"/> - <fo:table-column column-width="40%"/> - </xsl:when> --> - <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3"> - <fo:table-column column-width="50%"/> - <fo:table-column column-width="50%"/> - </xsl:when> - <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5"> - <fo:table-column column-width="40%"/> - <fo:table-column column-width="60%"/> - </xsl:when> - <xsl:otherwise> - <xsl:for-each select="xalan:nodeset($colwidths)//column"> - <xsl:choose> - <xsl:when test=". = 1 or . = 0"> - <fo:table-column column-width="proportional-column-width(2)"/> - </xsl:when> - <xsl:otherwise> - <fo:table-column column-width="proportional-column-width({.})"/> - </xsl:otherwise> - </xsl:choose> - </xsl:for-each> - </xsl:otherwise> - </xsl:choose> - <!-- <fo:table-column column-width="15%"/> - <fo:table-column column-width="85%"/> --> - </xsl:otherwise> - </xsl:choose> + <!-- create virtual html table for dl/[dt and dd] --> + <xsl:variable name="html-table"> + <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> + <xsl:element name="{$ns}:table"> + <tbody> + <xsl:apply-templates mode="dl"/> + </tbody> + </xsl:element> + </xsl:variable> + <!-- html-table<xsl:copy-of select="$html-table"/> --> + <xsl:variable name="colwidths"> + <xsl:call-template name="calculate-column-widths"> + <xsl:with-param name="cols-count" select="2"/> + <xsl:with-param name="table" select="$html-table"/> + </xsl:call-template> + </xsl:variable> + <!-- colwidths=<xsl:value-of select="$colwidths"/> --> + <xsl:variable name="maxlength_dt"> + <xsl:call-template name="getMaxLength_dt"/> + </xsl:variable> + <xsl:call-template name="setColumnWidth_dl"> + <xsl:with-param name="colwidths" select="$colwidths"/> + <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/> + </xsl:call-template> <fo:table-body> <xsl:apply-templates> <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/> </xsl:apply-templates> </fo:table-body> </fo:table> </fo:block> </fo:block> </xsl:if> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']"> + </xsl:template><xsl:template name="setColumnWidth_dl"> + <xsl:param name="colwidths"/> + <xsl:param name="maxlength_dt"/> + <xsl:choose> + <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table --> + <fo:table-column column-width="50%"/> + <fo:table-column column-width="50%"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc --> + <fo:table-column column-width="5%"/> + <fo:table-column column-width="95%"/> + </xsl:when> + <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc --> + <fo:table-column column-width="10%"/> + <fo:table-column column-width="90%"/> + </xsl:when> + <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7"> + <fo:table-column column-width="60%"/> + <fo:table-column column-width="40%"/> + </xsl:when> --> + <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3"> + <fo:table-column column-width="50%"/> + <fo:table-column column-width="50%"/> + </xsl:when> + <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5"> + <fo:table-column column-width="40%"/> + <fo:table-column column-width="60%"/> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="xalan:nodeset($colwidths)//column"> + <xsl:choose> + <xsl:when test=". = 1 or . = 0"> + <fo:table-column column-width="proportional-column-width(2)"/> + </xsl:when> + <xsl:otherwise> + <fo:table-column column-width="proportional-column-width({.})"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + <!-- <fo:table-column column-width="15%"/> + <fo:table-column column-width="85%"/> --> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:template name="getMaxLength_dt"> + <xsl:for-each select="*[local-name()='dt']"> + <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/> + <xsl:if test="position() = 1"> + <xsl:value-of select="string-length(normalize-space(.))"/> + </xsl:if> + </xsl:for-each> + </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']"> <xsl:param name="key_iso"/> <!-- <tr> <td>NOTE</td> <td> @@ -3277,20 +3542,25 @@ <fo:table-cell> <fo:block margin-top="6pt"> <xsl:if test="normalize-space($key_iso) = 'true'"> <xsl:attribute name="margin-top">0</xsl:attribute> </xsl:if> + <xsl:variable name="title-note"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-note'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-note"/> </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> <xsl:apply-templates/> </fo:block> </fo:table-cell> </fo:table-row> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl"> + </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl"> <tr> <td> <xsl:apply-templates/> </td> <td> @@ -3299,11 +3569,11 @@ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/> </td> </tr> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']"> + </xsl:template><xsl:template match="*[local-name()='dt']"> <xsl:param name="key_iso"/> <fo:table-row> <fo:table-cell> @@ -3318,11 +3588,15 @@ <xsl:apply-templates/> - + <!-- <xsl:if test="$namespace = 'gb'"> + <xsl:if test="ancestor::*[local-name()='formula']"> + <xsl:text>—</xsl:text> + </xsl:if> + </xsl:if> --> </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> @@ -3332,53 +3606,54 @@ </fo:block> </fo:table-cell> </fo:table-row> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl_process"> + </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process"> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process"> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline"> + </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline"> <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']"> + </xsl:template><xsl:template match="*[local-name()='em']"> <fo:inline font-style="italic"> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']"> + </xsl:template><xsl:template match="*[local-name()='strong']"> <fo:inline font-weight="bold"> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']"> + </xsl:template><xsl:template match="*[local-name()='sup']"> <fo:inline font-size="80%" vertical-align="super"> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']"> + </xsl:template><xsl:template match="*[local-name()='sub']"> <fo:inline font-size="80%" vertical-align="sub"> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']"> + </xsl:template><xsl:template match="*[local-name()='tt']"> <fo:inline font-family="Courier" font-size="10pt"> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']"> + </xsl:template><xsl:template match="*[local-name()='del']"> <fo:inline font-size="10pt" color="red" text-decoration="line-through"> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]"> + </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]"> <xsl:variable name="text" select="normalize-space(.)"/> <fo:inline font-size="75%"> <xsl:if test="string-length($text) &gt; 0"> <xsl:call-template name="recursiveSmallCaps"> <xsl:with-param name="text" select="$text"/> </xsl:call-template> </xsl:if> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps"> + </xsl:template><xsl:template name="recursiveSmallCaps"> <xsl:param name="text"/> <xsl:variable name="char" select="substring($text,1,1)"/> - <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> + <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> --> + <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/> <xsl:choose> <xsl:when test="$char=$upperCase"> <fo:inline font-size="{100 div 0.75}%"> <xsl:value-of select="$upperCase"/> </fo:inline> @@ -3390,11 +3665,11 @@ <xsl:if test="string-length($text) &gt; 1"> <xsl:call-template name="recursiveSmallCaps"> <xsl:with-param name="text" select="substring($text,2)"/> </xsl:call-template> </xsl:if> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize"> + </xsl:template><xsl:template name="tokenize"> <xsl:param name="text"/> <xsl:param name="separator" select="' '"/> <xsl:choose> <xsl:when test="not(contains($text, $separator))"> <word> @@ -3438,23 +3713,23 @@ <xsl:call-template name="tokenize"> <xsl:with-param name="text" select="substring-after($text, $separator)"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length"> + </xsl:template><xsl:template name="max_length"> <xsl:param name="words"/> <xsl:for-each select="$words//word"> <xsl:sort select="." data-type="number" order="descending"/> <xsl:if test="position()=1"> <xsl:value-of select="."/> </xsl:if> </xsl:for-each> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java"> + </xsl:template><xsl:template name="add-zero-spaces-java"> <xsl:param name="text" select="."/> <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space --> <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces"> + </xsl:template><xsl:template name="add-zero-spaces"> <xsl:param name="text" select="."/> <xsl:variable name="zero-space-after-chars">-</xsl:variable> <xsl:variable name="zero-space-after-dot">.</xsl:variable> <xsl:variable name="zero-space-after-colon">:</xsl:variable> <xsl:variable name="zero-space-after-equal">=</xsl:variable> @@ -3503,11 +3778,11 @@ </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal"> + </xsl:template><xsl:template name="add-zero-spaces-equal"> <xsl:param name="text" select="."/> <xsl:variable name="zero-space-after-equals">==========</xsl:variable> <xsl:variable name="zero-space-after-equal">=</xsl:variable> <xsl:variable name="zero-space">​</xsl:variable> <xsl:choose> @@ -3529,11 +3804,11 @@ </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable"> + </xsl:template><xsl:template name="getSimpleTable"> <xsl:variable name="simple-table"> <!-- Step 1. colspan processing --> <xsl:variable name="simple-table-colspan"> <tbody> @@ -3556,13 +3831,13 @@ <xsl:copy-of select="current()"/> </xsl:otherwise> </xsl:choose> --> </xsl:variable> <xsl:copy-of select="$simple-table"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan"> + </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan"> <xsl:apply-templates mode="simple-table-colspan"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan"> + </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan"> <xsl:choose> <xsl:when test="@colspan"> <xsl:variable name="td"> <xsl:element name="td"> <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute> @@ -3580,42 +3855,42 @@ <xsl:apply-templates select="@*" mode="simple-table-colspan"/> <xsl:apply-templates mode="simple-table-colspan"/> </xsl:element> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']" mode="simple-table-colspan"> + </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan"> <xsl:element name="tr"> <xsl:apply-templates select="@*" mode="simple-table-colspan"/> <xsl:apply-templates mode="simple-table-colspan"/> </xsl:element> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan"> + </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/> </xsl:copy> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode"> + </xsl:template><xsl:template name="repeatNode"> <xsl:param name="count"/> <xsl:param name="node"/> <xsl:if test="$count &gt; 0"> <xsl:call-template name="repeatNode"> <xsl:with-param name="count" select="$count - 1"/> <xsl:with-param name="node" select="$node"/> </xsl:call-template> <xsl:copy-of select="$node"/> </xsl:if> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan"> + </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/> </xsl:copy> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan"> + </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan"> <xsl:copy> <xsl:copy-of select="tr[1]"/> <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan"> <xsl:with-param name="previousRow" select="tr[1]"/> </xsl:apply-templates> </xsl:copy> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan"> + </xsl:template><xsl:template match="tr" mode="simple-table-rowspan"> <xsl:param name="previousRow"/> <xsl:variable name="currentRow" select="."/> <xsl:variable name="normalizedTDs"> <xsl:for-each select="xalan:nodeset($previousRow)//td"> @@ -3645,47 +3920,57 @@ <xsl:copy-of select="$newRow"/> <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan"> <xsl:with-param name="previousRow" select="$newRow"/> </xsl:apply-templates> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang"> + </xsl:template><xsl:template name="getLang"> <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> <xsl:choose> <xsl:when test="$language = 'English'">en</xsl:when> <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords"> + </xsl:template><xsl:template name="capitalizeWords"> <xsl:param name="str"/> <xsl:variable name="str2" select="translate($str, '-', ' ')"/> <xsl:choose> <xsl:when test="contains($str2, ' ')"> <xsl:variable name="substr" select="substring-before($str2, ' ')"/> - <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/> - <xsl:value-of select="substring($substr, 2)"/> + <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/> + <xsl:value-of select="substring($substr, 2)"/> --> + <xsl:call-template name="capitalize"> + <xsl:with-param name="str" select="$substr"/> + </xsl:call-template> <xsl:text> </xsl:text> <xsl:call-template name="capitalizeWords"> <xsl:with-param name="str" select="substring-after($str2, ' ')"/> </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/> - <xsl:value-of select="substring($str2, 2)"/> + <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/> + <xsl:value-of select="substring($str2, 2)"/> --> + <xsl:call-template name="capitalize"> + <xsl:with-param name="str" select="$str2"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math"> + </xsl:template><xsl:template name="capitalize"> + <xsl:param name="str"/> + <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/> + <xsl:value-of select="substring($str, 2)"/> + </xsl:template><xsl:template match="mathml:math"> <fo:inline font-family="STIX2Math"> <fo:instream-foreign-object fox:alt-text="Math"> <xsl:copy-of select="."/> </fo:instream-foreign-object> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']"> + </xsl:template><xsl:template match="*[local-name()='localityStack']"> <xsl:for-each select="*[local-name()='locality']"> <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if> <xsl:apply-templates select="."/> <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if> </xsl:for-each> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link"> + </xsl:template><xsl:template match="*[local-name()='link']" name="link"> <xsl:variable name="target"> <xsl:choose> <xsl:when test="starts-with(normalize-space(@target), 'mailto:')"> <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/> </xsl:when> @@ -3711,65 +3996,86 @@ </xsl:choose> </fo:basic-link> </xsl:otherwise> </xsl:choose> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode"> + </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode"> <fo:block xsl:use-attribute-sets="sourcecode-style"> <!-- <xsl:choose> <xsl:when test="@lang = 'en'"></xsl:when> <xsl:otherwise> --> <xsl:attribute name="white-space">pre</xsl:attribute> <xsl:attribute name="wrap-option">wrap</xsl:attribute> <!-- </xsl:otherwise> </xsl:choose> --> <xsl:apply-templates/> </fo:block> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']"> + </xsl:template><xsl:template match="*[local-name()='bookmark']"> <fo:inline id="{@id}"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']"> + </xsl:template><xsl:template match="*[local-name()='appendix']"> <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style"> + <xsl:variable name="title-appendix"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-appendix'"/> + </xsl:call-template> + </xsl:variable> <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline> <xsl:apply-templates select="*[local-name()='title']" mode="process"/> </fo:block> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process"> <fo:inline><xsl:apply-templates/></fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']"> + </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']"> <fo:block xsl:use-attribute-sets="appendix-example-style"> <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/> + <xsl:variable name="title-example"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-example'"/> + </xsl:call-template> + </xsl:variable> <xsl:value-of select="$title-example"/> <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1"> <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text> </xsl:if> <xsl:if test="*[local-name()='name']"> <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/> </xsl:if> </fo:block> <xsl:apply-templates/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process"> <fo:inline><xsl:apply-templates/></fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']"> + </xsl:template><xsl:template match="*[local-name() = 'callout']"> <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']"> + </xsl:template><xsl:template match="*[local-name() = 'annotation']"> <xsl:variable name="annotation-id" select="@id"/> <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/> <fo:block id="{$annotation-id}" white-space="nowrap"> <fo:inline> <xsl:apply-templates> <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/> </xsl:apply-templates> </fo:inline> </fo:block> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']"> + </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']"> <xsl:param name="callout"/> <fo:inline id="{@id}"> <!-- for first p in annotation, put <x> --> <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if> <xsl:apply-templates/> </fo:inline> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate"> + </xsl:template><xsl:template match="*[local-name() = 'modification']"> + <xsl:variable name="title-modified"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-modified'"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise> + </xsl:choose> + <xsl:apply-templates/> + </xsl:template><xsl:template name="convertDate"> <xsl:param name="date"/> <xsl:param name="format" select="'short'"/> <xsl:variable name="year" select="substring($date, 1, 4)"/> <xsl:variable name="month" select="substring($date, 6, 2)"/> <xsl:variable name="day" select="substring($date, 9, 2)"/> @@ -3798,11 +4104,11 @@ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="$result"/> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords"> + </xsl:template><xsl:template name="insertKeywords"> <xsl:param name="sorting" select="'true'"/> <xsl:param name="charAtEnd" select="'.'"/> <xsl:param name="charDelim" select="', '"/> <xsl:choose> <xsl:when test="$sorting = 'true' or $sorting = 'yes'"> @@ -3821,14 +4127,115 @@ <xsl:with-param name="charDelim" select="$charDelim"/> </xsl:call-template> </xsl:for-each> </xsl:otherwise> </xsl:choose> - </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword"> + </xsl:template><xsl:template name="insertKeyword"> <xsl:param name="charAtEnd"/> <xsl:param name="charDelim"/> <xsl:apply-templates/> <xsl:choose> <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when> <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise> </xsl:choose> + </xsl:template><xsl:template name="addPDFUAmeta"> + <fo:declarations> + <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"> + <pdf:dictionary type="normal" key="ViewerPreferences"> + <pdf:boolean key="DisplayDocTitle">true</pdf:boolean> + </pdf:dictionary> + </pdf:catalog> + <x:xmpmeta xmlns:x="adobe:ns:meta/"> + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""> + <!-- Dublin Core properties go here --> + <dc:title> + <xsl:variable name="title"> + + <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/> + + + + + </xsl:variable> + <xsl:choose> + <xsl:when test="normalize-space($title) != ''"> + <xsl:value-of select="$title"/> + </xsl:when> + <xsl:otherwise> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + </dc:title> + <dc:creator> + + + </dc:creator> + <dc:description> + <xsl:variable name="abstract"> + + + + <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/> + + + </xsl:variable> + <xsl:value-of select="normalize-space($abstract)"/> + </dc:description> + <pdf:Keywords> + <xsl:call-template name="insertKeywords"/> + </pdf:Keywords> + </rdf:Description> + <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""> + <!-- XMP properties go here --> + <xmp:CreatorTool/> + </rdf:Description> + </rdf:RDF> + </x:xmpmeta> + </fo:declarations> + </xsl:template><xsl:template name="getId"> + <xsl:choose> + <xsl:when test="../@id"> + <xsl:value-of select="../@id"/> + </xsl:when> + <xsl:otherwise> + <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> --> + <xsl:value-of select="concat(generate-id(..), '_', text())"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:template name="getLevel"> + <xsl:variable name="level_total" select="count(ancestor::*)"/> + <xsl:variable name="level"> + <xsl:choose> + <xsl:when test="ancestor::*[local-name() = 'preface']"> + <xsl:value-of select="$level_total - 2"/> + </xsl:when> + <xsl:when test="ancestor::*[local-name() = 'sections']"> + <xsl:value-of select="$level_total - 2"/> + </xsl:when> + <xsl:when test="ancestor::*[local-name() = 'bibliography']"> + <xsl:value-of select="$level_total - 2"/> + </xsl:when> + <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$level_total - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$level"/> + </xsl:template><xsl:template name="getSubSection"> + <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/> + </xsl:template><xsl:template name="split"> + <xsl:param name="pText" select="."/> + <xsl:param name="sep" select="','"/> + <xsl:if test="string-length($pText) &gt;0"> + <item> + <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/> + </item> + <xsl:call-template name="split"> + <xsl:with-param name="pText" select="substring-after($pText, $sep)"/> + <xsl:with-param name="sep" select="$sep"/> + </xsl:call-template> + </xsl:if> + </xsl:template><xsl:template name="getDocumentId"> + <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/> </xsl:template></xsl:stylesheet> \ No newline at end of file