Copied to clipboard

Flag this post as spam?

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


  • Alec Colebrook-Clark 134 posts 258 karma points
    Jun 09, 2009 @ 13:10
    Alec Colebrook-Clark
    0

    XSLT Exists function

    Hi All,

    I'm trying to sort the layout of my site now and one of the problems i have run into is my gallery page. It uses XSLT to draw the pages out in a table format. The problem with this however is when there is no images to call on the xslt crates a table but leaves it open, thus destroying the layout.

    I am trying to implement the exists function to prevent this, however I get the error saying that umbraco doesnt understand the it. does anyone know why this happens?

    Here is the snippet of code im using, just incase.

    [code][/code]

    Cheers,

    Alec

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jun 09, 2009 @ 14:17
    Darren Ferguson
    0

    Instead of:

    [code]exists(./data [@alias='ThumbImage'])[/code]

    Try something like:

    [code]count(./data [@alias='ThumbImage']) > 0[/code]

    Oh and BTW, avoid using tables unless you are displaying tabular data!

  • Alec Colebrook-Clark 134 posts 258 karma points
    Jun 09, 2009 @ 23:49
    Alec Colebrook-Clark
    0

    Thanks for the reply, unfortunately im upgrading the installation (onto a clean machine) so the liklihood of implementing this soon is low.

    And thanks for the table advice, i just struggled to get the layout looking correct with divs so i cheated (at the time it was for my end of year project and was in a rush, will retry at a later date with divs)

    Cheers

    Alec

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 11, 2009 @ 00:26
    Jesper Hauge
    0

    As far as I can tell you are trying to list out nodes below the current page that have a ThumbImage saved.

    In this case your table approach is actualy creating some problems that are difficult to handle in xslt, so you're better of without it in more than one regard.

    Heres a code snippet that would list all nodes with ThumbImages present

    [code]




    [/code]

    The normal rendering of images in most browsers would render these images in rows, of 8 since the width of the containing div is 8 times the width of the image + the margin. If it doesn't work out entirely experiment a bit with the width of the images and the margins. If you want a more advanced rendering of the images you could take a look at the HTML used in my own gallery (see http://photos.claudihauge.dk/gallerier/natur.aspx as an example), where I use a combination of a ul with floated li's containing divs with the thumbnail.

    Regards
    Jesper Hauge

  • Alec Colebrook-Clark 134 posts 258 karma points
    Jun 11, 2009 @ 09:10
    Alec Colebrook-Clark
    0

    Thank you that would be the best soultion to my layout probelm as well as the use of XSLT!

    I shall implement it when i redesign that area next.

    Cheers,

    Alec

Please Sign in or register to post replies

Write your reply to:

Draft