Before the end of 2017 the board will be down for a brief period of time for an upgrade.
Past experience says less than 30 minutes but I can't predict the future.
Also, there is a high probability that the forum will move to a different host, but that will not happen in 2017.
Thanks,
Doug

[Solved] if length and 0 displays link

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

[Solved] if length and 0 displays link

Postby Alex Ivanovich » Fri Nov 24, 2017 1:40 pm

how to solve this?

if the length (hours-minutes-seconds) and 0 displays the link :roll:

this code does not work :|

code to add

Code: Select all

          
           <xsl:choose>
           <xsl:when test="length='0'">
          
           <xsl:text> | </xsl:text>
           <a href="http://___.com/">go url</a>
           </xsl:when>
            </xsl:choose
          


original code

Code: Select all

<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">
                <xsl:value-of select="length/@hours"/><xsl:text> ore </xsl:text>
              </xsl:if>
              <xsl:value-of select="length/@minutes"/><xsl:text> minuti </xsl:text>
              <xsl:if test="length/@seconds>0">
                <xsl:value-of select="length/@seconds"/><xsl:text> secondi </xsl:text>
              </xsl:if>
           </td>
          </tr>
Last edited by Alex Ivanovich on Mon Dec 04, 2017 9:39 pm, edited 1 time in total.

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

Re: if length and 0 displays link

Postby LotsOCds » Sat Nov 25, 2017 6:31 am

Alex,

Always look at the XML. Here you will find the answer.

Code: Select all

<length hours="0" minutes="0" seconds="0">0:00</length>


So you need to write:

Code: Select all

<xsl:when test="length='0:00'">
Cheers,
Dave

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

Re: if length and 0 displays link

Postby Alex Ivanovich » Sat Nov 25, 2017 7:28 am

Hi Dave, :)

does not work :| :roll:

Code: Select all

<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">
                <xsl:value-of select="length/@hours"/>
            
      <xsl:choose>
           <xsl:when test="length='0:00'">
          <xsl:text> | </xsl:text>
           <a href="http://akas.imdb.com/find?q={title}">IMDB</a>
           </xsl:when>
            </xsl:choose>
            
      <xsl:choose><!-- se la lunghezza delle ore ha valore 1 (uno) allora sostituisce ore con ora -->
            <xsl:when test="length/@hours> 1">
              ore
            </xsl:when>
            <xsl:otherwise>
              ora
            </xsl:otherwise>
         </xsl:choose> <!-- se la lunghezza delle ore ha valore 1 (uno) allora sostituisce ore con ora -->
       </xsl:if>
              <xsl:value-of select="length/@minutes"/><xsl:text> minuti </xsl:text>
              <xsl:if test="length/@seconds>0">
                <xsl:value-of select="length/@seconds"/><xsl:text> secondi </xsl:text>
            
            </xsl:if>
           </td>
          </tr>

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

Re: if length and 0 displays link

Postby LotsOCds » Sat Nov 25, 2017 9:55 pm

Alex Ivanovich wrote:does not work :| :roll:

Sure it does! The problem now is with the logic in your code. Can you spot the problem?

Here's an abbreviated version of your code that should make the logic problem clear.

Code: Select all

<xsl:if test="length/@hours>0">
...
    <xsl:choose>
      <xsl:when test="length='0:00'">
      </xsl:when>
    </xsl:choose>
...   
</xsl:if>
       
Cheers,
Dave

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

Re: if length and 0 displays link

Postby Alex Ivanovich » Sun Nov 26, 2017 12:21 am

This work in half
view the link
minutes
but it does not show the hours :|

Code: Select all

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"/>
             <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>           
             
             


(then I translate it into Italian)
this should change the text as well
example: (hours, minutes, seconds)
1:40:30
result
1 hour 40 minutes and 30 seconds

example (hour)
1:00:30
result
1 hour and 30 seconds

example (minutes)
00:40
result
40 minutes

example (hour and hours, plural)
1:00 hour
2:00 hours

example (minute and minute)
1 minute
10 minutes

the code does not work :|

Code: Select all

<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:text> minuti </xsl:text>
     <xsl:if test="length/@seconds > 0"> <!-- se la lunghezza dei secondi ha valore 0 (zero) allora non visualizzare -->
     <xsl:text> e </xsl:text>
     <xsl:text> secondi </xsl:text>
     </xsl:if>

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

Re: if length and 0 displays link

Postby LotsOCds » Sun Nov 26, 2017 3:42 pm

Alex Ivanovich wrote:This work in half
view the link
minutes
but it does not show the hours :|

Look at the XML! Example:

Code: Select all

<length hours="0" minutes="30" seconds="22">30:22</length>


the code does not work

I don't understand. The code does not look complete. There is no code to show minutes or seconds.
Cheers,
Dave

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

Re: if length and 0 displays link

Postby Alex Ivanovich » Sun Nov 26, 2017 4:13 pm

:roll: :| :roll: I don't understand

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

Re: if length and 0 displays link

Postby LotsOCds » Sun Nov 26, 2017 4:23 pm

Alex Ivanovich wrote::roll: :| :roll: I don't understand

Please be more specific.
Cheers,
Dave

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

Re: if length and 0 displays link

Postby Alex Ivanovich » Sun Nov 26, 2017 4:35 pm

LotsOCds wrote:
Alex Ivanovich wrote:This work in half
view the link
minutes
but it does not show the hours :|

Look at the XML! Example:

Code: Select all

<length hours="0" minutes="30" seconds="22">30:22</length>


:| :roll: :|

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

Re: if length and 0 displays link

Postby LotsOCds » Sun Nov 26, 2017 5:17 pm

There are no hours in the XML representation "30:22"

Remember your code tests for length/@hours='0' so no hours will be shown by <xsl:value-of select="length"/>
Cheers,
Dave


Return to “Using CATVids”

Who is online

Users browsing this forum: No registered users and 1 guest