Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4058126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:02:25+00:00 2026-05-20T15:02:25+00:00

In an XSLT, I want to convert an XML document to another one. The

  • 0

In an XSLT, I want to convert an XML document to another one. The old document has some dates and times that aren’t really easy to use. For example:

<foo date="20110310" time="002000" duration="001500"/>

Now I extracted all the information and was able to convert these to ISO 8601 dates:

<xsl:variable name="begin" select='concat($begin_date_year, "-", $begin_date_month, "-", $begin_date_day, "T", $begin_time_hour, ":", $begin_time_minutes, ":", $begin_time_seconds)'/>
--> $begin = 2011-03-10T00:20:00

And for the duration:

<xsl:variable name="duration" select='concat("PT", $dur_hour, ":", $dur_minutes, ":", $dur_seconds)'/>
--> $duration = PT00:15:00

How can I add the duration to the DateTime in order to find out the end (in a DateTime format)?

I already thought about adding the individual components, but this would involve a lot of fiddling around with moduli, for example if I added 15 minutes to 23:50 and then had to adjust the day accordingly, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:02:26+00:00Added an answer on May 20, 2026 at 3:02 pm

    Okay, now I found a function that wasn’t listed in the function reference that I used before.

    add-dayTimeDuration-to-dateTime(xs:dateTime, xs:dayTimeDuration)
    

    This could also be written, for example, as:

    xs:dateTime($begin) + xs:dayTimeDuration($duration)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to convert one xml format to another specified format by using xslt.
I want to convert one xml format to another xml format by using xslt
I have some XML data that I want to convert to HTML with XSLT
I want to convert one xml file into another xml file using xslt.here, i
I want to write an xslt to transform one xml file to another. The
I want to change from one XML (XHTML) file to another using XSLT. In
Using XSLT transformation I want to convert an XML file, that in turn represents
I want make a xslt transformation to xsl-fo but I´m not really sure that
I am very new to XSL/XSLT. I want to copy an xml document into
I have an HTML file and i want to convert to XML document only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.