Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a few multinode pickers on my site and I would like to display the contents of all of them on one page. I would rather not make 5 different XSLT files and Macros to make this work so I was trying to pass in the information as a parameter.
<umbraco:Macro SelectedNodes="[$selectedNodes]" Alias="SetCatCarousel" runat="server"></umbraco:Macro>
And in the macro it starts off like so
<xsl:variable name="MultiNodeItem" select="/macro/MultiNode"/>
<xsl:with-param name="MultiNode" select="$MultiNodeItem"></xsl:with-param>
<xsl:param name="MultiNode" />
<-- More Code, you don't need to see it -->
I know that the template works because if I pass in my parameter with the $currentPage/multinode arguement it works fine. Does anyone have a suggestion on how to get this to work?
If I recall, you can't pass in XML content through the Macro Parameter Syntax ( [#fieldName] ).
So, one way around this would be to adjust your MultiNodePickers to store as CSV rather than XML.
However, another idea which I think is better, is to instead pass in the Property Alias of the MNTP property to your macro, and retrieve the XML values from there. Something like this, assuming your MNTP property alias is 'pageCarouselItems':
<umbraco:Macro SelectedNodesProperty="pageCarouselItems" Alias="SetCatCarousel" runat="server"></umbraco:Macro>
Then in your macro:
<xsl:param name="selectedNodesProperty" select="/macro/SelectedNodesProperty" /><xsl:variable name="MultiNodeItem" select="$currentPage/* [not(@isDoc)][name() = $selectedNodesProperty]" />
On an unrelated note, if you haven't seen it alreayd check out Chriztian's blog post on Using the Multi-Node Tree Picker in XSLT - he has a very cool "helper" function that makes it super easy to iterate through MNTP items without needing to use umbraco.library:GetXmlNodeById. Looks like you're already on the right track using templates though.
Hope this helps,Tom
Oops - I just noticed that you were using the dollar sign to get the value recursively. In this case in your XSLT you could use something like:
<xsl:variable name="MultiNodeItem" select="$currentPage/ancestor-or-self::* [not(@isDoc)][name() = $selectedNodesProperty]" />
that works great! thank you!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted