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
Hi,
I'm new to xslt. I have the following xslt macro:
<xsl:template match="/"><!-- start writing XSLT --> <ul class="footer-broker-list"> <xsl:for-each select="$currentPage//broker [@isDoc]"> <li> <a> <xsl:attribute name="href"> <xsl:value-of select="umbraco.library:NiceUrl(current()/@id)"/> </xsl:attribute> <xsl:attribute name="style"> text-decoration: none; </xsl:attribute> <xsl:value-of select="./brokerName" /></a></li> </xsl:for-each> </ul></xsl:template>
This works well on the home page, but does not display anything when put in child pages.
What do I need to modify in order to have it work anywhere?
Thank you!
you need change the select "$currentPage:ancestor-or-self//broker"
Thanks for the reply, but this give me an error:
"Prefix 'currentPage' is not defined."
i'm sorry try this $currentPage:ancestor-or-self::*//broker
Nope :) Still not it.
whats the error you're getting now?
Did you try $currentPage/ancestor-or-self::*//broker [@isDoc] ?
Pnima
Thanks Pnima. That did the trick.
Glad to hear it solved your problem..
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
macro not working when in child node
Hi,
I'm new to xslt. I have the following xslt macro:
<xsl:template match="/">
<!-- start writing XSLT -->
<ul class="footer-broker-list">
<xsl:for-each select="$currentPage//broker [@isDoc]">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(current()/@id)"/>
</xsl:attribute>
<xsl:attribute name="style">
text-decoration: none;
</xsl:attribute>
<xsl:value-of select="./brokerName" /></a></li>
</xsl:for-each>
</ul>
</xsl:template>
This works well on the home page, but does not display anything when put in child pages.
What do I need to modify in order to have it work anywhere?
Thank you!
you need change the select "$currentPage:ancestor-or-self//broker"
Thanks for the reply, but this give me an error:
"Prefix 'currentPage' is not defined."
i'm sorry try this $currentPage:ancestor-or-self::*//broker
Nope :) Still not it.
whats the error you're getting now?
Did you try $currentPage/ancestor-or-self::*//broker [@isDoc] ?
Pnima
Thanks Pnima. That did the trick.
Glad to hear it solved your problem..
Pnima
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.