Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

738 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