[Solved] icon in Contents

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

Re: icon in Contents

Post by Alex Ivanovich » Sat Sep 19, 2015 2:53 pm

LotsOCds wrote:There are multiple problems with the code that are causing errors. If you want I can be specific. Here is corrected code.
Interestingly this code, can explain it, to understand it :|
I tried to add it came many errors :?

Thanks again ;)

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

Re: icon in Contents

Post by LotsOCds » Sat Sep 19, 2015 3:59 pm

Okay. First, you cannot put text between an xsl:choose and xsl:when.

<xsl:choose>
!!!Attenzione!!! manca (
<xsl:when test="count(credits/credit/lookupdata[biography='']) =1"/>) Credits biografici

So it must be:

Code: Select all

!!Attenzione!!! manca (
<xsl:choose>
  <xsl:when test="count(credits/credit/lookupdata[biography='']) =1"/>
    ) Credits biografici
    manca
  </xsl:when>
  <xsl:otherwise>
    mancano
  </xsl:otherwise>
</xsl:choose>
Next, the xsl:when is terminated by a forward slash "/" when you don't want to terminate it.
<xsl:when test="count(credits/credit/lookupdata[biography='']) =1"/>

With the slash removed the errors are gone

Code: Select all

!!Attenzione!!! manca (
<xsl:choose>
  <xsl:when test="count(credits/credit/lookupdata[biography='']) =1">
    ) Credits biografici
    manca
  </xsl:when>
  <xsl:otherwise>
    mancano
  </xsl:otherwise>
</xsl:choose>
But the output is not what you want. As written it will print either
"!!Attenzione!!! manca () Credits biografici manca"
-or-
"!!Attenzione!!! manca () Credits biografici mancano"

So we have to rearrange things further and explicitly add a statement to show the count. That leaves us with the code shown in my previous post.
Cheers,
Dave

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

Re: icon in Contents

Post by Alex Ivanovich » Sat Sep 19, 2015 4:09 pm

Dave, interesting lesson, you have a lot of knowledge in .XML :)
you open a course .xml, .xslt in this forum, with its examples related programs Fredrick :)
thanks for the explanation and code ;)

Ciao

I close this topic with the tag Solved ;)

Post Reply