Copied to clipboard

Flag this post as spam?

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


  • wolulcmit 357 posts 693 karma points
    Jul 29, 2009 @ 23:00
    wolulcmit
    0

    Splitting values from an Ultimatepicker

    I have managed to split my values from my ultimate picker and everything is happy, but the last id from my picker always has an extra 1 for some reason.
    for example:

    1305,1295,1297,1298,13001 (should be 1300)

    and here is my code:

    <xsl:variable name="source" select="/macro/source"/>
    <xsl:variable name="relItems" select="umbraco.library:GetXmlNodeById($source)" />
    <xsl:variable name="relSplit" select="umbraco.library:Split($relItems, ',')" />

    <xsl:template match="/">

        <h2>
            <xsl:value-of select="$relItems" />
        </h2>



    <xsl:for-each select="$relSplit/value">
        <xsl:variable name="currentItem" select="umbraco.library:GetXmlNodeById(.)"/>
        <xsl:for-each select="umbraco.library:GetXmlNodeById($currentItem/@id)/descendant-or-self::node">

            <h2><xsl:value-of select="@nodeName" /></h2>
           
        </xsl:for-each>
    </xsl:for:each>

    So every last item that I select doesn't get retreived because the final id gets mangled. What am I doing wrong?

  • Tommy Poulsen 514 posts 708 karma points
    Jul 29, 2009 @ 23:09
    Tommy Poulsen
    100

    It could be that your relItems selects the full node - not the id-list value specifically. What does your relItems variable contain?

     

    >Tommy

     

  • wolulcmit 357 posts 693 karma points
    Jul 29, 2009 @ 23:20
    wolulcmit
    0

    the relitems variable contains whatever id's i've selected from the content picker.
    for example if I repulished with just the first 2 items from the previous example my relitems variable contains:

    1305,12951

    Ahhhh legend, yes you are right. it does contain the full node.
    have changed to this

    <xsl:variable name="relItems" select="umbraco.library:GetXmlNodeById($source)/data [@alias = 'bws_chooseContent']" />

    and it's all good. thanks for the quick help!

  • Tommy Poulsen 514 posts 708 karma points
    Jul 29, 2009 @ 23:25
    Tommy Poulsen
    0

    great - I was just about to write a snippet like what you just worked out ;-)

    >Tommy

     

Please Sign in or register to post replies

Write your reply to:

Draft