Copied to clipboard

Flag this post as spam?

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


  • Gary 40 posts 129 karma points
    Sep 03, 2013 @ 13:04
    Gary
    0

    Only show node if value =

    Hello,

    I have created a new Data Type that is a dropdown menu.

    It has a series of options with values

    Option 1 (value is 205)

    Option 2 (value is 206)

    There will be a number of content nodes assigned with a certain value (say 205)

    How do i display a list of the content nodes with a certain value?

    Any help or guidance will be greatly appreciated.

    Thank you

    G

  • Kim Nedergaard 37 posts 144 karma points
    Sep 03, 2013 @ 14:33
    Kim Nedergaard
    0
    <xsl:for-each select="$currentpage/descendant::* [theAliasForTheDropdown = "205"]>
       <xsl:value-of select="@nodeName"/>
    </xsl:for-each>
    

    Is this what you're searching for?

  • Gary 40 posts 129 karma points
    Sep 03, 2013 @ 15:12
    Gary
    0

    Thanks for the reply but adding that doesn't seem to work. This is my xslt which works by displaying a list of nodes with a certain template Id

    <xsl:variable name="orgNode" select="umbraco.library:GetXmlNodeById(4257)"/>
    <xsl:variable name="templateID" select="4841" />
    
    <strong>Find organisation alphabetically</strong><br /><br />
    
    <xsl:for-each select="$orgNode/*[@isDoc][@template = $templateID]">
    
    
        <xsl:sort select="@nodeName" data-type="text" order="ascending"/>   
        <a href="{umbraco.library:NiceUrl(@id)}" style="float:left; margin: 0 20px 10px 0;">    
            <xsl:if test="not(*[@isDoc])">
                <xsl:attribute name="style">color:#ccc;float:left; margin: 0 20px 10px 0;cursor:text;</xsl:attribute><xsl:attribute name="href">#</xsl:attribute>
            </xsl:if>
            <xsl:value-of select="@nodeName"/>
        </a>
    </xsl:for-each>
    

    In this instance i only want the list to display nodes with a value that is selected by the drop down menu (alias "portalOrgType")

  • Kim Nedergaard 37 posts 144 karma points
    Sep 04, 2013 @ 13:02
    Kim Nedergaard
    0

    Okay, I think this will help:

    <xsl:variable name="desiredOrgType" select="205"/>
    
    <xsl:for-each select="$orgNode/*[@isDoc and @template = $templateID and portalOrgType = $desiredOrgType]">
      <xsl:sort select="@nodeName" data-type="text" order="ascending"/>   
      <a href="{umbraco.library:NiceUrl(@id)}" style="float:left; margin: 0 20px 10px 0;">    
        <xsl:if test="not(*[@isDoc])">
            <xsl:attribute name="style">color:#ccc;float:left; margin: 0 20px 10px 0;cursor:text;</xsl:attribute> 
            <xsl:attribute name="href">#</xsl:attribute>
        </xsl:if>
        <xsl:value-of select="@nodeName"/>
      </a>
    </xsl:for-each>
    

    I've made an attribute for you, where you can type in the value of the desired Organisation type :)

  • Gary 40 posts 129 karma points
    Sep 05, 2013 @ 13:02
    Gary
    0

    Hi Kim,

    Still no joy with this either I'm afraid. Thanks for trying to help though.

    Gary

  • Kim Nedergaard 37 posts 144 karma points
    Sep 05, 2013 @ 21:20
    Kim Nedergaard
    0

    Hi again Gary,

    When you make your options for your dropdown datatype - there are two columns. Text and Value. Instead of using the value from the Value column, use the value from the Text column.

    so your variable instead will look like this:

    <xsl:variable name="desiredOrgType" select="office"/>
    
Please Sign in or register to post replies

Write your reply to:

Draft