Page 3 of 3

Re: if length and 0 displays link

Posted: Mon Dec 04, 2017 4:35 pm
by Alex Ivanovich
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> 

Re: if length and 0 displays link

Posted: Mon Dec 04, 2017 9:38 pm
by Alex Ivanovich
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> 

Re: [Solved] if length and 0 displays link

Posted: Tue Dec 05, 2017 5:05 am
by LotsOCds
Excellent!