[Solved] if length and 0 displays link

Discuss using and your tips/tricks for CATVids
User avatar
Alex Ivanovich
Posts: 307
Joined: Mon Sep 07, 2015 2:24 pm
Location: Russian - Italia

Re: if length and 0 displays link

Post by Alex Ivanovich » Mon Dec 04, 2017 4:35 pm

now

01:00:00 ---> 1 ora OK :)

02:40:00 ---> 2 ore 40 minuti OK :)

00:30:46 ---> 0 ora 30 minuti 46 secondi WRONG 0 ora -- I want to display only minutes and seconds (if there are only these) :|


NEW CODE

Code: Select all

<xsl:if test="length/@hours!=''">
		 <!-- <xsl:if test="length/@hours='0'"> -->
          <tr>            
                 <td class="record_pane_table_fieldname" nowrap=""><xsl:value-of select="/data/fld/video/length/@name"/></td>
                 <td class="record_pane_table_fieldvalue">
                    <xsl:value-of select="length/@hours"/>
                
				<xsl:choose>
            <xsl:when test="length/@hours > 1"><!-- se la lunghezza delle ore ha valore 1 (uno) allora sostituisce ore con ora -->
              ore
            </xsl:when>
            <xsl:otherwise>
              ora
            </xsl:otherwise>
         </xsl:choose>
				<xsl:if test="length/@minutes > 0"> <!-- se la lunghezza dei secondi ha valore 0 (zero) allora non visualizzare -->
				    <xsl:value-of select="length/@minutes"/><xsl:text> minuti </xsl:text>
					</xsl:if>
                <xsl:if test="length/@seconds > 0"> <!-- se la lunghezza dei secondi ha valore 0 (zero) allora non visualizzare -->
                     <xsl:value-of select="length/@seconds"/><xsl:text> secondi </xsl:text>
                </xsl:if>
              <xsl:choose>
               <xsl:when test="length='0:00'">
	            inserire la durata
				<a href="http://akas.imdb.com/find?q={title}">IMDB</a>
	           </xsl:when>
            </xsl:choose>
			</td>
          </tr>
		 </xsl:if> 

User avatar
Alex Ivanovich
Posts: 307
Joined: Mon Sep 07, 2015 2:24 pm
Location: Russian - Italia

Re: if length and 0 displays link

Post by Alex Ivanovich » Mon Dec 04, 2017 9:38 pm

finally, it works now :D

thanks Dave, ;)
for your suggestions (and patience) ;)

complete code

Code: Select all

<xsl:if test="length/@hours!=''">
		 <!-- <xsl:if test="length/@hours='0'"> -->
          <tr>            
                 <td class="record_pane_table_fieldname" nowrap=""><xsl:value-of select="/data/fld/video/length/@name"/></td>
                 <td class="record_pane_table_fieldvalue">
                    
			<xsl:if test="length/@hours > 0"> <!-- se la lunghezza delle ore ha valore 0 (zero) allora non visualizzare -->
	  
	                  <xsl:value-of select="length/@hours"/>
                
				<xsl:choose>
            <xsl:when test="length/@hours > 1"><!-- se la lunghezza delle ore ha valore 1 (uno) allora sostituisce ore con ora -->
              ore
            </xsl:when>
            <xsl:otherwise>
              ora
            </xsl:otherwise>
         </xsl:choose>
		 </xsl:if>
				<xsl:if test="length/@minutes > 0"> <!-- se la lunghezza dei secondi ha valore 0 (zero) allora non visualizzare -->
				    <xsl:value-of select="length/@minutes"/><xsl:text> minuti </xsl:text>
					</xsl:if>
                <xsl:if test="length/@seconds > 0"> <!-- se la lunghezza dei secondi ha valore 0 (zero) allora non visualizzare -->
                     <xsl:text> e </xsl:text>
					 <xsl:value-of select="length/@seconds"/><xsl:text> secondi </xsl:text>
                </xsl:if>
              <xsl:choose>
               <xsl:when test="length='0:00'">
	            inserire la durata
				<a href="http://akas.imdb.com/find?q={title}">IMDB</a>
	           </xsl:when>
            </xsl:choose>
			</td>
          </tr>
		 </xsl:if> 

User avatar
LotsOCds
Posts: 177
Joined: Thu Aug 20, 2015 4:23 am
Location: California, USA

Re: [Solved] if length and 0 displays link

Post by LotsOCds » Tue Dec 05, 2017 5:05 am

Excellent!
Cheers,
Dave

Post Reply