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 All
Trying to place an image on a page, using an xslt that I've used on other projects. Currently using Umbraco 4.5.2, set to use the legacy schema.
<xsl:template match="/"> <xsl:variable name="mediaNode" select="number($currentPage/data [@alias = 'bannerImage'])" /> <xsl:if test ="$mediaNode > 0"> <xsl:variable name="mediaItem" select="umbraco.library:GetMedia($mediaNode, 0)" /> <xsl:if test="string($mediaItem/data [@alias = 'umbracoFile']) != ''"> <img src="{$mediaItem/data[@alias='umbracoFile']}"> <xsl:attribute name="alt"> <xsl:choose> <xsl:when test="string($mediaItem/data[@alias='alttext']) != '' "> <xsl:value-of select="$mediaItem/data[@alias='alttext']" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$mediaItem/@nodeName" /> </xsl:otherwise> </xsl:choose> </xsl:attribute> </img> </xsl:if> </xsl:if> </xsl:template>
If I place the following in the template, the media node id is displayed on the page.
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage'], 0)/data [@alias = 'umbracoFile']"/>
Any ideas on how I can get the xslt to work?
Thanks in advance
Eddie
Got it working.
Could someone, respond so I can close the ticket.
Thanks
Eddie, maybe you could post the answer in here, so that if someone else in the future run's into a similar problem, they can find the solution in this post :)
/Kim A
Hi Kim
The posted xslt was fine, it turned out to be a typo on a custom media type where umbracofile, should have been umbracoFile.
Thanks for replying.
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
Get Media Item
Hi All
Trying to place an image on a page, using an xslt that I've used on other projects. Currently using Umbraco 4.5.2, set to use the legacy schema.
If I place the following in the template, the media node id is displayed on the page.
Any ideas on how I can get the xslt to work?
Thanks in advance
Eddie
Hi All
Got it working.
Could someone, respond so I can close the ticket.
Thanks
Eddie
Eddie, maybe you could post the answer in here, so that if someone else in the future run's into a similar problem, they can find the solution in this post :)
/Kim A
Hi Kim
The posted xslt was fine, it turned out to be a typo on a custom media type where umbracofile, should have been umbracoFile.
Thanks for replying.
Eddie
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.