문제

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!

도움이 되었습니까?

해결책

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">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top