Solved

how to format the date to mm/dd/yyyy in xsl:stylesheet

Posted on 2013-12-16
4
253 Views
Last Modified: 2013-12-21
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:template match="/">
            <HTML>
                  <HEAD>
                        <STYLE>
                              .stdPVTblLCell {
                              background-color: #00a7e7;
                              color: white;
                              font-weight: bold;
                              text-align: left;
                              padding-left: 4px;
                              padding-top: 4px;
                              padding-bottom: 4px;
                              width: 100%;
                              font-size: 12pt;
                              }
                              .stdPageHdr {
                              color: DarkBlue;
                              font-weight: bold;
                              font-style:italic;
                              font-family:Verdana;
                              text-align: left;
                              padding-left: 4px;
                              padding-top: 4px;
                              padding-bottom: 4px;
                              width: 100%;
                              font-size: 20pt;
                              }
                              .gridHeader {
                              background-color: #C0C0C0;
                              color: DarkBlue;
                              font-size: 9pt;
                              font-weight: bold;
                              font-family:Verdana;
                              vertical-align:middle;
                              text-align:center;
                              border: solid thin Black;
                              }
                              .SearchHeader {
                              color: DarkBlue;
                              font-size: 9pt;
                              font-weight: bold;
                              font-family:Verdana;
                              }
                              .SearchKey {
                              color: DarkBlue;
                              font-size: 9pt;
                              vertical-align:middle;
                              text-align:right;
                              font-family:Verdana;
                              }
                              .SearchValue {
                              color: Black;
                              font-size: 9pt;
                              font-weight: bold;
                              vertical-align:middle;
                              text-align:left;
                              font-family:Verdana;
                              }
                              .SearchResultHeader {
                              background-color: #CCFFCC;
                              color: DarkBlue;
                              font-size: 9pt;
                              font-weight: bold;
                              font-family:Verdana;
                              }
                              .SearchResultItem {
                              background-color: #CCFFFF;
                              color: Black;
                              font-size: 8pt;
                              font-family:Verdana;
                              border: solid thin Black;
                              }
                              .SearchResultAltItem {
                              background-color: #99CCFF;
                              color: Black;
                              font-size: 8pt;
                              font-family:Verdana;
                              border: solid thin Black;
                              }
                              .gridItem {
                              font-size: 8pt;
                              font-family : Verdana;
                              color: Black;
                              background-color: #FFFFFF;
                              border: solid thin Black;
                              }
                              .gridAltItem {
                              font-size: 8pt;
                              font-family : Verdana;
                              color: Black;
                              background-color: #fbf4d5;
                              border: solid thin Black;
                              }
                              .gridHeaderFormat {
                              font-size: 9pt;
                              font-weight: bold;
                              font-family : Verdana;
                              background-color:#F3E1A6;
                              border: solid thin Black;
                              }
                        </STYLE>
                  </HEAD>
                  <BODY>
                        <TABLE>
                              <TR>
                                    <TD> </TD>
                              </TR>
                              <TR>
                                    <TD class="stdPageHdr" colspan="7">Dealer Statement</TD>
                              </TR>
                              
                              <TR>
                                    <TD> </TD>
                                    <TD class="gridHeaderFormat">
                                          Billing Date
                                    </TD>
                                    <TD class="gridHeaderFormat">
                                          Description
                                    </TD>
                                    <TD class="gridHeaderFormat">
                                          Ref#/Invoice
                                    </TD>
                              </TR>
                              <xsl:for-each select="NewDataSet/Table">
                                    <xsl:choose>
                                          <xsl:when test="position() mod 2 = 1">
                                                <TR>
                                                      <TD> </TD>
                                                      <TD class="gridItem">
                                                            <xsl:value-of select="billing_date"/>
                                                      </TD>
                                                      <TD class="gridItem">
                                                            <xsl:value-of select="billing_description"/>
                                                      </TD>
                                                      <TD class="gridItem">
                                                            <xsl:value-of select="RefNum"/>
                                                      </TD>
                                                </TR>
                                          </xsl:when>
                                          <xsl:otherwise>
                                                <TR>
                                                      <TD> </TD>
                                                      <TD class="gridAltItem">
                                                            <xsl:value-of select="billing_date"/>
                                                      </TD>
                                                      <TD class="gridAltItem">
                                                            <xsl:value-of select="billing_description"/>
                                                      </TD>
                                                      <TD class="gridAltItem">
                                                            <xsl:value-of select="RefNum"/>
                                                      </TD>
                                                </TR>
                                          </xsl:otherwise>
                                    </xsl:choose>
                              </xsl:for-each>
                        </TABLE>
                  </BODY>
            </HTML>
      </xsl:template>
</xsl:stylesheet>
0
Comment
Question by:Meinhoonaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 8

Expert Comment

by:5teveo
ID: 39722481
What is input date format? from XML
0
 

Author Comment

by:Meinhoonaa
ID: 39722483
2013-12-04T22:00:04.577-06:00
0
 

Accepted Solution

by:
Meinhoonaa earned 0 total points
ID: 39722511
Never mind, correct answer here

<xsl:value-of select="substring(billing_date,1,10)"/>
0
 

Author Closing Comment

by:Meinhoonaa
ID: 39733414
it worked
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question