Copied to clipboard

Flag this post as spam?

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


  • Molly 94 posts 134 karma points
    Jul 17, 2013 @ 16:25
    Molly
    0

    xsl-value content showing for 1 child of currentpage when clicking on all other children

    Hi There 

    Need a little help, I have xslt to display all children of the currentpage as an image and page title which displays fine. For each child i have a paragraph of text that i'm displaying in a lightbox when each child is clicken on. However, when i click on any child the lightbox appears with the paragraph of content and child name for the first child of the currentpage no matter what child i click on its the same. Here is my xslt : 

    <?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" xmlns:autofolders.library="urn:autofolders.library" xmlns:uTube.XSLT="urn:uTube.XSLT"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets autofolders.library uTube.XSLT ">

      <xsl:output method="xml" omit-xml-declaration="yes"/>
        <xsl:param name="currentPage"/>
      <xsl:template match="/">
          <!-- Process all Team Type children of $currentPage -->
          <xsl:apply-templates select="$currentPage/TeamType" />
        </xsl:template>
        <xsl:template match="TeamType">
          <h2>
            <xsl:value-of select="@nodeName" />
          </h2>
     <ul class="teamAll">
     <xsl:for-each select="teamMember">  
     <li>
     <a>
     <xsl:attribute name="href">javascript:void(0)</xsl:attribute>
     <xsl:attribute name="onclick">document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'</xsl:attribute>
     <img >
          <xsl:attribute name="src">
            <xsl:value-of select="profileImage"/>
          </xsl:attribute>
          <xsl:attribute name="alt">
            <xsl:value-of select="@nodeName"/>
          </xsl:attribute>
      </img>
      <span>
      <xsl:value-of select="@nodeName" />
      <br/>   
      <xsl:value-of select="title" />
      </span>
     </a>
     <div id="light" class="white_content">
     <h2><xsl:value-of select="@nodeName" /></h2>
     <br/>
     <xsl:value-of select="dropdownText" disable-output-escaping="yes" />
     <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a>
           </div> 
     </li>
     </xsl:for-each>
     </ul>
      </xsl:template>
    </xsl:stylesheet>

    Is there a reason why it is doing this, as my paragraph of text that displays in the lightbox named "dropdownText" is withing the for each loop and all the children images and nodenames are displaying correctly. 

    Apologies for the rough lightbox as i've tried for a while to use a more fancier one without the javascript embedded into the xslt but can't seem to have any luck with it so this is what i've resulted to. 

    Thanks in advance :)

    Molly 

  • John Halsey 59 posts 220 karma points
    Jul 18, 2013 @ 11:07
    John Halsey
    0

    Hi Molly,

    Why have you decided to use disable-output-escaping="yes" in your value-of statement?

    Wouldn't that be better in the <a href> tag? 

    Also which lightbox are you using?  I've used one recently which which didn't require any javascript to be entered into the xslt. Have a look at this one.http://lokeshdhakar.com/projects/lightbox2/

     

  • Molly 94 posts 134 karma points
    Jul 18, 2013 @ 11:27
    Molly
    0

    Hi John 

    I placed the disable output escaping because it wasn't rendering with the html tags.  I actually already have that lightbox on my site i'm using for a gallery.  Will this one work with html content? if so, do i have to have the html content external somewhere? Right now, i've just adjusted to this : 

    <xsl:template match="/">
     
          <!-- Process all Team Type children of $currentPage -->
          <xsl:apply-templates select="$currentPage/TeamType" />
     
        </xsl:template>
        <xsl:template match="TeamType">
          <h2>
            <xsl:value-of select="@nodeName" />
          </h2>
      <ul class="teamAll">
      <xsl:for-each select="teamMember">  
      <li>
      <a>
      <xsl:attribute name="href">
      <xsl:value-of select="dropdownText" />
      </xsl:attribute>
      <xsl:attribute name="rel">
      lightbox
      </xsl:attribute>
      <img >
          <xsl:attribute name="src">
            <xsl:value-of select="profileImage"/>
          </xsl:attribute>
          <xsl:attribute name="alt">
            <xsl:value-of select="@nodeName"/>
          </xsl:attribute>
       </img>
       <span>
       <xsl:value-of select="@nodeName" />
       <br/>   
       <xsl:value-of select="title" />
       </span>
      </a>
     </li>
      </xsl:for-each>
      </ul>
      </xsl:template>

    It isn't displaying as the lightbox because of the content, does this have to be in a frame or other way ? 

     

    Thanks 

    Molly

  • Molly 94 posts 134 karma points
    Jul 18, 2013 @ 12:59
    Molly
    0

    Ok, i've got the lightbox i want to use as it displays the content perfect.

    My only issue i have now is it is only displaying the very first child content i.e John Smith is the first child and he has 4 paragraphs of text about him.

    When i click on any other (person) Child John Smiths details show it doesn't change for anyone else even though my dropdownText is within the for-each loop.

    If i don't have any effect or styling and just have the dropdown text display for each they all show the correct information for each person.

    Here is my code : 

    <?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" xmlns:autofolders.library="urn:autofolders.library" xmlns:uTube.XSLT="urn:uTube.XSLT"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets autofolders.library uTube.XSLT ">
     
     
      <xsl:output method="xml" omit-xml-declaration="yes"/>
     
        <xsl:param name="currentPage"/>
     
      <xsl:template match="/">
     
          <!-- Process all Team Type children of $currentPage -->
          <xsl:apply-templates select="$currentPage/TeamType" />
     
        </xsl:template>
        <xsl:template match="TeamType">
          <h2>
            <xsl:value-of select="@nodeName" />
          </h2>
      <ul class="teamAll">
      <xsl:for-each select="teamMember">  
      <li>
    <a>
    <xsl:attribute name="href">#inline_content</xsl:attribute>
    <xsl:attribute name="class">team</xsl:attribute>
      <img>
          <xsl:attribute name="src">
            <xsl:value-of select="profileImage"/>
          </xsl:attribute>
          <xsl:attribute name="alt">
            <xsl:value-of select="@nodeName"/>
          </xsl:attribute>
       </img>
       <span>
       <xsl:value-of select="@nodeName" />
       <br/>   
       <xsl:value-of select="title" />
       </span>
      </a>  
      <div style="display:none"><div id="inline_content">
      <xsl:value-of select="dropdownText" disable-output-escaping="yes" />
      </div>
      </div>
     </li>
      </xsl:for-each>
      </ul>
     
      </xsl:template>
    </xsl:stylesheet>
     

    Sorry if this is something simple and i just can't see it.

    Thanks.

    Molly

  • John Halsey 59 posts 220 karma points
    Jul 19, 2013 @ 11:11
    John Halsey
    0

    Hi Molly,

    OK just so I understand it properly, am I right in thinking that you're linking to the paragraphs in the dropdownText for each employee from their image and title?

    I can't really see exactly why it would only bring back the first record every time.  Or why it works without any styling...

    One thing I might think about doing is putting a new div inside your <li> tag to hold everything which might help with styling.  Also is the div id="inline_content" for the lightbox to pick up?

    I don't think I've ever linked to a block of text before.  What about if you hid the div (with your text in it) off the page with css, with a margin-left: -9999px?  then when the link is clicked you could bring it back, rather than hiding it.  Just a thought.

    I'll keep thinking.

     

  • Molly 94 posts 134 karma points
    Jul 19, 2013 @ 12:50
    Molly
    0

    Hi John

    This is the link to where it is : 

    http://adtemp.co.uk.173-248-172-179.serv14.temphostspace.com/team-test.aspx

    It's best to see to know what is going on. 

    Thanks 

    Molly

  • Molly 94 posts 134 karma points
    Jul 24, 2013 @ 14:53
    Molly
    0

    Is there anyone that could look at the above link and see if they could help, I really need this to work and can't find anything to help me. It's using colorbox and below is my xslt that is using #inline_content to supposedly show each persons content in the lightbox. 

       <xsl:template match="/">
          <!-- Process all Team Type children of $currentPage -->
          <xsl:apply-templates select="$currentPage/TeamType" />
        </xsl:template>
        <xsl:template match="TeamType">
          <h2>
            <xsl:value-of select="@nodeName" />
          </h2>
     <ul class="teamAll">
     <xsl:for-each select="teamMember">  
     <li>
    <a>
    <xsl:attribute name="href">#inline_content</xsl:attribute>
    <xsl:attribute name="class">team</xsl:attribute>
     <img>
          <xsl:attribute name="src">
            <xsl:value-of select="profileImage"/>
          </xsl:attribute>
          <xsl:attribute name="alt">
            <xsl:value-of select="@nodeName"/>
          </xsl:attribute>
    </img>
    <span>
    <xsl:value-of select="@nodeName" />
    <br/>   
    <xsl:value-of select="title" />
    </span>
    <div style="display:none">
    <div id="inline_content">
    <h1><xsl:value-of select="@nodeName" /></h1>
    <xsl:value-of select="dropdownText" disable-output-escaping="yes" />
    </div>
    </div>
    </a>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:template>

    I would really appreciate if someone could give me a little bit of advice on whether it can even be achievable, as i'm way past a deadline.

    Thanks 

  • John Halsey 59 posts 220 karma points
    Jul 30, 2013 @ 18:08
    John Halsey
    0

    Hi again Molly,

    Sorry for the delay in responding.  I've been looking at this again and after looking at the link you supplied, I think it's to do with the #inline_content you have set as the link in this line...

    <xsl:attributename="href">#inline_content</xsl:attribute>

    All the div's that hold the content for each employee have a div with id="inline_content".  That surely is the root of the problem.  Because all divs have the same id, all the links just sees the first one, and display that.  

    I would think about have some dynamic way of naming your div's, and then use that in the link.  Does this work?..

    <div>
        <xsl:attribute name="id">
            #<xsl:value-of select="title" />
        </xsl:attribute>
    </div>

    and then change your link line to...

    <xsl:attributename="href">
     #<xsl:value-of select="title" />
    </xsl:attribute> 

    John

     

Please Sign in or register to post replies

Write your reply to:

Draft