Solved

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

Posted on 2013-12-16
4
241 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
  • 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

828 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