Only returns the image from "One", but three times with this xslt. I'm going nuts here, i think i've read every post in here and fumbled around with xpath, which clearly is my problem as i can get the first image to output 3 times.
What is missing since i dont get the images from Two and Three?
Xslt returns first child nodes image 3 times
Hi there
This structure:
Homepage
- Highlights
- One
- Two
- Three
Only returns the image from "One", but three times with this xslt. I'm going nuts here, i think i've read every post in here and fumbled around with xpath, which clearly is my problem as i can get the first image to output 3 times.
What is missing since i dont get the images from Two and Three?
Hi Martin,
You're using the same mediaId for all the childpages (you're setting it as a top-level variable) - try this instead:
<xsl:template match="/"> <xsl:variable name="highlightID" select="1116" /> <xsl:variable name="maxItems" select="3" /> <xsl:for-each select="umbraco.library:GetXmlNodeById($highlightID)/*[@isDoc][not(umbracoNaviHide = 1)]"> <xsl:if test="position() <= $maxItems"> <div class="hightlight"> <h4><xsl:value-of select="highlightHeader"/></h4> <xsl:if test="normalize-space(highlightImage)"><!-- Check if an image was picked --> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(highlightImage, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img src="{$mediaNode/umbracoFile}" height="{$mediaNode/umbracoHeight}" width="{$mediaNode/umbracoWidth}" /> </xsl:if> </xsl:if> <a href="{umbraco.library:NiceUrl(@id)}" class="highlightLink"> <xsl:value-of select="highlightLinkText"/> </a> </div> </xsl:if> </xsl:for-each> </xsl:template>/Chriztian
If i hadn't already made a hole in my door 3 hours ago i would have done so now. Jeeeeeez!!
I thought that the mediaID got different through the loops and couldn't understand why my textareas kept showing the same id lol.
Chriztian you're a true lifesaver and i'm such a dork! Gah....
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.