Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    May 10, 2011 @ 07:31
    vaibhav
    0

    Showing parameters of parents

    Hi,

    I have one herirachy something like this.

    Node 1

    > Subnode 1

      >> Sub1Child1

      >> Sub1Child2

    > Subnode 2

      >>Sub2Child1

      >>Sub2Child2

    > Subnode 3

    Node 2

     

    I have one Generic parameter same for all the levels (say parameter name is : Content)

    When ever any of childnodes dont have any value in this parameter then value present in the level 1 node should be taken.

    eg: if Subnode1 dont have any value written in parameter Content then the value writte in parameter content of Node1 should be taken .....if Sub1Child1 or Sub1Child2 dont have any value written in parameter Content then the value writte in parameter Content of Node1 should be taken.

    here Node 1 is always level 1 parameter ....

    Please help me,

  • Rich Green 2246 posts 4008 karma points
    May 10, 2011 @ 08:17
    Rich Green
    0

    Hi,

    To insert in your template you can just use this code (note the recursive parameter)

    <umbraco:Item field="Content" recursive="true" runat="server"/>

    Rich

  • vaibhav 119 posts 139 karma points
    May 10, 2011 @ 10:20
    vaibhav
    0

    hi Rich,

    I am doing this using xslt so this wont work for me ....Here is my xslt code

    <xsl:if test="$currentPage/self::*[@isDoc]/rightUpperSpot = 'Quote'">
        <div id="quoteBlock">
            <div id="header">
              <xsl:value-of select="$currentPage/self::*[@isDoc]/rightColumn1Header"/>
            </div>
            <div id="content">
              <xsl:value-of select="$currentPage/self::*[@isDoc]/rightColumn1Content"/>
              <div id="cited"><xsl:value-of select="$currentPage/self::*[@isDoc]/rightColumn1WrittenBy"/></div>
              <div id="link"><a href="{$currentPage/self::*[@isDoc]/rightColumn1Link}">View case >></a></div>
            </div>
          </div>
      </xsl:if>
      
     <xsl:if test="$currentPage/self::*[@isDoc]/rightUpperSpot = 'Marketing'">
        <div id="product">
            <div id="ProImage"><img src="{$currentPage/self::*[@isDoc]/rightColumn1Image}" recursive="true" width="292px" height="92px"/></div>
            <div id="proHeader"> <xsl:value-of select="$currentPage/self::*[@isDoc]/rightColumn1Header"/></div>
            <div id="proSubheader"><xsl:value-of select="$currentPage/self::*[@isDoc]/rightColumn1SubHeader"/></div>
            <div id="proContent">
              <div id="normal"><xsl:value-of select="umbraco.library:TruncateString($currentPage/self::*[@isDoc]/rightColumn1Content, 250,'')" disable-output-escaping="yes"/>
                                <a href="{$currentPage/self::*[@isDoc]/rightColumn1Link}"> >> </a>
               </div>
             </div>
          </div>
         </xsl:if>
          <xsl:if test="$currentPage/self::*[@isDoc]/rightUpperSpot = ''">
         <xsl:if test="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
           <xsl:if test="$currentPage/ancestor::* [@isDoc]/rightUpperSpot = 'Quote'">
        <div id="quoteBlock">
            <div id="header">
              <xsl:value-of select="$currentPage/ancestor::*[@isDoc]/rightColumn1Header"/>
            </div>
            <div id="content">
              <xsl:value-of select="$currentPage/ancestor::*[@isDoc]/rightColumn1Content"/>
              <div id="cited"><xsl:value-of select="$currentPage/ancestor::*[@isDoc]/rightColumn1WrittenBy"/></div>
              <div id="link"><a href="{$currentPage/ancestor::*[@isDoc]/rightColumn1Link}">View case >></a></div>
            </div>
          </div>
      </xsl:if>
      
     <xsl:if test="$currentPage/ancestor::*[@isDoc]/rightUpperSpot = 'Marketing'">
        <div id="product">
            <div id="ProImage"><img src="{$currentPage/ancestor::*[@isDoc]/rightColumn1Image}" recursive="true" width="292px" height="92px"/></div>
            <div id="proHeader"> <xsl:value-of select="$currentPage/ancestor::*[@isDoc]/rightColumn1Header"/></div>
            <div id="proSubheader"><xsl:value-of select="$currentPage/ancestor::*[@isDoc]/rightColumn1SubHeader"/></div>
            <div id="proContent">
              <div id="normal"><xsl:value-of select="umbraco.library:TruncateString($currentPage/ancestor::*[@isDoc]/rightColumn1Content, 250,'')" disable-output-escaping="yes"/>
                                <a href="{$currentPage/ancestor::*[@isDoc]/rightColumn1Link}"> >> </a>
               </div>
             </div>
          </div>
         </xsl:if>
      </xsl:if>
    </xsl:if>

    Here....first i check that rightupperSpot has any value or not ...if not then it should get the value of 1st level node only.....

    This code works good for 2nd level node ...but not for 3rd level node .....

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 10, 2011 @ 10:25
    Chriztian Steinmeier
    0

    Hi vaibhav,

    To always grab the Content value from the level 1 node, just do this:

    <xsl:value-of select="$currentPage/ancestor-or-self::*[@level = 1]/Content" />

    /Chriztian

  • vaibhav 119 posts 139 karma points
    May 10, 2011 @ 16:27
    vaibhav
    0

    Hi Chriztian,

    It is not showing anything when i u like u said.... any other way to do it ?

Please Sign in or register to post replies

Write your reply to:

Draft