473,566 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.000 0000" I am
getting "2003-08-26T00:00:00.000 0000-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\lmille r.SOFTAGON\My
Documents\Work\ CreedonKeller_T IPS\Excel\TestB asicRisk-TEST4.xml
GROUP: Cell
TAG: Data
VALUE: 2003-08-26T00:00:00.000 0000-07:00
Nov 11 '05 #1
3 4584
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********@hot mail.com> wrote in message
news:8c******** *************** ***@posting.goo gle.com...
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.000 0000" I am
getting "2003-08-26T00:00:00.000 0000-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\lmille r.SOFTAGON\My
Documents\Work\ CreedonKeller_T IPS\Excel\TestB asicRisk-TEST4.xml
GROUP: Cell
TAG: Data
VALUE: 2003-08-26T00:00:00.000 0000-07:00

Nov 11 '05 #2

"SQL Server Development Team" <sq****@microso ft.com> wrote in message
news:e5******** ******@TK2MSFTN GP11.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.xs l
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="substri ng(EffectiveDat e,1,27)"/>

For booleans I had to convert to 1/0 using choose:
<xsl:choose><xs l:when
test="Some_Fl=' true'">1</xsl:when><xsl:o therwise>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="SomeNulla bleColumn"><Cel l ss:Index="6"
ss:StyleID="s32 "><Data ss:Type="Number "><xsl:valu e-of
select="SomeNul lableColumn"/></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
6612
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 (Input.xml). When the user is setting up the source, they can make changes to it to specify which columns to include for use in my app, they can rename...
3
3208
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 back or in
2
2644
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 successfully done everything, now I am at a point where I want to verify that my XSLT logic is optimized. Since I am new to XSLT coding logic, I want...
2
10123
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 dataset.ReadXml(memoryStream). But at the time of reading it gives following exception System.Xml.XmlException: The root element is missing. But if i write into...
4
8929
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 document. My original XML is, <Dates> <Birth Year="1966" />
4
1788
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 given Access and launch permissions to ASPNET user in DCOMCNFG and the identity set to launch user. But I get the following error, moment I try to...
9
1565
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 Column1 Row1 Table2 Column1 Row1 ~ 20 Table1 Column1 Row2 ~ 3
2
5649
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 --------------------------------------------------------------- //Create a new XslTransform object. XslTransform xslt = new XslTransform();
7
2873
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: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.