Copied to clipboard

Flag this post as spam?

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


  • James Crowley 17 posts 38 karma points
    Sep 18, 2009 @ 01:19
    James Crowley
    0

    Displaying the picked items

    hey,

    I'm new to Umbraco so please forgive another beginner question. As far as I can see from the XML, this tree picker stores the selected nodes as a comma delimited list of IDs in the field? What's the best way to generate a list of links in one of the XSLT templates from this? I'm not sure how to split them out again so I can call the getNodeFromXPath function?

    Thanks!

    James

  • Petr Snobelt 923 posts 1535 karma points
    Sep 18, 2009 @ 08:52
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 18, 2009 @ 08:53
    Dirk De Grave
    0

    Hi James,

    Here's a post that may help you resolving this problem. Basically,you'll need to split the value of the property (of the tree picker) and iterate the values using GetXmlNodeById() available as xslt extension method

     

    Cheers,

    /Dirk

  • Jannik Nilsson 38 posts 81 karma points
    Sep 18, 2009 @ 08:55
    Jannik Nilsson
    0

    If I understand you correctly, you'll do something like this:

            <xsl:variable name="items" select="umbraco.library:Split($siteRoot/data [@alias='footerLinks'], ',')" />
            <xsl:for-each select="$items/value">
                <xsl:variable name="itm" select="umbraco.library:GetXmlNodeById(.)" />
                <a href="umbraco.library:NiceUrl($itm/@id)">
                    <xsl:value-of select="$itm/@nodeName"/>
                </a>
            </xsl:for-each>

  • James Crowley 17 posts 38 karma points
    Sep 18, 2009 @ 11:50
    James Crowley
    0

    Great, thanks everyone - it was the Split function in umbraco.library that I was missing.

  • Marco Lusini 176 posts 1370 karma points
    Sep 18, 2009 @ 11:57
    Marco Lusini
    0

    Jannik answer works when the DataType is configured for UltimatePicker compatibility.

    As a reference you can use this code if the DataType is configured for Lefteris compatibiliy:

    <xsl:variable name="selection" select="$currentPage/data [@alias='pickedNodes']"/>
    <xsl:if test="count($selection/descendant::node) > 0">
     <ul>
      <xsl:for-each select="$selection/descendant::node">
       <xsl:variable name="itm" select="umbraco.library:GetXmlNodeById(.)" />
       <li>
        <a href="{umbraco.library:NiceUrl($itm/@id)}">
         <xsl:value-of select="$itm/@nodeName"/>
        </a>
       </li>
      </xsl:for-each>
     </ul>
    </xsl:if>
Please Sign in or register to post replies

Write your reply to:

Draft