Solved

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

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now