Copied to clipboard

Flag this post as spam?

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


  • Amir Khan 1289 posts 2746 karma points
    Mar 23, 2012 @ 17:08
    Amir Khan
    0

    MultiNode Tree picker not getting image from node

    Hi,

    I'm using the multinode tree picker to grab and image and some text from 3 nodes. It won't pull the image with the code below, am I missing something? The XSLT to grab the image works fine when using something besides mutinode tree picker.

    Thanks

    Amir

     

    <xsl:variable name="featuredProjects" select="umbraco.library:GetXmlNodeById(/data [@alias = 'featuredProjects'])"/>
    <xsl:template match="/">
         <xsl:apply-templates select="$currentPage/featuredProjects[normalize-space()]" />
    </xsl:template>

    <xsl:template match="featuredProjects">
    <xsl:for-each select="umbraco.library:GetXmlNodeById($currentPage/featuredProjects)">
        
    <xsl:if test="$currentPage/featuredProjects/MultiNodePicker/nodeId">

      <ul>
        <!-- Loop through each of the nodeId values -->
        <xsl:for-each select="$currentPage/featuredProjects/MultiNodePicker/nodeId">
        <!-- Since we only have the nodeId value, we need to get the actual content node using umbraco.library's GetXmlNodeById method -->
        <!-- If you prefer to use pure XPath, then used this: "$currentPage/ancestor-or-self::*[@isDoc and @level = 1]/descendant-or-self::*[@isDoc and @id = current()]" -->
        <xsl:variable name="node" select="umbraco.library:GetXmlNodeById(.)" />
          <li>
            <xsl:if test="position() mod 3 = 0"> <xsl:attribute name="class">last</xsl:attribute> </xsl:if>
            <!-- Output the URL using umbraco.library's NiceUrl method -->
            <a href="{umbraco.library:NiceUrl(.)}">
             <xsl:variable name="mediaId" select="number(thumbnailImage)" />
              <xsl:if test="$mediaId > 0">
              <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
              <xsl:if test="$mediaNode/umbracoFile">
                <a href="{umbraco.library:NiceUrl(@id)}"><img src="{$mediaNode/umbracoFile}" alt="{$mediaNode/@nodeName}"  /></a>
              </xsl:if>
          </xsl:if>
            </a>
          </li>
        </xsl:for-each>
      </ul>

    </xsl:if>
    </xsl:for-each>
    </xsl:template>
  • Jon Boyer 37 posts 59 karma points
    Apr 11, 2012 @ 06:23
    Jon Boyer
    0

    Shouldn't <xsl:iftest="$mediaId >0"> be <xsl:iftest="$mediaId &gt; 0">  ?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies