I've made a documentType with a RelatedLinks property (called 'productLinks').
To display the relatedLinks i've created a macro ('QuickLinks') with a parameter 'links' of type 'propertyTypePicker' to pick the correct property containing the relatedLinks. (Also checked the 'Show'-checkbox, although i don't know what's it's function...)
In the template where i want the show the relatedLinks, i call the macro and pick the correct property. <umbraco:Macro links="[#productLinks]" Alias="QuickLinks" runat="server"></umbraco:Macro>
I expect the list of links in the corresponding XSLT-script. But in there, i don't receive any links. When i try to pass the parameter-name: <umbraco:Macro links="productLinks" Alias="QuickLinks" runat="server"></umbraco:Macro> it is available in the XSLT.
Is anyone familiar with this problem? Or does someone know how to pass the related links into the macro correctly?
I noticed a couple problems in your code, but the below snippet should work. Note you need to pass in only the property name and not with the [#] syntax. I don't think this works well passing XML data.
Also, I assumed you are using 4.5+ with the new XML schema. You did have a reference to the old schema in your original XSLT...so if you are using that, just change the links variable line to:
Display Related Links
Guys,
I've made a documentType with a RelatedLinks property (called 'productLinks').
To display the relatedLinks i've created a macro ('QuickLinks') with a parameter 'links' of type 'propertyTypePicker' to pick the correct property containing the relatedLinks. (Also checked the 'Show'-checkbox, although i don't know what's it's function...)
In the template where i want the show the relatedLinks, i call the macro and pick the correct property.
<umbraco:Macro links="[#productLinks]" Alias="QuickLinks" runat="server"></umbraco:Macro>
I expect the list of links in the corresponding XSLT-script. But in there, i don't receive any links. When i try to pass the parameter-name:
<umbraco:Macro links="productLinks" Alias="QuickLinks" runat="server"></umbraco:Macro>
it is available in the XSLT.
Is anyone familiar with this problem? Or does someone know how to pass the related links into the macro correctly?
Hi jwijnker
What version of Umbraco are you using? And what does your xslt code look like?
/jan
Hi jan,
my umbraco version is:"umbraco v 4.6.1 (Assembly version: 1.0.4029.25836)"
My XSLT file (i'm still busy with...) looks like this:
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- Variables Used -->
<xsl:variable name="links" select="/macro/links"/>
<!-- Amount of items in the list -->
Items in list: <xsl:value-of select="count(/macro/links)"/> <br />
<!-- NO RESULT (0)-->
<!-- Links Data-->
<xsl:value-of select="$links"/>
<!-- NO RESULT--> <xsl:for-each select="$links/ancestor-or-self::node">
Link: <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/ />
</xsl:for-each>><br
</xsl:template>
Hi,
I noticed a couple problems in your code, but the below snippet should work. Note you need to pass in only the property name and not with the [#] syntax. I don't think this works well passing XML data.
-Tom
Also, I assumed you are using 4.5+ with the new XML schema. You did have a reference to the old schema in your original XSLT...so if you are using that, just change the links variable line to:
Tom,
thanks for you're reply's. I was still working on it and so didn't read it in time.
But, I found my solution by searching the forum and the web:
So maybe it can help someone else...
<!-- Variables Used -->
<xsl:variable name="debug" select="0"/>
<xsl:variable name="links" select="/macro/links"/>
<xsl:variable name="title" select="/macro/title"/>
<!-- Debugging -->
<xsl:if test="$debug = 1">
<textarea cols="100" rows="20" style="border:2px solid red; background-color: #eeee77; padding-left: 10px;">
<!-- In debug, comment '/textarea' below, and enable at the end of the script. -->
</textarea>
</xsl:if>
<ul>
<h3 class="uppercase"><xsl:value-of select="$title"/></h3>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]/* [name() = $links and not(@isDoc)]/links/link">
<li>
<xsl:element name="a">
<xsl:if test="./@newwindow = '1'">
<xsl:attribute name="target">_blank</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="./@type = 'external'">
<xsl:attribute name="href">
<xsl:value-of select="./@link"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="./@title"/>
</xsl:element>
</li>
</xsl:for-each>
</ul>
<!-- Debugging -->
<!--
MAKE 'textarea' BELOW AVAILABLE IN DEBUG MODE
</textarea>
-->
is working on a reply...