Copied to clipboard

Flag this post as spam?

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


  • Phil Crowe 192 posts 256 karma points
    May 24, 2010 @ 17:35
    Phil Crowe
    0

    something very easy - if there are no child nodes display a message

    i have a gallery of images. if there are no images in the gallery i need to display a message saying "there are no images at this time". How can i do this?? 

  • Douglas Robar 3570 posts 4671 karma points MVP ∞ admin c-trib
    May 24, 2010 @ 17:38
    Douglas Robar
    1

    The general idea would be something like this...

    <xsl:choose>
    <xsl:when test="count(./node) > 0">
    ...show the images...
    </xsl:when>
    <xsl:otherwise>
    <p>There are no images at this time</p>
    </xsl:otherwise>
    </xsl:choose>

     

    If you need more details of how to implement this for your particular situation just let us know how you've set up your gallery.

    cheers,
    doug.

  • Phil Crowe 192 posts 256 karma points
    May 24, 2010 @ 18:29
    Phil Crowe
    0

    well it looks like this (inlcuding your suggestion. But it is returning as an empty gallery even for the the galleries that have images (child nodes). Where am i going wrong???? 

    <xsl:choose>

     

        <xsl:when test="count(./node) > 0">

    <div class="GalleryWrapperInline">

            <xsl:for-each select="$currentPage/node">

                  <a class="example7 cboxElement" href="/gallery-lightbox?ID={data[@alias='LargePhoto']}&amp;keywords={data[@alias='GalleryKeywords']}&amp;Video={data[@alias='Video']}&amp;Title={@nodeName}">

                    <img class="GalleryImgInline" src="{data[@alias='DisplayImage']}" alt="{@nodeName}" />

                  </a>     

            </xsl:for-each>

    </div>

      <div id="paradeGalleryBottom">&nbsp;</div>

     

        </xsl:when>

        <xsl:otherwise>

            <p>There are no images at this time</p>

        </xsl:otherwise>

    </xsl:choose>

  • Tom Fulton 2030 posts 4996 karma points c-trib
    May 24, 2010 @ 18:35
    Tom Fulton
    0

    Try changing

    <xsl:when test="count(./node) > 0">

    to

    <xsl:when test="count($currentPage/node) > 0">

    I think the '.' assumes you are inside a for loop, which it doesn't look like you are yet

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 24, 2010 @ 18:35
    Kim Andersen
    0

    Phil, try changing this line:

    <xsl:when test="count(./node) > 0">

    with this:

    <xsl:when test="count($currentPage/node) > 0">

    /Kim A

  • Phil Crowe 192 posts 256 karma points
    May 24, 2010 @ 18:40
    Phil Crowe
    0

    GOOD WORK FELLAS!!!

  • 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