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 Guys,
Could not figure this out...
I have a site with banners in almost each page. The banners are links.
I am using the urlPicker component for the links.
I need the image and the links to be recursive.
So far I've mannaged to make the image recursive and it works fine but I could do this to the link.
This is my current code:
<xsl:template match="/"><xsl:for-each select="$currentPage [@isDoc and string(umbracoNaviHide) != '1']"><div class="banner-wrap"> <a class="home_banner top_banner" href="{bannerLink/url-picker/url}"> <xsl:if test="bannerLink/url-picker/new-window[. = 'True']"> <xsl:attribute name="target">_blank</xsl:attribute> </xsl:if> <xsl:apply-templates select="ancestor-or-self::*[normalize-space(banner)][1]/banner" /> </a></div></xsl:for-each></xsl:template><xsl:template match="banner"> <img src="{.}" alt="{../bannerAlt}" title="{../bannerAlt}" /></xsl:template></xsl:stylesheet>
Would appreciate any help.
Thank you!
Hi Yael,
You can do pretty much the same as you do with the banner - the trick is to create a template to handle the url-picker property and then apply the template to the one that has a non-empty value in the <url> "subfield":
<xsl:template match="/"> <xsl:for-each select="$currentPage [@isDoc and string(umbracoNaviHide) != '1']"> <div class="banner-wrap"> <a class="home_banner top_banner"> <!-- Handle the link recursively --> <xsl:apply-templates select="ancestor-or-self::*[normalize-space(bannerLink/url-picker/url)][1]/bannerLink/url-picker" /> <xsl:apply-templates select="ancestor-or-self::*[normalize-space(banner)][1]/banner" /> </a> </div> </xsl:for-each> </xsl:template> <xsl:template match="banner"> <img src="{.}" alt="{../bannerAlt}" title="{../bannerAlt}" /> </xsl:template> <xsl:template match="url-picker"> <xsl:attribute name="href"> <xsl:value-of select="url" /> </xsl:attribute> <xsl:if test="new-window = 'True'"> <xsl:attribute name="target">_blank</xsl:attribute> </xsl:if> </xsl:template>
/Chriztian
Hi Chriztian,
It works!
Also, your solution is very clear and I will surely use it for other things.
Thank you very much for your help,
Yael
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
recursive link and image using urlPicker
Hi Guys,
Could not figure this out...
I have a site with banners in almost each page. The banners are links.
I am using the urlPicker component for the links.
I need the image and the links to be recursive.
So far I've mannaged to make the image recursive and it works fine but I could do this to the link.
This is my current code:
Would appreciate any help.
Thank you!
Hi Yael,
You can do pretty much the same as you do with the banner - the trick is to create a template to handle the url-picker property and then apply the template to the one that has a non-empty value in the <url> "subfield":
/Chriztian
Hi Chriztian,
It works!
Also, your solution is very clear and I will surely use it for other things.
Thank you very much for your help,
Yael
is working on a reply...