Trying to display related links from the root node, on all pages.
I have a set of footer links which I want to be customizable by the user. There's six lists, with variable numbers of links in each list.
The related links datatype behaves exactly as I'd want it to as far as entering the content, but I can't get my xslt to display this correctly on any page other than the current page.
Here's the part of my code that's relevant - it's just the related links xslt macro code.
I have tried all kinds of paths in the for-each loop such as $currentPage/ancestor-or-self, and root etc. but I haven't got it working. As of now, the following code works on the homepage, but not on any of the subpages.
Alternatively, if I'm doing this really inefficiently any other ways would work too. Essentially I'm trying to achieve the same result as when you have a document field in a template, and set recursive to true.
thanks for any suggestions.
<xsl:variable name="propertyAlias" select="string('footerLinkOneList')"/> <xsl:template match="/"> in macro <!-- The fun starts here --> <ul> <xsl:for-each select="$currentPage/* [name() = $propertyAlias and not(@isDoc)]/links/link">
- It goes up through the ancestor axis and stops at the first one that has the 'footerLinkOneList' property, and then finds the link elements in there.
Trying to display related links from the root node, on all pages.
I have a set of footer links which I want to be customizable by the user. There's six lists, with variable numbers of links in each list.
The related links datatype behaves exactly as I'd want it to as far as entering the content, but I can't get my xslt to display this correctly on any page other than the current page.
Here's the part of my code that's relevant - it's just the related links xslt macro code.
I have tried all kinds of paths in the for-each loop such as $currentPage/ancestor-or-self, and root etc. but I haven't got it working. As of now, the following code works on the homepage, but not on any of the subpages.
Alternatively, if I'm doing this really inefficiently any other ways would work too. Essentially I'm trying to achieve the same result as when you have a document field in a template, and set recursive to true.
thanks for any suggestions.
<xsl:variable name="propertyAlias" select="string('footerLinkOneList')"/>
<xsl:template match="/">
in macro
<!-- The fun starts here -->
<ul>
<xsl:for-each select="$currentPage/* [name() = $propertyAlias and not(@isDoc)]/links/link">
Hi aaronb,
If I understand you correct, this should do it:
- It goes up through the ancestor axis and stops at the first one that has the 'footerLinkOneList' property, and then finds the link elements in there.
/Chriztian
Perfect, thanks Chriztian!
is working on a reply...