Copied to clipboard

Flag this post as spam?

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


  • Natasha 79 posts 195 karma points
    Mar 14, 2013 @ 13:49
    Natasha
    0

    Adding text to a carousel

    Hi All

     

    I have an xslt that works with the image, but I have added text and I have two problems:

    1. The text is in the wrong place it should be on the right of the corresponding slide but seems to have it's own slide

    2.  It is only showing text for the first slide even though I have populated all of them.

    Any help would be greatly appreciated

    Thanks

    My xslt is:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

       
        <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
       

    <xsl:template match="/">
      <xsl:value-of select="umbraco.library:RegisterJavaScriptFile('cycle', '/js/jquery.cycle/jquery.cycle.all.min.js')"/>
         <script type="text/javascript">
    $(document).ready(function() {
        $('#Carousel').cycle({
            fx: 'scrollHorz' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
               
        });
    });
        $(document).on("click", ".nextImg", function() {
       callNextInCycle();
    });
    </script>   
        <div id="CarouselContainer">
         <div id="Carousel">
        <xsl:for-each select="$currentPage/*[starts-with(name(),'slide')]">
            <img>
                <xsl:attribute name="src">
                    <xsl:value-of select="umbraco.library:GetMedia(., 0)/umbracoFile" />
                </xsl:attribute>
            </img>
           
            <xsl:variable name="text" select="$currentPage/*[starts-with(name(),'text')]" />
            <div id="CarouselPanel">
                <p> <xsl:value-of select="$text"/></p>   
            </div>
        </xsl:for-each>         
         
            </div>
             <div id="nav">
                <div><a class="prevImg" href="#"><img src="images/prev.png" /></a></div>
                <div><a class="nextImg" href="#"><img src="images/next.png" /></a></div>
             </div>

        </div>
     
      </xsl:template>

    </xsl:stylesheet>

    and my css is:

    #CarouselContainer{background:#fff; float:left; border:1px solid #ccc;width:990px; height:345px;padding:2px 2px;}
    #Carousel{float:left; width:988px; height:341px;padding:0;}
    #CarouselPanel{width:210px; height:240px; background:transparent; color:000; float:right; overflow:hidden;}
    #Carousel p {color:#000; width:200px; margin:0 auto;}
    #Carousel img {float:left;border: none;z-index:3;width:695px;}

    #nav {position:relative; float:right; margin-top:-35px; height:33px; width:75px; padding:2px;}
    #nav .prevImg{float:left; width:35px; padding:1px 1px 1px 1px; z-index:5;}
    #nav .nextImg{float:left; width:35px; padding:1px 1px 1px 1px; z-index:5;}
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 15, 2013 @ 01:43
    Jan Skovgaard
    0

    Hi Natasha

    Could you post a screendump that shows what the page currently looks like?

    /Jan

  • Natasha 79 posts 195 karma points
    Mar 15, 2013 @ 12:04
    Natasha
    0

    Hi Jan

     

    Thanks for your reply.  Apologies I thought I had given the url http://upgrade.c4eo.org.uk

     

    Best wishes

    Natasha

  • Johan 188 posts 380 karma points
    Mar 15, 2013 @ 12:10
    Johan
    0

    Try wrapping the image and the text in a div

  • Natasha 79 posts 195 karma points
    Mar 15, 2013 @ 16:56
    Natasha
    0

    Hi Johan

    Thanks so much that worked - Just need to work out how to pick up the different pieces of text now.

    Best wishes

    Nat

  • Johan 188 posts 380 karma points
    Mar 15, 2013 @ 17:19
    Johan
    0

    Looks like you're starting from "currentPage" again instead of "." when getting the text.

  • Natasha 79 posts 195 karma points
    Mar 19, 2013 @ 17:57
    Natasha
    0

    Please could you explain in more detail as I've tried different things but am completely lost.

     

    Thanks again

    Natasha

  • Damon Bauer 48 posts 95 karma points
    Mar 19, 2013 @ 22:30
    Damon Bauer
    0

    In your for-each loop, you can't do select="$currentPage/..." because the "context", if you will, in your loop is not correct.

    Instead, use: select="./whateveryouwanttoselect".  This will keep the for-each loop selecting the next thing until it reaches the end.

Please Sign in or register to post replies

Write your reply to:

Draft