Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - RE: XSLT PROCESSING [Thread Next] RE: XSLT PROCESSINGTo: NULL Date: 10/1/2004 9:09:00 PM The XML you have posted is not well-formed. Also, billing_end_date field does not have any data. You can extract the logic from my code for converting months to integers.. Regards, Mukul "JZYCN2" wrote: > Hi Mukul, > > Thanks for the response. Here is my original script and original xml file > coming from sql table's record set and billing_end_date is the field that I > need to convert to 2/24/2004 like format.. > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > > <xsl:output method="html"/> > > <xsl:template match="/"> > > <!-- <xsl:value-of select="count(root/gmol)"/> --> > > <xsl:if test="count(root/gmol) > 65530"> > <H5>Warning: First 65,530 records were imported into Excel.</H5> > </xsl:if> > > <table border="1" width="100%"> > > <xsl:for-each select = "/root/gmol"> > <tr> > <xsl:apply-templates select="*"/> > </tr> > </xsl:for-each> > </table> > </xsl:template> > > <xsl:template match="*"> > <td class="standardText"> > <xsl:choose> > <xsl:when test=". = ' ' or . = ''"> > > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="." /> > </xsl:otherwise> > </xsl:choose> > </td> > </xsl:template> > > </xsl:stylesheet> > > > --------------------------------------------------- > XML data - coming from table as record set. > ---------------------------------------------------- > <gmol><message></message><Change_Flag>Y</Change_Flag><Assigned_Asset_Owner>EDES</Assigned_Asset_Owner><ssp_io_org>GM > Canada</ssp_io_org><SSP_nbr>NAO004</SSP_nbr><SSP_Name>VSSM > Canada</SSP_Name><Facility_description>PCC Central (All 19 > Sub-Sites)</Facility_ > br><Pld_line_no></Pld_line_no><days_till_bill_end_date></days_till_bill_end_date><Billing_end_date></Billing_end_date><Notification_Date>Sep > 29 2004 > 12:00AM</Notification_Date><Barcode>J01417458</Barcode><ParentBarcode>J01417641</ParentBarcode><Serial_numb > GMOL 2000 PRIMARY > SERVICE-OFFICE</Make><Model>1448</Model><Version>NA</Version><Func>NA</Func><Status>Active</Status><HostName>NA</HostName><Leased_Asset_Disposition>Return</Leased_Asset_Disposition><Refresh_Date>3/1/2006</Refresh_Date><months_extend></mon > > > Please respond... > > > > > > "Mukul Gandhi" wrote: > > > Please try this XSL - > > > > <?xml version="1.0" encoding="UTF-8"?> > > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> > > > > <xsl:output method="xml" encoding="UTF-8" indent="yes"/> > > > > <xsl:variable name="month-map"> > > <months> > > <month> > > <string>Jan</string> > > <number>1</number> > > </month> > > <month> > > <string>Feb</string> > > <number>2</number> > > </month> > > <month> > > <string>Mar</string> > > <number>3</number> > > </month> > > <month> > > <string>Apr</string> > > <number>4</number> > > </month> > > <month> > > <string>May</string> > > <number>5</number> > > </month> > > <month> > > <string>Jun</string> > > <number>6</number> > > </month> > > <month> > > <string>Jul</string> > > <number>7</number> > > </month> > > <month> > > <string>Aug</string> > > <number>8</number> > > </month> > > <month> > > <string>Sep</string> > > <number>9</number> > > </month> > > <month> > > <string>Oct</string> > > <number>10</number> > > </month> > > <month> > > <string>Nov</string> > > <number>11</number> > > </month> > > <month> > > <string>Dec</string> > > <number>12</number> > > </month> > > </months> > > </xsl:variable> > > > > <xsl:template match="@* | node()"> > > <xsl:copy> > > <xsl:apply-templates select="@*"/> > > <xsl:apply-templates select="node()"/> > > </xsl:copy> > > </xsl:template> > > > > <xsl:template match="field2"> > > <xsl:variable name="mnth" select="substring-before(., '.')"/> > > <xsl:variable name="date" select="substring-before(substring-after(., ' > > '), ' ')"/> > > <xsl:variable name="year" select="substring-after(substring-after(., ' > > '), ' ')"/> > > <field2> > > <xsl:value-of select="msxsl:node-set($month-map)/months/month[string > > = $mnth]/number"/>/<xsl:value-of select="$date"/>/<xsl:value-of > > select="$year"/> > > </field2> > > </xsl:template> > > > > </xsl:stylesheet> > > > > Regards, > > Mukul > > > > > > "JZYCN2" wrote: > > > > > Hi > > > I have record sets in XML like following > > > <field1>j3456</field1><field2>Aug. 23 2004</field2>.... > > > <field1>jhgert</field1><field2>Aug. 21 2004</field2>... > > > <field1>j12dfg</field1><field2>Aug. 12 2004</field2>.. > > > ..... > > > > > > Now I want to display field2 different way lile format in 8/23/2004 way and > > > other fields I want to display as it is. Can anyone advise how to do it. > > > > > > Thanks a bunch in advance | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
