Re: [xsl] Problem with separate date format.

Subject: Re: [xsl] Problem with separate date format.
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 17 Aug 2009 18:30:05 +0200
Jack wrote:

I have got problem with separate date in following format:

<?xml version="1.0" encoding="UTF-8"?>
<Root>
		<Time>2009-08-12 16:24</Time>
</Root>

I would like get following output:

----------------------------------
Hours | Minutes| Day |Month| Year|
------|--------|-----|-----|-----|
16    |   24   |  12 |  08 |2009 |

It is possible get table like this in XSLT v1.0 ?

Extract those parts with substring, here is an example of extracting hours and minutes (although I am not sure I have the right index), fill in the rest:


  <xsl:template match="Time">
    <table>
      <thead>
        <tr>
          <th>Hours</th>
          <th>Minutes</th>
          ...
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><xsl:value-of select="substring(., 12, 2)"/></td>
          <td><xsl:value-of select="substring(., 15)"/></td>
          ...
        </tr>
       </tbody>
     </table>
  </xsl:template>
--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread