Copied to clipboard

Flag this post as spam?

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


  • syn-rg 282 posts 425 karma points
    Feb 24, 2012 @ 07:03
    syn-rg
    0

    Display thumbnail image with multi-node picker

    How do I display the thumbnail images when using multi-node picker?

    Note: the thumbnail is a child node of the of the "selected" multi-picker.

    Here is my XSLT:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [  <!ENTITY nbsp "&#x00A0;">]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


      <xsl:output method="xml" omit-xml-declaration="yes" />

      <xsl:param name="currentPage"/>
        
        <xsl:template match="/">

      <!--
        uComponents: Multi-node Tree Picker - An XSLT example
        =====================================
        The Multi-node Tree Picker data-type will provide XML data based on the nodes you have selected.
        In this example, the property alias name for the Multi-node Tree Picker is "treePicker".
      -->

      <!-- First we check that the Multi-node Tree Picker has any nodeId values -->
      <xsl:if test="$currentPage/relatedLinks/MultiNodePicker/nodeId">
        <div id="related_case_study_links">
          <h1>Related Case Studies</h1>
          <ul>
            <!-- Loop through each of the nodeId values -->
            <xsl:for-each select="$currentPage/relatedLinks/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>
                <!-- Output the URL using umbraco.library's NiceUrl method -->
                <a href="{umbraco.library:NiceUrl(.)}">
                  <xsl:value-of select="$node/@nodeName" />
                            
                  <img src="{concat(substring-before(projectImage,'.'), '_thumb_180.jpg')}"/>
                  
                </a>
              </li>
            </xsl:for-each>
          </ul>
        </div>
      </xsl:if>

    </xsl:template>

    </xsl:stylesheet>
  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Feb 24, 2012 @ 13:30
    Jeroen Breuer
    1

    Is the projectImage field on your node an upload field or a media picker? If it's a media picker you first need to use library:GetMedia(projectImage, 0)/umbracoFile to get the actuall path, because the media picker only stores the id. You don't have this problem if you use DAMP.

    Jeroen

  • syn-rg 282 posts 425 karma points
    Feb 27, 2012 @ 00:17
    syn-rg
    0

    It's from an upload field.

    I really like the DAMP package, but as this is an existing website on 4.5 and it already has over 500 projectImages I won't be able to use it. Will definitly use it on future projects though.

  • syn-rg 282 posts 425 karma points
    Feb 27, 2012 @ 01:07
    syn-rg
    0

    Solved it!

    <img src="{concat(substring-before($node//projectImage,'.'), '_thumb_180.jpg')}"/>
  • 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