Copied to clipboard

Flag this post as spam?

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


  • Andrei Yazik 24 posts 44 karma points
    Jun 16, 2011 @ 11:14
    Andrei Yazik
    0

    Getting nodeset from uComponents Multi Node Tree Picker using XSLT

    Hi everyone,

    Recently I met a problem with getting nodes from Multi Node Tree Picker. Of course, I know that I it's possible to use "xsl:for-each" and GetXmlNodeById(.) function, but in my situation I need an array of nodes. I tried using make-nodeset function, but as the Tree Picker stores only node ids, it just returns array that stores IDs of the nodes. Could you please suggest as way how to solve this issue?

    Kind regards,

    Andrei

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 16, 2011 @ 23:21
    Jan Skovgaard
    0

    Hi Andrei

    What is returned if you write this

    <textarea>
    <xsl:copy-of select="$currentPage/yourMultieNodeTreePickerAliasHere" />
    </textarea>

    Does it return anything?

    /Jan

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 17, 2011 @ 00:22
    Tom Fulton
    0

    Hi,

    So you are wanting an array (nodeset) with all of the actual selected nodes' data (attributes and custom properties), instead of just the node id's?

    I suppose you might be able to do something like:

    <xsl:variable name="myArray">
    <xsl:for-each select="$currentPage/yourMultiNodePicker/MultiNodePicker/nodeId">
    <xsl:if test="count(umbraco.library:GetXmlNodeById(.)/error) = 0">
        <xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
    </xsl:if>
    </xsl:for-each>
    </xsl:variable>

    Then $myArray should have a node for each item in your picker with all its properties.  You might need to use msxml:node-set to interact with it though - ie <xsl:value-of select="count(msml:node-set($myArray)/* [@isDoc])"/>  (or it may be msxml:node-set($myArray)/*/* [@isDoc])

    I would also suggest you have a look at an alternative method for working with MNTP items in XSLT - check Chriztian's blog post:  http://pimpmyxslt.com/articles/multipicker/  -  it works great, saves time and saves you from having to use for-each loops and GetXmlNodeById

    -Tom

Please Sign in or register to post replies

Write your reply to:

Draft