Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 3rd, 2005, 12:40 PM
Registered User
Join Date: Nov 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to format data in xslt

I have converted a MS Project file into an xml and now using an xslt file to output the data as a webpage. There's a field in the xml file that contains the duration of the project in the following format "PT773H36M0S", this format contains teh durations in terms of hours, minutes and seconds. In my example, 773 hours and 36 minutes. I need to go through this data character by character and output how many hours and minutes there is. Can i do this through certain methods in xslt???

Reply With Quote
  #2 (permalink)  
Old November 3rd, 2005, 02:38 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts

XSLT 2.0 (from today a Candidate Recommendation!) supports durations as a native datatype, so you can do

<xsl:variable name="d" select="xdt:datTimeDuration(.)"/>
<xsl:value-of select="hours-from-duration($d)"/>
<xsl:value-of select="minutes-from-duration($d)"/>

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to format date using XSLT navi25584 XSLT 3 September 2nd, 2008 07:00 AM
Data Format Issue---need help please zone Excel VBA 0 August 13th, 2007 04:21 PM
Converting XML into a particular format using XSLT AjayLuthria XSLT 1 April 10th, 2007 09:47 AM
XSLT - Convert the date in different format haixia XSLT 1 August 25th, 2006 11:51 AM
Date format in XSLT rk2203 XSLT 2 November 29th, 2005 04:10 AM

All times are GMT -4. The time now is 11:48 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.