Solved

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

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

777 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