473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Need help with XSLT for DATES in DataSet for XMLSS

I am using an XSLT file to convert data in a DataSet to XMLSS format
for opening in Excel. Excel doesn't like the way Dates in the DataSet
are being ouput. It appears that a timezone offset is being appended
to the datetime; e.g., instead of "2003-08-26T00:00:00.0000000" I am
getting "2003-08-26T00:00:00.0000000-07:00" in the output. If I could
just get rid of the trailing "-07:00" in the output, I would be all
set. I'm guessing this must be easy to do in XSLT, but I am far from
an XSLT expert... Thanks for any advice!

XML ERROR in Table
REASON: Bad Value
FILE: C:\Documents and Settings\lmiller.SOFTAGON\My
Documents\Work\CreedonKeller_TIPS\Excel\TestBasicR isk-TEST4.xml
GROUP: Cell
TAG: Data
VALUE: 2003-08-26T00:00:00.0000000-07:00
Nov 11 '05 #1
3 4576
Such text processing isn't that easy to do in XSLT. I'd suggest using EXSLT
for MSXML or the .NET Framework which comes with a number of functions that
make text processing easier.

EXSLT info - http://www.exslt.org
EXSLT for MSXML: http://www.xml.com/pub/a/2003/08/06/exslt.html
EXSLT for .NET:
http://msdn.microsoft.com/library/en...ml05192003.asp

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
I am using an XSLT file to convert data in a DataSet to XMLSS format
for opening in Excel. Excel doesn't like the way Dates in the DataSet
are being ouput. It appears that a timezone offset is being appended
to the datetime; e.g., instead of "2003-08-26T00:00:00.0000000" I am
getting "2003-08-26T00:00:00.0000000-07:00" in the output. If I could
just get rid of the trailing "-07:00" in the output, I would be all
set. I'm guessing this must be easy to do in XSLT, but I am far from
an XSLT expert... Thanks for any advice!

XML ERROR in Table
REASON: Bad Value
FILE: C:\Documents and Settings\lmiller.SOFTAGON\My
Documents\Work\CreedonKeller_TIPS\Excel\TestBasicR isk-TEST4.xml
GROUP: Cell
TAG: Data
VALUE: 2003-08-26T00:00:00.0000000-07:00

Nov 11 '05 #2

"SQL Server Development Team" <sq****@microsoft.com> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
Such text processing isn't that easy to do in XSLT. I'd suggest using EXSLT for MSXML or the .NET Framework which comes with a number of functions that make text processing easier.

EXSLT info - http://www.exslt.org
EXSLT for MSXML: http://www.xml.com/pub/a/2003/08/06/exslt.html
EXSLT for .NET:
http://msdn.microsoft.com/library/en...ml05192003.asp


Thanks for mentioning EXSLT for MSXML4.

EXSLT for MSXML4 does not implement the date-time functions of EXSLT. It
implements the functions from the Sets module:
intersection()
difference()
has-same-node()
distinct()
leading()
trailing()

and the node-set() function from the Common module.
In the case of MSXML I would recommend the native XSLT 1.0 datetime_lib.xsl
library, which can be downloaded as part of the trial version of Xselerator.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
Nov 11 '05 #3
Well, for dates I ended up using substring to trim the end off:

<xsl:value-of select="substring(EffectiveDate,1,27)"/>

For booleans I had to convert to 1/0 using choose:
<xsl:choose><xsl:when
test="Some_Fl='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose>

To handle NULLs in the data was another story. SSXML doesn't want the
cell at all if there is no data, so I ended up hardcoding the INDEX
(column number) property into every cell and then dynamically
determining if the cell should be output at all:

<xsl:if test="SomeNullableColumn"><Cell ss:Index="6"
ss:StyleID="s32"><Data ss:Type="Number"><xsl:value-of
select="SomeNullableColumn"/></Data></Cell></xsl:if>

The other thing I had to do was to set the Namespace property of the
DataSet to an empty string. Because it is a typed-dataset, the
generated code was setting the namespace and the XSLT transform was
not recognizing the dataset and table names. I probably could have
found another way to handle this, but this seemed to be the simplest
in order to work from other examples using (non-typed) DataSets...

fun...
Nov 11 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sam | last post by:
Hi, I've been buried in xsl and xslt articles for several days now, and am still unsure as to what I need to do... Basically, my vb.net app loads up an XML file from an external source...
3
by: Matthias Marx | last post by:
Hi, May some one could help me. I want to transform data, coming from SQL Server and loaded to a dataset wiuth xslt. After that, I want convert it by a xslt style sheet, and store it...
2
by: rviray | last post by:
Hopefully, someone could point me in the right direction. I have web services that takes a DataSet object and Transforms it into a pre-defined XSD (outside of my organization's control). I have...
2
by: Reshma Prabhu | last post by:
hello, I am trying to do an xsl tranformation from an XML file into another xml file. I want the output file to be in MemoryStream so that my dataset can direclty read xml using...
4
by: David S. Alexander | last post by:
How can I do simple subtraction in an XSLT. I want to read a few attribute values from an XML document, calculate their difference, and transform that value to an attribute in the XML output...
4
by: rjn | last post by:
Hi I'm invoking the excel object from ASP.Net application. My development machine is Windows 2000 and MS Office is installed on my m/c. I have added reference to the Excel COM object, I have...
9
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1...
2
by: kamil.nowicki | last post by:
Hi there, I want to create flat txt file from my data stored in my dataset. I do xslt transformation and i've got sth like that: (where ds - is my dataset, output.txt - is my result ...
7
by: =?Utf-8?B?Sm9lbEJyaW1t?= | last post by:
Hey, brand new to XSL and XSLT. I've downloaded an evaluation copy of XML Spy to debug my transformation, but I can't get to frist base. Can anyone help my get straightened out? My XSLT is: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.