xsl-list
[Top] [All Lists]

Re: [xsl] Problem with separate date format.

2009-08-17 12:30:53
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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>