Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 8th, 2005, 06:29 AM
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Complex How To In XSLT

i have some data inside a dataSet outputted in xml e.g
<row>
    <id>1</id>
    <name>Mr. Smith</name>
    <date>2004-10-13T00:00:00.0000000+01:00</date>
    <duration>68<duration>
<row>
<row>
...
</row>

this is actually the data produced by a report page where the user can choose to deselect certain columns and also to change the order of the columns. i.e. my XSLT sheet loops through all the dataColumn nodes but can have no prior knowledge of the dataType of a column or whether to employ a custom XsltArgumentList object as the column positions are dynamic.

basically my xml above would need special formatting with C# so that I can display the date in the format "dd/MM/yy" and convert the duration from mins to the format "h:mm:ss". In C# I realise that I can use an XsltArgumentList to reference a custom object to do this but I need to dynamically interpret whether a column is of type 'Mins' or 'DateTime' in order to then dynamically perform my data formatting. any ideas if this is possible with XSLT?

 
Old April 8th, 2005, 06:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XSLT 2.0 is full of features that allow you to match elements and attributes based on their type, but unfortunately there's very little help for this in 1.0.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 8th, 2005, 07:16 AM
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the way i see it then, i will have to manually loop through each row of my dataTable and reformat the values how I want them first. this way the data values are guaranteed to be correct so I can just pass the resulting xml to the stylesheet without worrying.

the only downside of this is the performance of iterating through my dataTable as opposed to just called dataSet.WriteXml()

would you agree?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Expression Too Complex JCML Excel VBA 6 April 11th, 2007 08:36 AM
Complex sorting kjohnstone XSLT 1 November 26th, 2004 08:11 AM
query too complex [email protected] Access 3 August 28th, 2003 09:01 AM
Complex Table (at least for me) lcsgeek Classic ASP Basics 1 August 19th, 2003 02:53 PM
Complex table (at least for me) lcsgeek Classic ASP Professional 0 August 19th, 2003 10:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.