www.webdeveloper.com
Results 1 to 2 of 2

Thread: counting with variable to do a trick in my gallery (newb)

  1. #1
    Join Date
    Jul 2010
    Location
    Eindhoven
    Posts
    3

    Arrow counting with variable to do a trick in my gallery (newb)

    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

    Here's the code
    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
    Code:
    <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>

  2. #2
    Join Date
    Jul 2010
    Location
    Eindhoven
    Posts
    3
    Is my post unclear?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles