![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSL 101 question. Please help. [Thread Next] Re: XSL 101 question. Please help.To: NULL Date: 11/2/2006 2:45:00 PM
Got it!
http://support.microsoft.com/kb/330597
"Chad" <chad.dokmanovich@u...> wrote in message
news:eib9tb$cfa$1@t......
>I need to write a common routine that may be called by web pages to produce
>a FORMATTED excel documented. I cannot use MS Office. I've considered many
>methods, butam leaning torwards XML/XSL. I found this article which got me
>started:
>
> http://support.microsoft.com/kb/307021/
>
> My routined will accept a query string, it will run it, and then create
> and Excel doc. What I do not know how to do is to format a date in
> 31-Dec-2006 style. I also want to be able to display some dates in the
> style 31-Dec-2006 12:59 PM.
>
> Can someone please help? I was trying to use the Styles StyleDate and
> StyleDateTime (see below), but these were not working because the data
> that was in the "MyDate" Sql Server DateTime column was written in a
> format similar to this 2006/12/31/ 12:59:00.223:0500 (or something
> close-you probably know what I mean). As a result, the Style was not
> applied to the datetime value.
>
> Here's my XSL file so far. If someone could help, I'd be grateful.
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:template match="/">
> <HTML>
> <HEAD>
> <STYLE>
> .HDR { background-color:bisque;font-weight:bold }
> .style0
> {
> mso-number-format:General;
> text-align:general;
> vertical-align:bottom;
> white-space:nowrap;
> mso-rotate:0;
> mso-background-source:auto;
> mso-pattern:auto;
> color:windowtext;
> font-size:10.0pt;
> font-weight:400;
> font-style:normal;
> text-decoration:none;
> font-family:Arial;
> mso-generic-font-family:auto;
> mso-font-charset:0;
> border:none;
> mso-protection:locked visible;
> mso-style-name:Normal;
> mso-style-id:0;
> }
> .StyleDate
> {
> mso-style-parent:style0;
> mso-number-format:"Medium Date";
> }
> .StyleNumber
> {
> mso-style-parent:style0;
> mso-number-format:"0\.000";
> text-align:right;
> }
> .StyleMoney
> {
> mso-style-parent:style0;
> mso-number-format:"0\.00";
> text-align:right;
> }
> .StyleDateTime
> {
> mso-style-parent:style0;
> mso-number-format:"d\\-mmm\\-yy\\ h\:mm\\ AM\/PM";
> }
> </STYLE>
> </HEAD>
> <BODY>
> <TABLE>
> <COLGROUP WIDTH="100" ALIGN="CENTER"></COLGROUP>
> <COLGROUP WIDTH="200" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="200" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="300" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="300" ALIGN="LEFT"></COLGROUP>
> <COLGROUP WIDTH="300" ALIGN="LEFT"></COLGROUP>
> <TD CLASS="HDR">Customer ID</TD>
> <TD CLASS="HDR">Company</TD>
> <TD CLASS="HDR">Contact</TD>
> <TD CLASS="HDR">Country</TD>
> <TD CLASS="HDR">Phone</TD>
> <TD CLASS="HDR">My Date Column</TD>
> <TD CLASS="HDR">Number</TD>
> <TD CLASS="HDR">Money</TD>
> <TD CLASS="HDR">My Date Time</TD>
> <xsl:for-each select="NewDataSet/Table">
> <TR>
> <TD>
> <xsl:value-of select="CustomerID"/>
> </TD>
> <TD>
> <xsl:value-of select="CompanyName"/>
> </TD>
> <TD>
> <xsl:value-of select="ContactName"/>
> </TD>
> <TD>
> <xsl:value-of select="Country"/>
> </TD>
> <TD>
> <xsl:value-of select="Phone"/>
> </TD>
> <TD CLASS="StyleDate">
> <xsl:value-of select="MyDate"/>
> </TD>
> <TD CLASS="StyleNumber">
> <xsl:value-of select="MyNumber"/>
> </TD>
> <TD CLASS="StyleMoney">
> <xsl:value-of select="MyMoney"/>
> </TD>
> <TD CLASS="StyleDateTime">
> <xsl:value-of select="MyDateTime"/>
> </TD>
> </TR>
> </xsl:for-each>
> </TABLE>
> </BODY>
> </HTML>
> </xsl:template>
> </xsl:stylesheet>
>
>
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
