Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 10, 2011 @ 13:29
    Fuji Kusaka
    0

    How to get an if statement to work in XSLT for images

    Hi can someone help me solve this out

     

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
      <xsl:sort select="@createDate" order="descending" />
      <xsl:if test="position () &lt;= $maxEvenements">
       
        <div class="newsDes">
          <img src="{posterEvenements}" alt="{@nodeName}"/> 
          
            
          
          <div class="txtDate"><xsl:value-of select="umbraco.library:LongDate(@createDate)"/></div>
          <div class="txtTit"><h1><a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/></a></h1></div>
          <div class="txtSum"><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="summaryEvenments"/></a></div>
          <div class="txtMore"><a href="{umbraco.library:NiceUrl(@id)}" id="lire">Lire la suite</a></div>
    </div>    

    </xsl:if>

     

     

    Here is my news List and i want to make an if statement so that image shows up only when uploaded.

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Feb 10, 2011 @ 13:45
    Rasmus Berntsen
    1

    Just put the xsl:if around the img-tag:

    <xsl:if test="posterEvenements !=''">
    <img src="{posterEvenements}" alt="{@nodeName}"/>
    </xsl:if>

    Is that what you want?

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 10, 2011 @ 14:00
    Fuji Kusaka
    0

    thanks Berntsen

    It works

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Feb 10, 2011 @ 14:04
    Rasmus Berntsen
    0

    Great... Remember to mark my post as the answer to your question, that way other users can see that your question has been answered. :)

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Feb 10, 2011 @ 14:55
    Rasmus Berntsen
    0

    Hehe, Fuji. Normally you would mark the post which answered your question, as the solution.... :-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies