Copied to clipboard

Flag this post as spam?

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


  • Rich Green 2246 posts 4008 karma points
    Nov 20, 2010 @ 20:56
    Rich Green
    0

    xslt problem - stumped

    I have the following in my content structure

    These are attributes of a holiday.

    Pool & Sports have the same DocType as do Private, football etc.

    I use ONE Multi node tree picker to pick these, so the holiday attribute could be 1,6,9

    What I would like to display via xslt in this case is

    Pool

    * Private

    * Indoor

    Sports

    * Tennis

    I can loop though Pool & Sports and then work out what nodes to display ok.

    My problem is how to NOT show Sports if the holiday attribute was 1,6 (ie the are no Sports attributes)

    Not sure this makes much sense, hard to explain!

    Any ideas appreciated

    Rich

  • Rich Green 2246 posts 4008 karma points
    Nov 22, 2010 @ 12:39
    Rich Green
    0

    Solved it by getting some sleep ;)

    <xsl:variable name="absoluteRoot" select="$currentPage/ancestor-or-self::root" />
    <xsl:variable name="allAttributes" select="concat(',',$currentPage/propertyAttributes,',')" />
    
    
     <xsl:for-each select="$absoluteRoot/descendant::* [name() = 'ConfigPropertyAttributeType' and string(umbracoNaviHide) != '1']">
    
       <xsl:variable name="propAttributes">
       <xsl:for-each select="./* [name() = 'PropertyAttribute' and string(umbracoNaviHide) != '1']">
           <xsl:if test="contains($allAttributes,concat(',',@id,','))">
             &lt;li&gt;<xsl:value-of select="@nodeName"/>&lt;/li&gt;
         </xsl:if>  
       </xsl:for-each>  
       </xsl:variable>  
    
       <xsl:if test="$propAttributes !=''">
          <ul><xsl:value-of select="@nodeName"/>
           <xsl:value-of select="$propAttributes" disable-output-escaping="yes"/>
         </ul>  
       </xsl:if>
     </xsl:for-each>
    
Please Sign in or register to post replies

Write your reply to:

Draft