Copied to clipboard

Flag this post as spam?

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


  • Lloyd 15 posts 35 karma points
    Jun 15, 2011 @ 07:10
    Lloyd
    0

    GetMedia for new xslt schema

    I've seen the post by Warren Buckley here and the last section has details about GetMedia but it's not making much sense to me where $images comes from. My xslt is as follows:

    <?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"
      exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:variable name="freeTrialPage" select="/macro/freeTrial" />
    <xsl:variable name="freeTrialImage" select="/macro/freeTrialImage" />

    <xsl:variable name="cubeIQfreeTrialImage" select="/macro/cubeIQfreeTrialImage" />
    <xsl:variable name="optimisePage" select="/macro/optimisePage" />
    <xsl:variable name="eCargofreeTrialImage" select="/macro/eCargofreeTrialImage" />

    <xsl:param name="currentPage"/>

    <xsl:template match="/">


    <xsl:if test="$freeTrialPage!= ''">
    <a href='{umbraco.library:NiceUrl($freeTrialPage)}' title='Sign up now for a FREE trial!'>
    <xsl:choose>
    <xsl:when test="$currentPage/@id = $optimisePage">
    <img src='/media/10653/layout-Home-SignUp_03.gif'/>
    </xsl:when>
    <xsl:otherwise>
    <img src='/media/8806/request_Demo.gif'/>
    </xsl:otherwise>
    </xsl:choose>
    </a>
    </xsl:if>


    <!-- The fun starts here -->
    <ul class="featurelist">
    <xsl:for-each select="$currentPage/preceding-sibling::node">
    <xsl:if test="data[@alias='IconSmall'] != '' ">

    <li onclick="location.href='{umbraco.library:NiceUrl(@id)}';" onMouseOver="this.style.backgroundColor='#DDD'" onMouseOut
    ="this.style.backgroundColor='transparent'" style="cursor:pointer;">

    <xsl:if test="data[@alias='IconSmall'] != '' ">

    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="umbraco.library:GetMedia(data[@alias='IconSmall'], 'false')/data [@alias = 'umbracoFile']"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:if>

    <div class="right">
    <a class="title" href="{umbraco.library:NiceUrl(@id)}">
        <xsl:value-of select="@nodeName"/>
    </a>
    <p><xsl:value-of select="subText"/></p>
    </div>
    </li>

    </xsl:if>
    </xsl:for-each>

    <li class="selected" onclick="location.href='{umbraco.library:NiceUrl($currentPage/@id)}';" style="cursor:pointer;">

    <xsl:if test="$currentPage/data[@alias='IconSmall'] != '' ">
    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="umbraco.library:GetMedia($currentPage/IconSmall, 'false')/umbracoFile"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:if>

    <div class="right">
    <a class="title" href="{umbraco.library:NiceUrl($currentPage/@id)}">
      <xsl:value-of select="$currentPage/@nodeName"/>
    </a>
    <p><xsl:value-of select="$currentPage/subText"/></p>
    </div>
    </li>

    <xsl:for-each select="$currentPage/following-sibling::node">
    <li onclick="location.href='{umbraco.library:NiceUrl(@id)}';" onMouseOver="this.style.backgroundColor='#DDD'" onMouseOut
    ="this.style.backgroundColor='transparent'" style="cursor:pointer;">

    <xsl:if test="data[@alias='IconSmall'] != '' ">
    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="umbraco.library:GetMedia(data[@alias='IconSmall'], 'false')/data [@alias = 'umbracoFile']"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:if>

    <div class="right">
    <a class="title" href="{umbraco.library:NiceUrl(@id)}">
        <xsl:value-of select="@nodeName"/>
    </a>
    <p><xsl:value-of select="subText"/></p>
    </div>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

    There's probably other errors in there that I need to be aware of but I've posted for some help earlier this afternoon that may help me identify those. The lines I'm concerned about are:

    <xsl:value-of select="umbraco.library:GetMedia(data[@alias='IconSmall'], 'false')/data [@alias = 'umbracoFile']"/>

    How do I reference  IconSmall which is from a property of type MediaPicker. I've tried a few things but non working and generally thinking I'm making a pigs ear of all this today. :(

  • Lloyd 15 posts 35 karma points
    Jun 15, 2011 @ 23:55
Please Sign in or register to post replies

Write your reply to:

Draft