Copied to clipboard

Flag this post as spam?

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


  • Dan 1288 posts 3921 karma points c-trib
    Jul 16, 2010 @ 17:47
    Dan
    0

    Ultimate picker XSLT

    Hi,

    I'm trying to output some content from an ultimate picker datatype using Lee Kelleher's demo code, but it's not returning anything after the initial comma separated variable.  I'm using the old schema (on 4.0.4.2) and have the following code:

       <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <p>Test output 1: <xsl:value-of select="$currentPage/data[@alias='features']"/></p>
    <xsl:variable name="preNodes">
    <xsl:variable name="relatedContent" select="$currentPage/data[@alias='features']" />
    <xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" />
    <xsl:for-each select="$nodeIds/value">
    <xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
    </xsl:for-each>
    </xsl:variable>
    <xsl:variable name="nodes" select="msxml:node-set($preNodes)/node" />
    <p>Test output 2: <xsl:value-of select="count($nodes)"/></p>
    <xsl:if test="count($nodes) > 0">
    <xsl:for-each select="$nodes">
    <div class="box">
    <h3><xsl:value-of select="@nodeName" /></h3>
    </div>
    </xsl:for-each>
    </xsl:if>

    The comma separated ultimate picker values are definitely in there, as the system outputs them correctly where it says 'Test ouput 1' above.  However, by the time it's done the splitting and parsing into the new variables, no nodes are returned ('Test output 2' above returns '0').

    Can anyone see where/why it's failing?

    Thanks!

  • Dan 1288 posts 3921 karma points c-trib
    Jul 16, 2010 @ 17:51
    Dan
    0

    Should have linked to Lee's XSLT code above, but editing a post containing a code block on this forum seems to break it, so I can't edit the above.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jul 16, 2010 @ 17:52
    Lee Kelleher
    0

    Hi Dan,

    Try outputting various parts of the code...

    <xmp>
        <xsl:copy-of select="umbraco.library:Split($relatedContent, ',')" />
    </xmp>

    ... and/or before "Test output 2", see what's in the $preNodes?

    <xmp>
        <xsl:copy-of select="$preNodes" />
    </xmp>

    Cheers, Lee.

  • Dan 1288 posts 3921 karma points c-trib
    Jul 16, 2010 @ 18:09
    Dan
    0

    Ah-ha, even though the ultimate-picker nodes were published, I was getting a 'not published' error in the $preNodes output.  Did the faithful 'republish entire content' and problem gone.  I must start doing that as a matter of course when XSLT seems to be misbehaving as it seems to clear up most of my issues!

    Thanks Lee :)

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jul 16, 2010 @ 18:14
    Lee Kelleher
    0

    No worries Dan, glad you sorted it! :-D

    Are you coming to the South West meet-up on the 30th? Do you know how to get to the pub? or I can meet you at Temple Meads beforehand?

    Cheers, Lee.

  • Dan 1288 posts 3921 karma points c-trib
    Jul 16, 2010 @ 18:23
    Dan
    1

    Yeah, I'll be there - looking forward to it.  I've not been to Avoncliff before, but hearing good things about the pub.  Meet-up at TM sounds like a good idea.  It might even encourage a few more new faces if we arrange a time/place there and go as a group?  Let me know when's best for you and we can sort something out...

Please Sign in or register to post replies

Write your reply to:

Draft