Copied to clipboard

Flag this post as spam?

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


  • Daniel Draper 36 posts 57 karma points
    Apr 04, 2010 @ 07:32
    Daniel Draper
    0

    For loop mutant

    I have the following content structure:

    • Parent
      • Child 1
      • Child 2
      • ...
      • Child 7

    On the page I am displaying any one of the children nodes as the main video. Then I would like to display 5 other videos under the main video the problem I am having is if the child node (main video) is in the next 5 videos when looping it only displays 4. Here is my XSLT and sorry for the poor explanation.

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']">
        <xsl:sort select="@createDate" data-type="text" order="descending" />
        <xsl:if test="$currentPage/@id != @id">   
            <xsl:if test="position() &lt;= $numberToDisplay">
                <xsl:value-of select="$numberDisplayed + 1" />
            <li class="left">
                <a href="{umbraco.library:NiceUrl(@id)}">
                    <img src="/umbraco/imageGen.ashx?image={data [@alias = 'pageThumb']}&amp;width=90&amp;height=70" />
                    </a>
                    <h5>
                        <a href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="data [@alias = 'pageTitle']" />
                        </a>
                    </h5>
            </li>
            </xsl:if>
        </xsl:if>
    </xsl:for-each>
  • Daniel Draper 36 posts 57 karma points
    Apr 04, 2010 @ 08:26
    Daniel Draper
    0

    The source is actually

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']">
       
    <xsl:sort select="@createDate" data-type="text" order="descending" />
       
    <xsl:if test="$currentPage/@id != @id">    
           
    <xsl:if test="position() &lt;= $numberToDisplay">
           
    <li class="left">
               
    <a href="{umbraco.library:NiceUrl(@id)}">
                   
    <img src="/umbraco/imageGen.ashx?image={data [@alias = 'pageThumb']}&amp;width=90&amp;height=70" />
                   
    </a>
                   
    <h5>
                       
    <a href="{umbraco.library:NiceUrl(@id)}">
                           
    <xsl:value-of select="data [@alias = 'pageTitle']" />
                       
    </a>
                   
    </h5>
           
    </li>
           
    </xsl:if>
       
    </xsl:if>
    </xsl:for-each>

     

    The bold line below was removed, tried auto inc method but failed.

     

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']">
       
    <xsl:sort select="@createDate" data-type="text" order="descending" />
       
    <xsl:if test="$currentPage/@id != @id">    
           
    <xsl:if test="position() &lt;= $numberToDisplay">
               
    <xsl:value-of select="$numberDisplayed + 1" />
           
    <li class="left">
               
    <a href="{umbraco.library:NiceUrl(@id)}">
                   
    <img src="/umbraco/imageGen.ashx?image={data [@alias = 'pageThumb']}&amp;width=90&amp;height=70" />
                   
    </a>
                   
    <h5>
                       
    <a href="{umbraco.library:NiceUrl(@id)}">
                           
    <xsl:value-of select="data [@alias = 'pageTitle']" />
                       
    </a>
                   
    </h5>
           
    </li>
           
    </xsl:if>
       
    </xsl:if>
    </xsl:for-each>
  • Josh Reid 182 posts 258 karma points
    Apr 04, 2010 @ 11:16
    Josh Reid
    1

    Well to do it really easily, remove the currentPage node from the nodeset by changing your for-each

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']">

    to use a predicate [the condition inside square bracket]

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [@id!=$currentPage/@id][string(data [@alias='umbracoNaviHide']) != '1']">
  • Daniel Draper 36 posts 57 karma points
    Apr 04, 2010 @ 11:31
    Daniel Draper
    0

    Genius, cheers even after 12 months using Umbraco there is still plenty to use.

  • Daniel Draper 36 posts 57 karma points
    Apr 04, 2010 @ 11:39
    Daniel Draper
    0

    Fail at typing... Learn* not use!

Please Sign in or register to post replies

Write your reply to:

Draft