Nothing is showing up using this in my XSLT, for some reason. I pull this through into a webpage using <umbraco:Macro Alias="ListNewServices" runat="server"></umbraco:Macro> and it pulls the title and the content fine but nothing at all seems to go through for the image.
You're looping through the children of $currentPage, but when you pick the image you're taking it from a property on $currentPage - is that right? If you mean to take it from the current page in the loop, here's how:
The macro is on "Services" and it pulls through any new items which appear beneath it, so at the mo it has 3 services (a title, some content, and an image on each one). So I am pulling the data from the child pages of the Services page, to that page if that makes sense?
get media displaying nothing
Nothing is showing up using this in my XSLT, for some reason. I pull this through into a webpage using <umbraco:Macro Alias="ListNewServices" runat="server"></umbraco:Macro> and it pulls the title and the content fine but nothing at all seems to go through for the image.
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="title">
<div style="float:left;width:1000px;margin-left:-40px;">
<!--<xsl:value-of select="iconServices" disable-output-escaping="yes"/>-->
<h2><xsl:value-of select="title" disable-output-escaping="yes"/></h2>
</div>
</div>
<div class="content" style="float:left;width:1000px;margin-left:-40px;">
<xsl:variable name="mediaId" select="number($currentPage/*[name() = 'iconServices'])" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img src="{umbraco.library:GetMedia(image, 0)/umbracoFile}" />
</xsl:if>
</xsl:if>
<h3><xsl:value-of select="content" disable-output-escaping="yes"/></h3>
<hr/>
</div>
</xsl:for-each>
Pat,
try replacing the 0 with false() if that wont work try true()
Regards
Ismail
Hi,
Tried that but no change. There is nothing at all appearing even an empty space.
Hi Pat,
You're looping through the children of $currentPage, but when you pick the image you're taking it from a property on $currentPage - is that right? If you mean to take it from the current page in the loop, here's how:
/Chriztian
Hi Chriztian,
My tree is like this:
Services
- Service 1
- Service 2
- Service 3 etc
The macro is on "Services" and it pulls through any new items which appear beneath it, so at the mo it has 3 services (a title, some content, and an image on each one). So I am pulling the data from the child pages of the Services page, to that page if that makes sense?
Thanks Chriztian, that has done the trick perfectly. Many thanks.
If you don't want to use library.GetMedia you should have a look at DAMP. It can store the full media xml which makes it easier to use in XSLT.
Jeroen
is working on a reply...