I'm using 4.5.2 and the new Schema and want a list of news items with their images on the homepage. I've created the following xslt which displays the news title but I cannot get the associated media file to render. The Image is linked via the media picker and also cropped using the Image Cropper data type, therefore I need the image path followed by the suffix '_banner.jpg' which is the associated crop name.
I would appreciate any help.
Eddy
Xslt:
<ul id="newscarousel" > <!-- This selects our data and spits it out in the following format once for each entry found --> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/descendant::NewsItem [@isDoc and string(umbracoNaviHide) != '1']"> <!-- This sorts the results by date decending --> <xsl:sort select="@createDate" order="descending" /> <!-- This limits the articles presented by the maxItem variable --> <xsl:if test="position() <= $maxItems"> <li> <!-- this prints all media nodes --> <img src="{umbraco.library:GetMedia(./bannerImage, false())/umbracoFile}" /> <div id="carouseltitle"> <h3><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName" /></a></h3> </div> </li> </xsl:if> </xsl:for-each> </ul>
GetMedia xslt on news list
I'm using 4.5.2 and the new Schema and want a list of news items with their images on the homepage. I've created the following xslt which displays the news title but I cannot get the associated media file to render. The Image is linked via the media picker and also cropped using the Image Cropper data type, therefore I need the image path followed by the suffix '_banner.jpg' which is the associated crop name.
I would appreciate any help.
Eddy
Xslt:
Here is the xml from one of the news items:
I'm one step closer. Thanks to some tips from Sascha here.
Now I just need to insert the crop name '_banner' into the file path.
Hi eddy,
You can try to concat your img tag
Thanks Fuji. I couldn't get the Concat to work but the Umbraco TV episode on the image cropper data type helped me out in the end. Here's what worked:
Eddy
Hey Eddy, at least you got it working.
is working on a reply...