Created
July 12, 2012 21:39
-
-
Save jdsimcoe/3101215 to your computer and use it in GitHub Desktop.
iTunes Duration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<itunes:duration> | |
<xsl:analyze-string select="audio-duration" regex="^(\d+):(\d+):(\d+):(\d+)$"> | |
<xsl:matching-substring> | |
<!-- Split into components --> | |
<xsl:variable name="hours" | |
select="xs:integer(regex-group(1))"/> | |
<xsl:variable name="minutes" | |
select="xs:integer(regex-group(2))"/> | |
<xsl:variable name="seconds" | |
select="xs:integer(regex-group(3))"/> | |
<!-- Recombine components --> | |
<xsl:value-of select="$hours"/> | |
<xsl:text>:</xsl:text> | |
<xsl:value-of select="$minutes"/> | |
<xsl:text>:</xsl:text> | |
<xsl:value-of select="$seconds"/> | |
</xsl:matching-substring> | |
</xsl:analyze-string> | |
</itunes:duration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment