title: Format date in xslt
body: <p>I have following xml </p>
  
  <pre><code>  &lt;Report&gt;
       &lt;Items&gt;
         &lt;Item&gt;
          &lt;Id&gt;1&lt;/Id&gt;
          &lt;TotalSent&gt;251&lt;/TotalSent&gt;
          &lt;Opened&gt;48&lt;/Opened&gt;
          &lt;LastSend&gt;01/07/2013 16:38:18&lt;/LastSend&gt;
          &lt;Bounced&gt;1&lt;/Bounced&gt;
          &lt;Unopened&gt;202&lt;/Unopened&gt;
        &lt;/Item&gt;
      &lt;/Items&gt;
    &lt;/Report&gt;
  </code></pre>
  
  <p>i want to transform it to another xml using xslt , my desired o/p is like below</p>
  
  <pre><code>&lt;chart subcaption ="Last sent on Monday 01 July 2013 at 16:38"&gt;
    &lt;set label="Opened" value="48"/&gt;
    &lt;set label="Bounced" value="1"/&gt;
  &lt;/chart&gt;
  </code></pre>
  
  <p>I am not able to get date as i want for <strong>subcaption</strong> attribute.
  I tried below xslt code but it is not working</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"&gt;
  &lt;xsl:output method="xml" indent="yes" omit-xml-declaration="no"/&gt;
  &lt;xsl:template match="/"&gt;
      &lt;chart&gt;
        &lt;xsl:variable name='lastSend' select='Report/Items/Item/LastSend' /&gt;
        &lt;xsl:attribute name="subcaption"&gt;
          &lt;xsl:value-of select="ms:format-date($lastSend, ' Last sent on MMM dd, yyyy at')"/&gt;
          &lt;xsl:value-of select="ms:format-time($lastSend, ' hh:mm')"/&gt;
        &lt;/xsl:attribute&gt;
        &lt;xsl:for-each select="Report/Items/Item"&gt;
          &lt;set&gt;
            &lt;xsl:attribute name="label"&gt;Opened&lt;/xsl:attribute&gt;
            &lt;xsl:attribute name="value"&gt;
              &lt;xsl:value-of select="Opened" /&gt;
            &lt;/xsl:attribute&gt;
          &lt;/set&gt;
          &lt;set&gt;
            &lt;xsl:attribute name="label"&gt;Bounced&lt;/xsl:attribute&gt;
            &lt;xsl:attribute name="value"&gt;
              &lt;xsl:value-of select="Bounced" /&gt;
            &lt;/xsl:attribute&gt;
          &lt;/set&gt;
        &lt;/xsl:for-each&gt;
      &lt;/chart&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>when i am passing hard coded value in <strong>ms:format-date() &amp; ms:format-time()</strong> functions, like <code>01/07/2013 16:38:18</code> it was working fine , but when i am passing variable value <strong>$lastSend</strong> it is not working. </p>
  
  <p><strong>Note: I can use any version of xsl.</strong></p>