Note that there are some explanatory texts on larger screens.

plurals
  1. POEXSLT date:format-date template without document() XSLT 1.0
    primarykey
    data
    text
    <p>I'm using <a href="http://www.exslt.org/date/functions/format-date/index.html" rel="nofollow noreferrer">date:format-date template EXSLT file</a> I'm using XSLT 1.0 and MSXML3.0 as the processor.</p> <p>My date:format-date template EXSLT file's declaration is:<br/></p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:date="http://exslt.org/dates-and-times" xmlns:str="http://exslt.org/strings" extension-element-prefixes="msxsl date str"&gt; ... &lt;/xsl:stylesheet&gt; </code></pre> <p>I cannot use document() function due to the 3rd party restrictions. So I have changed the months and days (similarly) <strong>from XML snippet:</strong></p> <pre><code>&lt;date:months&gt; &lt;date:month length="31" abbr="Jan"&gt;January&lt;/date:month&gt; &lt;date:month length="28" abbr="Feb"&gt;February&lt;/date:month&gt; &lt;date:month length="31" abbr="Mar"&gt;March&lt;/date:month&gt; &lt;date:month length="30" abbr="Apr"&gt;April&lt;/date:month&gt; &lt;date:month length="31" abbr="May"&gt;May&lt;/date:month&gt; &lt;date:month length="30" abbr="Jun"&gt;June&lt;/date:month&gt; &lt;date:month length="31" abbr="Jul"&gt;July&lt;/date:month&gt; &lt;date:month length="31" abbr="Aug"&gt;August&lt;/date:month&gt; &lt;date:month length="30" abbr="Sep"&gt;September&lt;/date:month&gt; &lt;date:month length="31" abbr="Oct"&gt;October&lt;/date:month&gt; &lt;date:month length="30" abbr="Nov"&gt;November&lt;/date:month&gt; &lt;date:month length="31" abbr="Dec"&gt;December&lt;/date:month&gt; &lt;/date:months&gt; </code></pre> <p><strong>to the variable:</strong></p> <pre><code> &lt;xsl:variable name="months"&gt; &lt;month length="31" abbr="Jan"&gt;January&lt;/month&gt; &lt;month length="28" abbr="Feb"&gt;February&lt;/month&gt; &lt;month length="31" abbr="Mar"&gt;March&lt;/month&gt; &lt;month length="30" abbr="Apr"&gt;April&lt;/month&gt; &lt;month length="31" abbr="May"&gt;May&lt;/month&gt; &lt;month length="30" abbr="Jun"&gt;June&lt;/month&gt; &lt;month length="31" abbr="Jul"&gt;July&lt;/month&gt; &lt;month length="31" abbr="Aug"&gt;August&lt;/month&gt; &lt;month length="30" abbr="Sep"&gt;September&lt;/month&gt; &lt;month length="31" abbr="Oct"&gt;October&lt;/month&gt; &lt;month length="30" abbr="Nov"&gt;November&lt;/month&gt; &lt;month length="31" abbr="Dec"&gt;December&lt;/month&gt; &lt;/xsl:variable&gt; </code></pre> <p>And correspondingly, I've changed the code that originally uses document() function <strong>from:</strong><br/> [from month processing bit of EXSLT stylesheet]<br/></p> <pre><code>&lt;xsl:variable name="month-node" select="document('')/*/date:months/date:month[number($month)]" /&gt; </code></pre> <p><strong>to use MSXML3.0 node-set function</strong>:</p> <pre><code>&lt;xsl:variable name="month-node" select="msxsl:node-set($months)/month[number($month)]" /&gt; </code></pre> <p>So I assumed that this would work.</p> <p>According to the EXLT instructions "The format pattern string is interpreted as described for the JDK 1.1 <a href="http://java.sun.com/products/archive/j2se-eol.html" rel="nofollow noreferrer">SimpleDateFormat class.</a>" [I used current version]. <br/></p> <p>I'm specifing the month in accordance to <a href="http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html" rel="nofollow noreferrer">SimpleDateFormat class</a> as 'dd MMMMM yyyy' so that the month will be the full month's name, for example January. But it doesn't work :( I've looked in EXSLT stylesheet and it has got the logic to do that. Also there is logic to display the name of the week for a day using 'E' pattern, which doesn't work for me. Maybe changing from using document() to variables broke it.</p> <p>Would really appreciate any help.</p> <p>Many thanks!</p> <p><strong>EXAMPLES</strong></p> <pre><code>&lt;xsl:call-template name="date:format-date"&gt; &lt;xsl:with-param name="date-time" select="'2010-07-01'"/&gt; &lt;xsl:with-param name="pattern" select="'dd MMMMM yyyy'" /&gt; &lt;/xsl:call-template&gt; </code></pre> <p>As I understand from <a href="http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html" rel="nofollow noreferrer">SimpleDateFormat class</a> docs this should result in <strong>01 July 2010</strong> and what I get is <strong>01 07 2010</strong></p> <p><br/><br/></p> <pre><code>&lt;xsl:call-template name="date:format-date"&gt; &lt;xsl:with-param name="date-time" select="'2010-07-01'"/&gt; &lt;xsl:with-param name="pattern" select="'EEE, dd MMMMM yyyy'" /&gt; &lt;/xsl:call-template&gt; </code></pre> <p>This should result in <strong>Mon, 01 July 2010</strong> and what I get is <strong>, 01 07 2010</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload