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

[Unsolved] changing dynamic text with choose, when, otherwise

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

[Unsolved] changing dynamic text with choose, when, otherwise

Postby Alex Ivanovich » Wed Apr 12, 2017 7:48 pm

something wrong in the code :?
I have done in the past, but I can not find the error :roll:
I would like to see the dynamic text, which changes

example
if and present one comic, show
1 Albo Catalogato per: (singular)

and if the present 2 or more comic show
2 Albi Catalogati per: (plural)


Code: Select all

<!-- Serie con conteggio e cambio dinamico testo in base al numero albi inizio codice -->
            <xsl:if test="series!=''">
         <strong><span style="color:red;"> ##CMD:COUNT:book,series=<xsl:value-of select="series"/>##</span>
         
                    <xsl:choose>
                         <xsl:when test="series =1">
                           Albo Catalogato per:
                         </xsl:when>
                         <xsl:otherwise>
                          Albi Catalogati per:
                         </xsl:otherwise>
                       </xsl:choose>
         
         <xsl:text>  </xsl:text></strong><strong><span style="color:red;"><xsl:value-of select="series"/></span></strong>
         </xsl:if>
      <!-- Serie con conteggio e cambio dinamico testo in base al numero albi fine codice -->
Attachments
Screen Capture #038.png
this is wrong
correct: 1 Albo Catalogato per:
Screen Capture #038.png (44.45 KiB) Viewed 277 times
Last edited by Alex Ivanovich on Thu Apr 13, 2017 5:49 pm, edited 1 time in total.

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

Re: changing dynamic text with choose, when, otherwise

Postby LotsOCds » Thu Apr 13, 2017 11:55 am

It helps to say which template you are working with. This looks like series.xsl.

It is not possible to choose Albo Catalogato or Albi Catalogati in series.xsl.

The reason is there is no information about the number of books in the series available in the XML created by series.xsl. Also, the result of ##CMD:COUNT## cannot be used because the count is calculated after XSL template processing is complete.
Cheers,
Dave

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

Re: changing dynamic text with choose, when, otherwise

Postby Alex Ivanovich » Thu Apr 13, 2017 12:24 pm

Hi Dave :)

yes, the template is this series.xsl :?

strange, this code in "BookBrowse.xsl" but works perfectly :roll:

look Storia Storie

Code: Select all

<xsl:if test="numberofsections>0">
           <tr>
             <td class="record_pane_table_group" colspan="2"><!--Contents-->Storie contenute nell'albo
          <!-- hyperlink con conteggio contenuti e testo dinamico (storia, storie) (inizio codice) -->   
         <xsl:text> </xsl:text>
         <xsl:if test="/data/record/contentsdata/item/contents!=''">
                   <a href="Book_Contents.xsl" target="_blank">
                     <b><img class="index_image" src="on.gif"/> questo albo contiene </b>
                       <strong><span style="color:red;">
                          <xsl:value-of select="count(/data/record/contentsdata/item/contents)"/>
                       </span></strong>
                     <b>
                       <xsl:choose>
                         <xsl:when test="count(/data/record/contentsdata/item/contents) =1">
                           storia
                         </xsl:when>
                         <xsl:otherwise>
                           storie
                         </xsl:otherwise>
                       </xsl:choose>
                     </b>
                   </a>
               <!--    <xsl:text> </xsl:text> <img class="index_image" src="pallino_blue.gif"/> -->
                 </xsl:if>

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

Re: changing dynamic text with choose, when, otherwise

Postby LotsOCds » Thu Apr 13, 2017 1:49 pm

Alex Ivanovich wrote:strange, this code in "BookBrowse.xsl" but works perfectly :roll:

Yes, we created that code a long time ago. The information just does not exist in series.xsl to do the same there.
Cheers,
Dave

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

Re: changing dynamic text with choose, when, otherwise

Postby Alex Ivanovich » Thu Apr 13, 2017 3:13 pm

I still do not understand, the code works partially :shock:

look at pictures :?

this is wrong <-------------the code works wrong

Image

that's righ <------------ the code works properly


Image

Why? :roll:

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

Re: changing dynamic text with choose, when, otherwise

Postby LotsOCds » Thu Apr 13, 2017 5:22 pm

Alex Ivanovich wrote:I still do not understand, the code works partially

The code is not working. It always returns "Albi Catalogati per:" Sometimes that is correct and sometimes it is not.
Cheers,
Dave

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

Re: changing dynamic text with choose, when, otherwise

Postby Alex Ivanovich » Thu Apr 13, 2017 5:49 pm

ok, solved the mystery
Topic branded as "unsolved" :|

Dave thanks for your explanations and patience :)


Return to “Using BookCAT”

Who is online

Users browsing this forum: No registered users and 1 guest