Copied to clipboard

Flag this post as spam?

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

  • Ivan 139 posts 302 karma points
    Feb 02, 2010 @ 20:48

    I can't make it work correctly, please Help


    I am trying to relate links to an event so i follow these steps:

    1. Add new 'Related Links with Media' Type property to type of document "Event item". The propertyAlias is "eventsRelated".
    2. Edit the event node from "Contents" section and add the related links using the new property added.
    3. Save and Publish changes.
    3. Edit the template associated to the "Event item" adding the following code:

             <umbraco:Macro Alias="RelatedLinkswithMedia" propertyAlias="eventsRelated" runat="server"></umbraco:Macro>

    Problem is i dont get any entries in the frontend or backend (visualize XSLT).

    What am i doing wrong?

    Thanks in advance for your help.


  • Stephan Lonntorp 195 posts 212 karma points
    Feb 02, 2010 @ 20:51
    Stephan Lonntorp

    You need to add a Macro in order to call a Macro, you are trying to access a Property with a Macro control, try <umbraco:Item runat="server" Field="eventsRelated" /> instead. Although, I think you'll need to write a proper macro to get anything good out of the property.

  • Ivan 139 posts 302 karma points
    Feb 02, 2010 @ 21:00

    Hi Stephan:

    I tried adding <umbraco:Item runat="server" Field="eventsRelated" /> and still getting no results.

    Anyway i got the macro "RelatedLinkswithMedia" which xslt file is:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [  <!ENTITY nbsp "&#x00A0;">]>
        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"/>

    <!-- Input the related links property alias here -->
    <xsl:variable name="propertyAlias" select="string('links')"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
        <xsl:for-each select="$currentPage/data [@alias = $propertyAlias]/links/link">
                <xsl:element name="a">
                    <xsl:if test="./@newwindow = '1'">
                        <xsl:attribute name="target">_blank</xsl:attribute>
                        <xsl:when test="./@type = 'external'">
                            <xsl:attribute name="href">
                                <xsl:value-of select="./@link"/>
                        <xsl:when test="./@type = 'media'">
                            <xsl:attribute name="href">
                                <xsl:value-of select="umbraco.library:GetMedia(./@link,0)/data[@alias='umbracoFile']"/>
                            <xsl:attribute name="href">
                                <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                    <xsl:value-of select="./@title"/>

    <!-- Live Editing support for related links. -->
    <xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />




    Any ideas?

  • Stephan Lonntorp 195 posts 212 karma points
    Feb 02, 2010 @ 21:26
    Stephan Lonntorp

    on the first line, there's a hard-coded propertyAlias, exchange that for your propertyAlias, 'eventsRelated', and try again.

  • Ivan 139 posts 302 karma points
    Feb 02, 2010 @ 22:17

    Thanks Stephan but i am still getting no results.

  • Ivan 139 posts 302 karma points
    Feb 02, 2010 @ 22:20

    I changed my propertyAlias field to "links" and now everything is working properly.

    Thanks a lot for your help Stephan.


Please Sign in or register to post replies

Write your reply to: