I am trying to store a time interval in my XML, which is defined by my XSD as duration in my XSD file. I am not sure how to use it though, the following is what I am attempting:
<duration>PT5H30M</duration>
This is equal to 5 hours and 30 minutes. I was thinking that when the XSLT file transformed the XML into HTML, then it would convert the duration to a time format?
Should it maybe be used like this?:
<duration duration="PT5H30M"></duration>
Here is where I get the duration in my XSLT file:
<tr>
<td><xsl:attribute name="class">lside</xsl:attribute>Duration</td>
<td colspan="2"><xsl:attribute name="class">rside</xsl:attribute><xsl:value-of select="/flights/flight/route[routename/. = $code]/duration"/></td>
</tr>
Any advice wold be appreciated, the XSD documentation is not helping me at all.
Well, if you use XSLT 2.0, you can easily convert a duration to a time like this:
But the XSLT processor won’t do this unless it’s what your stylesheet requests.