Click to See Complete Forum and Search --> : counting with variable to do a trick in my gallery (newb)


Vandenberg
07-20-2010, 09:26 AM
Hello, let me introduce. 24ish designer from the Netherlands, getting more and more into development. I love symphony, my newest subject.

please some advice on this matter:

I have a gallery fed by xml. It shows 12 images. When a gallery has, for example, only 3 entries, I need to fill the rest of the vacant spots up with gray crosses. I tried counting the modulus, and it prints out right.

Sadly now I don't know how to make the equation in xsl, having the right number, but lacking a decent for loop, and i grow tired of tinkering now. 3 days ago i never even heard of xslt so :o

Here's the code

<p>
<xsl:variable name="fillernokiller" select="12 - count(/data/fotos/entry)" />
<xsl:value-of select="$fillernokiller" />
</p>

<xsl:if test="fillernokiller < 12">
<li class="image">
<img src="{$assets}/images/empty.jpg" height="90" width="90" />
</li>
</xsl:if>


Here's the code in context

<div class="left">
<ul id="thumbs" class="images" >

<xsl:for-each select="/data/fotos/entry">
<li class="image">

<a rel="lightbox-mygallery" href="/workspace{afbeelding/@path}/{afbeelding/filename}" title="{omschrijving}"> <div class="container" >
<img src="/image/2/90/90/5/0{afbeelding/@path}/{afbeelding/filename}" style="z-index: 1;" alt="{omschrijving}" height="90" width="90" class="thumb" />
</div>
</a>
</li>
</xsl:for-each>

<p>
<xsl:variable name="fillernokiller" select="12 - count(/data/fotos/entry)" />
<xsl:value-of select="$fillernokiller" />
</p>

<xsl:if test="fillernokiller> 0">
<li class="image">
<img src="{$assets}/images/empty.jpg" height="90" width="90" />
</li>
</xsl:if>

</ul>
</div>

<div id="categories">
<ul>
<xsl:for-each select="/data/galerien/entry">
<li>
<a href="/home/{titel/@handle}" id="{titel/@handle}">
<xsl:value-of select="titel" />
</a>
</li>
</xsl:for-each>
</ul>
</div>

Vandenberg
07-21-2010, 07:27 AM
Is my post unclear?