title: Add a Duration to DateTime in XSLT
body: <p>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:</p>
  
  <pre><code>&lt;foo date="20110310" time="002000" duration="001500"/&gt;
  </code></pre>
  
  <p>Now I extracted all the information and was able to convert these to ISO 8601 dates:</p>
  
  <pre><code>&lt;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)'/&gt;
  --&gt; $begin = 2011-03-10T00:20:00
  </code></pre>
  
  <p>And for the duration:</p>
  
  <pre><code>&lt;xsl:variable name="duration" select='concat("PT", $dur_hour, ":", $dur_minutes, ":", $dur_seconds)'/&gt;
  --&gt; $duration = PT00:15:00
  </code></pre>
  
  <p>How can I <strong>add the duration to the DateTime</strong> in order to find out the end (in a DateTime format)?</p>
  
  <p>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.</p>