Question

I have the following:

<xsl:if test="Length > 3">
   <td><xsl:value-of select="SongName"/></td>
</xsl:if>

The problem is that in the XML, the content of the element

<Length>

is introduced like: 3:20 (3 minutes, 20 seconds).

How can I select only the first part of "3:20" to compare it? I would like to select only the songs that are 3 minutes long at minimum.

Thanks!

Was it helpful?

Solution

If all your lengths are consistently formatted - they are always digits except for the colon, and there are always exactly two digits after the colon - then the simplest approach would be to strip the colon out and treat the whole thing as one number, e.g.

<xsl:if test="translate(Length, ':', '') &gt; 300">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top