Copied to clipboard

Flag this post as spam?

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


  • Mike 81 posts 101 karma points
    Jun 19, 2012 @ 16:26
    Mike
    0

    XSLT Help

    Hey Umbraco XLST Masters. I need some XSLT help with the photogallery page. I am not getting any results back. I moved the gallery to the submaster master page, so I am guessing that is the reason.

    If I change the foreach to use just $currentpage, I just the info for the very last item in the gallery.

    I created a 3rd test item in the gallery and this is the result I get if out output the value of $currentpage

    <p>My test album</p>/media/643/photo.jpgTest Pic 1/media/645/photo.jpgTest Photo 2<p>All your pictures</p>1 <---- For this value here, I actually have 3 photos attached to this and NOT 1

    Thanks for any help!!!

     

     

  • Mike 81 posts 101 karma points
    Jun 22, 2012 @ 18:03
    Mike
    0

    Hey All, I wanted to bump this. Is there anyone that could give me a little bit of direction on this per chance? I'm close but not quite getting it to work properly....

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jun 22, 2012 @ 20:12
    Chriztian Steinmeier
    0

    Hi Mike,

    I'd like to help you out but I'm a little lost in your setup, so could you maybe describe how your Content is structured and post the relevant XSLT?

    /Chriztian

  • Mike 81 posts 101 karma points
    Jun 22, 2012 @ 22:07
    Mike
    0

    Hey Chriztian, thanks I appreciate it!

    I will do my best to outline what's happening. So I am using the starterkit template for the gallery. The XSLT is unchanged. I have tried a few things to try and get it to work. The current for-each uses $currentPage/* [@isDoc] which returns zero results. I tried a few different things such as $currentPage/ and $currentPage/ancestor-or-self::* [@isDoc] but yet I cannot get it to show the albums.

    Here is what's in the gallerylistalbums.xslt file. I tried to look up the xml for the gallery and how it's working but I couldn't really figure out what's happening or get a grasp on it so I am a bit challenged on how to begin debugging the proper xpath.

    <xsl:template match="/">
            <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('StarterkitGallery', '/css/StarterkitGallery.css')"/>
            <!-- a little hack to work around the xslt syntax checker when opening/closing UL lists in two separate IF statements -->
            <!-- if it weren't for IE we could use a single UL and simply float the LI's and they'd auto-wrap -->
            <!-- but for IE we either need separate UL rows or else we need to hard-code the LI's height in CSS -->
            <!-- this approach with separate UL rows works in all browsers and row heights -->
         
          
          <ul class="umbGallery umbGalleryAlbums">
         TEXT: <xsl:value-of select="$currentPage" /> :End TEXT
           <xsl:for-each select="$currentPage">
                <!-- display each image in the row, with the count of photos in each gallery -->
                <li>
                    <a href="{umbraco.library:NiceUrl(@id)}">
                        <div class="photo"> 
                             <img src="{concat(substring-before(./umbGalleryPhoto/umbracoFile,'.'), '_thumb.jpg')}"/>
                        </div>
                        <span class="name">
                            <xsl:value-of select="@nodeName"/>
                        </span>
                    </a>
    ..... etc

    The only thing I changed was that I created a submaster template and put the gallery template under that. I attached a screen cap to help

    so it goes:

     startkitmaster

         submaster

                gallery

     

    Thanks again!!!

     

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jun 23, 2012 @ 12:15
    Chriztian Steinmeier
    1

    Hi Mike,

    The Masterpage changes should have no effect as to why it's not working. I assume you get the TEXT: and :End TEXT output so we know the macro is run?

    Next step is to get a view of the XML because it's most likely an issue with either the nodes not being there (not published), the database using the Legacy Schema or they're in a differnt place than expected.

    Two options: 1) Install the XML Dump package, which allows you to do all sorts of queries on the XML

    or 2) dump the XML to a <textarea> (ok option for a one-off scrutiny but gets very tedious :-) - you can do that like this:

    <textarea cols="60" rows="30"><xsl:copy-of select="$currentPage" /></textarea>

    When you've got a clear view of the XML - come back here and we'll crack it.

    /Chriztian

  • Mike 81 posts 101 karma points
    Jun 23, 2012 @ 17:52
    Mike
    0

    Hey Chriztian, I republished the whole site and it worked!!! :/ I was not able to see the info in the XML and when you made the comment above about it not being published, it made me think... that's the problem...

    Thanks for your help!!!

Please Sign in or register to post replies

Write your reply to:

Draft