lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.0.1 vs lib/isodoc/ogc/ogc.best-practice.xsl in metanorma-ogc-2.0.2

- old
+ new

@@ -7,12 +7,10 @@ <xsl:variable name="images" select="document($svg_images)"/> <xsl:param name="basepath"/> <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/> - <xsl:variable name="pageWidth" select="215.9"/> - <xsl:variable name="pageHeight" select="279.4"/> <xsl:variable name="marginLeftRight1" select="35"/> <xsl:variable name="marginLeftRight2" select="17"/> <xsl:variable name="marginTop" select="16.5"/> <xsl:variable name="marginBottom" select="22.5"/> @@ -321,16 +319,39 @@ </fo:block> <fo:block> <fo:inline font-weight="bold">Publication Date: </fo:inline> <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'published']/ogc:on"/> </fo:block> - <fo:block margin-bottom="12pt"> - <fo:inline font-weight="bold">Editor: </fo:inline> - <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename"> - <xsl:value-of select="."/> - <xsl:if test="position() != last()">, </xsl:if> - </xsl:for-each> + + <fo:block margin-bottom="12pt"> + <xsl:if test="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:person/ogc:name/ogc:completename"> + <fo:block> + <fo:inline font-weight="bold">Author: </fo:inline> + <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:person/ogc:name/ogc:completename"> + <xsl:value-of select="."/> + <xsl:if test="position() != last()">, </xsl:if> + </xsl:for-each> + </fo:block> + </xsl:if> + <xsl:if test="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename"> + <fo:block> + <fo:inline font-weight="bold">Editor: </fo:inline> + <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename"> + <xsl:value-of select="."/> + <xsl:if test="position() != last()">, </xsl:if> + </xsl:for-each> + </fo:block> + </xsl:if> + <xsl:if test="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='contributor']/ogc:person/ogc:name/ogc:completename"> + <fo:block> + <fo:inline font-weight="bold">Contributor: </fo:inline> + <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='contributor']/ogc:person/ogc:name/ogc:completename"> + <xsl:value-of select="."/> + <xsl:if test="position() != last()">, </xsl:if> + </xsl:for-each> + </fo:block> + </xsl:if> </fo:block> </fo:block> <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement"/> @@ -839,50 +860,15 @@ <fo:inline font-weight="bold"><xsl:value-of select="$title-edition"/><xsl:text>: </xsl:text></fo:inline> <xsl:value-of select="."/><xsl:text/> </fo:block> </xsl:template> - <xsl:template match="ogc:license-statement | ogc:feedback-statement | ogc:copyright-statement"> - <fo:block font-size="8pt" line-height="125%"> - <xsl:apply-templates/> - </fo:block> - </xsl:template> - - <xsl:template match="ogc:license-statement//ogc:title"> + <xsl:template match="ogc:legal-statement//ogc:title" priority="2"> <xsl:variable name="level"> <xsl:call-template name="getLevel"/> </xsl:variable> - <fo:block font-weight="bold" color="{$color_blue}" role="H{$level}"> - <xsl:apply-templates/> - </fo:block> - </xsl:template> - - <xsl:template match="ogc:copyright-statement//ogc:title"> - <xsl:variable name="level"> - <xsl:call-template name="getLevel"/> - </xsl:variable> - <fo:block font-weight="bold" color="{$color_blue}" margin-top="24pt" role="H{$level}"> - <xsl:apply-templates/> - </fo:block> - </xsl:template> - - <xsl:template match="ogc:license-statement//ogc:p | ogc:feedback-statement//ogc:p | ogc:copyright-statement//ogc:p"> - <fo:block margin-top="6pt"> - <xsl:apply-templates/> - </fo:block> - </xsl:template> - - <xsl:template match="ogc:legal-statement"> - <fo:block font-size="8pt"> - <xsl:apply-templates/> - </fo:block> - </xsl:template> - - <xsl:template match="ogc:legal-statement//ogc:title"> - <xsl:variable name="level"> - <xsl:call-template name="getLevel"/> - </xsl:variable> + <!-- inline title --> <fo:inline font-weight="bold" role="H{$level}"> <xsl:apply-templates/><xsl:text>: </xsl:text> </fo:inline> </xsl:template> @@ -890,12 +876,12 @@ <xsl:call-template name="addLetterSpacing"> <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/> </xsl:call-template> </xsl:template> - - <xsl:template match="ogc:legal-statement//ogc:p"> + + <xsl:template match="ogc:legal-statement//ogc:p" priority="2"> <fo:inline> <xsl:apply-templates/> </fo:inline> <xsl:if test="following-sibling::ogc:p"> <xsl:value-of select="$linebreak"/> @@ -1028,11 +1014,11 @@ </xsl:template> <!-- ====== --> <!-- ====== --> - <xsl:template match="ogc:p"> + <xsl:template match="ogc:p" name="paragraph"> <xsl:param name="inline" select="'false'"/> <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/> <xsl:variable name="element-name"> <xsl:choose> <xsl:when test="$inline = 'true'">fo:inline</xsl:when> @@ -1281,15 +1267,10 @@ </xsl:for-each> <xsl:apply-templates select="ogc:name"/> </fo:block-container> </xsl:template> - <xsl:template match="ogc:pagebreak"> - <fo:block break-after="page"/> - <fo:block> </fo:block> - <fo:block break-after="page"/> - </xsl:template> <xsl:template name="insertHeaderFooter"> <xsl:param name="color" select="$color_blue"/> <fo:static-content flow-name="footer" role="artifact"> <fo:block-container font-size="8pt" height="100%" color="{$color}" padding-top="6mm"> @@ -1591,11 +1572,15 @@ <fo:leader leader-pattern="rule" leader-length="20%" color="{$color_design}"/> </fo:block> </fo:static-content> </xsl:template> -<xsl:variable name="titles_"> +<xsl:variable name="pageWidth_"> + 215.9 + </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_"> + 279.4 + </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_"> <title-edition lang="en"> <xsl:text>Version</xsl:text> @@ -1697,10 +1682,81 @@ <xsl:attribute name="color"><xsl:value-of select="$color_main"/></xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style"> + + <xsl:attribute name="font-size">8pt</xsl:attribute> + <xsl:attribute name="line-height">125%</xsl:attribute> + + </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style"> + + <xsl:attribute name="font-weight">bold</xsl:attribute> + <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute> + <xsl:attribute name="margin-top">24pt</xsl:attribute> + + + </xsl:attribute-set><xsl:attribute-set name="copyright-statement-p-style"> + + + <xsl:attribute name="margin-top">6pt</xsl:attribute> + + + </xsl:attribute-set><xsl:attribute-set name="license-statement-style"> + + + <xsl:attribute name="font-size">8pt</xsl:attribute> + <xsl:attribute name="line-height">125%</xsl:attribute> + + </xsl:attribute-set><xsl:attribute-set name="license-statement-title-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> + + + + + + <xsl:attribute name="font-weight">bold</xsl:attribute> + <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute> + + + </xsl:attribute-set><xsl:attribute-set name="license-statement-p-style"> + + + + <xsl:attribute name="margin-top">6pt</xsl:attribute> + + + </xsl:attribute-set><xsl:attribute-set name="legal-statement-style"> + + <xsl:attribute name="font-size">8pt</xsl:attribute> + + + + </xsl:attribute-set><xsl:attribute-set name="legal-statement-title-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> + + + + + + </xsl:attribute-set><xsl:attribute-set name="legal-statement-p-style"> + + </xsl:attribute-set><xsl:attribute-set name="feedback-statement-style"> + + + <xsl:attribute name="font-size">8pt</xsl:attribute> + <xsl:attribute name="line-height">125%</xsl:attribute> + + </xsl:attribute-set><xsl:attribute-set name="feedback-statement-title-style"> + <xsl:attribute name="keep-with-next">always</xsl:attribute> + + </xsl:attribute-set><xsl:attribute-set name="feedback-statement-p-style"> + + + <xsl:attribute name="margin-top">6pt</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="link-style"> @@ -2607,10 +2663,11 @@ </xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-list-body-style"> + </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-style"> <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute> <xsl:attribute name="font-size">65%</xsl:attribute> @@ -2716,10 +2773,90 @@ </xsl:for-each> </xsl:template><xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template><xsl:template match="*[local-name()='br']"> <xsl:value-of select="$linebreak"/> + </xsl:template><xsl:template match="*[local-name()='copyright-statement']"> + <fo:block xsl:use-attribute-sets="copyright-statement-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name()='copyright-statement']//*[local-name()='title']"> + + <xsl:variable name="level"> + <xsl:call-template name="getLevel"/> + </xsl:variable> + <fo:block role="H{$level}" xsl:use-attribute-sets="copyright-statement-title-style"> + <xsl:apply-templates/> + </fo:block> + + </xsl:template><xsl:template match="*[local-name()='copyright-statement']//*[local-name()='p']"> + + + <fo:block xsl:use-attribute-sets="copyright-statement-p-style"> + + + + + + <xsl:apply-templates/> + </fo:block> + + + </xsl:template><xsl:template match="*[local-name()='license-statement']"> + <fo:block xsl:use-attribute-sets="license-statement-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name()='license-statement']//*[local-name()='title']"> + + <xsl:variable name="level"> + <xsl:call-template name="getLevel"/> + </xsl:variable> + <fo:block role="H{$level}" xsl:use-attribute-sets="license-statement-title-style"> + <xsl:apply-templates/> + </fo:block> + + </xsl:template><xsl:template match="*[local-name()='license-statement']//*[local-name()='p']"> + + <fo:block xsl:use-attribute-sets="license-statement-p-style"> + + + + + + <xsl:apply-templates/> + </fo:block> + + </xsl:template><xsl:template match="*[local-name()='legal-statement']"> + <fo:block xsl:use-attribute-sets="legal-statement-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='title']"> + + <!-- process in the template 'title' --> + <xsl:call-template name="title"/> + + + </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']"> + + <!-- process in the template 'paragraph' --> + <xsl:call-template name="paragraph"/> + + </xsl:template><xsl:template match="*[local-name()='feedback-statement']"> + <fo:block xsl:use-attribute-sets="feedback-statement-style"> + <xsl:apply-templates/> + </fo:block> + </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='title']"> + + <!-- process in the template 'title' --> + <xsl:call-template name="title"/> + + </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']"> + + <fo:block xsl:use-attribute-sets="feedback-statement-p-style"> + <xsl:apply-templates/> + </fo:block> + </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 match="*[local-name()='table']" name="table"> @@ -2865,11 +3002,11 @@ <xsl:choose> <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']"> <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/> </xsl:when> <xsl:otherwise> - <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> + <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely --> </xsl:otherwise> </xsl:choose> </fo:table> @@ -3079,11 +3216,11 @@ </xsl:for-each> </xsl:variable> <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/> <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces --> - </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='thead']"> <xsl:param name="cols-count"/> <fo:table-header> <xsl:apply-templates/> @@ -3104,17 +3241,17 @@ </fo:table-row> </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:template><xsl:template match="*[local-name()='tfoot']"> <xsl:apply-templates/> </xsl:template><xsl:template name="insertTableFooter"> <xsl:param name="cols-count"/> <xsl:if test="../*[local-name()='tfoot']"> <fo:table-footer> - <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> + <xsl:apply-templates select="../*[local-name()='tfoot']"/> </fo:table-footer> </xsl:if> </xsl:template><xsl:template name="insertTableFooterInSeparateTable"> <xsl:param name="table_attributes"/> <xsl:param name="colwidths"/> @@ -3196,11 +3333,11 @@ <!-- for BSI (not PAS) display Notes before footnotes --> <!-- except gb and bsi --> - <xsl:apply-templates select="../*[local-name()='note']" mode="process"/> + <xsl:apply-templates select="../*[local-name()='note']"/> <!-- horizontal row separator --> @@ -3234,11 +3371,11 @@ </xsl:choose> </xsl:variable> - <xsl:apply-templates select="../*[local-name()='thead']" mode="process"> + <xsl:apply-templates select="../*[local-name()='thead']"> <xsl:with-param name="cols-count" select="$cols-count"/> </xsl:apply-templates> <xsl:call-template name="insertTableFooter"> <xsl:with-param name="cols-count" select="$cols-count"/> @@ -3381,11 +3518,11 @@ <xsl:apply-templates/> </fo:block> </fo:table-cell> - </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process"> + </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2"> <fo:block xsl:use-attribute-sets="table-note-style"> @@ -3404,14 +3541,14 @@ </fo:inline> - <xsl:apply-templates select="node()[not(local-name() = 'name')]" mode="process"/> + <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> </fo:block> - </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template 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']" priority="2"> <xsl:apply-templates/> </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn"> <!-- list of footnotes to calculate actual footnotes number --> <xsl:variable name="p_fn_"> @@ -3947,11 +4084,13 @@ <td> <xsl:apply-templates/> </td> <td> - <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/> + <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]"> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> </td> </tr> </xsl:template><xsl:template match="*[local-name()='dt']"> @@ -3974,19 +4113,24 @@ </fo:table-cell> <fo:table-cell> <fo:block> - <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/> + <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]"> + <xsl:with-param name="process">true</xsl:with-param> + </xsl:apply-templates> </fo:block> </fo:table-cell> </fo:table-row> </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 match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process"> - <xsl:apply-templates select="@language"/> - <xsl:apply-templates/> + </xsl:template><xsl:template match="*[local-name()='dd']"> + <xsl:param name="process">false</xsl:param> + <xsl:if test="$process = 'true'"> + <xsl:apply-templates select="@language"/> + <xsl:apply-templates/> + </xsl:if> </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 match="*[local-name()='em']"> <fo:inline font-style="italic"> <xsl:apply-templates/> @@ -4157,11 +4301,15 @@ <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 name="tokenize"> + </xsl:template><xsl:template match="*[local-name() = 'pagebreak']"> + <fo:block break-after="page"/> + <fo:block> </fo:block> + <fo:block break-after="page"/> + </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> @@ -4589,14 +4737,14 @@ </xsl:otherwise> </xsl:choose> </fo:inline> </xsl:template><xsl:template match="*[local-name()='appendix']"> <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style"> - <xsl:apply-templates select="*[local-name()='title']" mode="process"/> + <xsl:apply-templates select="*[local-name()='title']"/> </fo:block> - <xsl:apply-templates/> - </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process"> + <xsl:apply-templates select="node()[not(local-name()='title')]"/> + </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" priority="2"> <xsl:variable name="level"> <xsl:call-template name="getLevel"/> </xsl:variable> <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline> </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2"> @@ -5220,22 +5368,27 @@ <xsl:value-of select="."/> </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2"> <xsl:value-of select="."/> </xsl:template><xsl:template match="node()" mode="contents"> <xsl:apply-templates mode="contents"/> - </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents"> + </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents"> <xsl:variable name="level"> <xsl:call-template name="getLevel"> <xsl:with-param name="depth" select="@depth"/> </xsl:call-template> </xsl:variable> <xsl:variable name="section"> - <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/> + <xsl:choose> + <xsl:when test="@type = 'section-title'"/> + <xsl:otherwise> + <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/> + </xsl:otherwise> + </xsl:choose> </xsl:variable> - <xsl:variable name="type">floating-title</xsl:variable> + <xsl:variable name="type"><xsl:value-of select="@type"/></xsl:variable> <xsl:variable name="display"> <xsl:choose> <xsl:when test="normalize-space(@id) = ''">false</xsl:when> <xsl:when test="$level &lt;= $toc_level">true</xsl:when> @@ -5248,11 +5401,20 @@ <xsl:if test="$skip = 'false'"> <xsl:variable name="title"> <xsl:choose> <xsl:when test="*[local-name() = 'tab']"> - <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/> + <xsl:choose> + <xsl:when test="@type = 'section-title'"> + <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/> + <xsl:text>: </xsl:text> + <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:copy-of select="node()"/> </xsl:otherwise> </xsl:choose> @@ -7033,11 +7195,11 @@ </svg> </fo:instream-foreign-object> </fo:inline> </xsl:template><xsl:template match="@language"> <xsl:copy-of select="."/> - </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4"> + </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="4"> <xsl:call-template name="title"/> </xsl:template><xsl:template match="*[local-name() = 'admonition']"> @@ -7098,31 +7260,21 @@ <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)"/> <xsl:variable name="monthStr"> - <xsl:choose> - <xsl:when test="$month = '01'">january</xsl:when> - <xsl:when test="$month = '02'">february</xsl:when> - <xsl:when test="$month = '03'">march</xsl:when> - <xsl:when test="$month = '04'">april</xsl:when> - <xsl:when test="$month = '05'">may</xsl:when> - <xsl:when test="$month = '06'">june</xsl:when> - <xsl:when test="$month = '07'">july</xsl:when> - <xsl:when test="$month = '08'">august</xsl:when> - <xsl:when test="$month = '09'">september</xsl:when> - <xsl:when test="$month = '10'">october</xsl:when> - <xsl:when test="$month = '11'">november</xsl:when> - <xsl:when test="$month = '12'">december</xsl:when> - </xsl:choose> + <xsl:call-template name="getMonthByNum"> + <xsl:with-param name="num" select="$month"/> + <xsl:with-param name="lowercase" select="'true'"/> + </xsl:call-template> </xsl:variable> <xsl:variable name="monthStr_localized"> <xsl:if test="normalize-space($monthStr) != ''"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param></xsl:call-template></xsl:if> </xsl:variable> <xsl:variable name="result"> <xsl:choose> - <xsl:when test="$format = 'ddMMyyyy'"> + <xsl:when test="$format = 'ddMMyyyy'"> <!-- convert date from format 2007-04-01 to 1 April 2007 --> <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if> <xsl:text> </xsl:text> <xsl:value-of select="normalize-space(concat($monthStr_localized, ' ' , $year))"/> </xsl:when> <xsl:when test="$format = 'ddMM'"> @@ -7131,15 +7283,61 @@ </xsl:when> <xsl:when test="$format = 'short' or $day = ''"> <xsl:value-of select="normalize-space(concat($monthStr_localized, ' ', $year))"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="normalize-space(concat($monthStr_localized, ' ', $day, ', ' , $year))"/> + <xsl:value-of select="normalize-space(concat($monthStr_localized, ' ', $day, ', ' , $year))"/> <!-- January 01, 2022 --> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="$result"/> + </xsl:template><xsl:template name="getMonthByNum"> + <xsl:param name="num"/> + <xsl:param name="lang">en</xsl:param> + <xsl:param name="lowercase">false</xsl:param> <!-- return 'january' instead of 'January' --> + <xsl:variable name="monthStr_"> + <xsl:choose> + <xsl:when test="$lang = 'fr'"> + <xsl:choose> + <xsl:when test="$num = '01'">Janvier</xsl:when> + <xsl:when test="$num = '02'">Février</xsl:when> + <xsl:when test="$num = '03'">Mars</xsl:when> + <xsl:when test="$num = '04'">Avril</xsl:when> + <xsl:when test="$num = '05'">Mai</xsl:when> + <xsl:when test="$num = '06'">Juin</xsl:when> + <xsl:when test="$num = '07'">Juillet</xsl:when> + <xsl:when test="$num = '08'">Août</xsl:when> + <xsl:when test="$num = '09'">Septembre</xsl:when> + <xsl:when test="$num = '10'">Octobre</xsl:when> + <xsl:when test="$num = '11'">Novembre</xsl:when> + <xsl:when test="$num = '12'">Décembre</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$num = '01'">January</xsl:when> + <xsl:when test="$num = '02'">February</xsl:when> + <xsl:when test="$num = '03'">March</xsl:when> + <xsl:when test="$num = '04'">April</xsl:when> + <xsl:when test="$num = '05'">May</xsl:when> + <xsl:when test="$num = '06'">June</xsl:when> + <xsl:when test="$num = '07'">July</xsl:when> + <xsl:when test="$num = '08'">August</xsl:when> + <xsl:when test="$num = '09'">September</xsl:when> + <xsl:when test="$num = '10'">October</xsl:when> + <xsl:when test="$num = '11'">November</xsl:when> + <xsl:when test="$num = '12'">December</xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="normalize-space($lowercase) = 'true'"> + <xsl:value-of select="java:toLowerCase(java:java.lang.String.new($monthStr_))"/> + </xsl:when> + <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise> + </xsl:choose> </xsl:template><xsl:template name="insertKeywords"> <xsl:param name="sorting" select="'true'"/> <xsl:param name="charAtEnd" select="'.'"/> <xsl:param name="charDelim" select="', '"/> <xsl:choose> @@ -7596,9 +7794,28 @@ <xsl:otherwise> <xsl:value-of select="$value"/> </xsl:otherwise> </xsl:choose> </xsl:if> + </xsl:template><xsl:template name="number-to-ordinal"> + <xsl:param name="number"/> + <xsl:param name="curr_lang"/> + <xsl:choose> + <xsl:when test="$curr_lang = 'fr'"> + <xsl:choose> + <xsl:when test="$number = '1'">re</xsl:when> + <xsl:otherwise>e</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$number = 1">st</xsl:when> + <xsl:when test="$number = 2">nd</xsl:when> + <xsl:when test="$number = 3">rd</xsl:when> + <xsl:otherwise>th</xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> </xsl:template><xsl:template name="setAltText"> <xsl:param name="value"/> <xsl:attribute name="fox:alt-text"> <xsl:choose> <xsl:when test="normalize-space($value) != ''"> \ No newline at end of file