also actually I want to modify relatedlinks xslt. I want to access media pickker image field (field name-nodeImage) of the nodes which are added in related links. So that for all links, link title along with image(media picker) of that particular page are shown as list.
so how can I access that node? as I just have related link urls in the xslt.
As Pasang mentioned the code is the same for all versions 4.5+ so that should work.
What isn't working about Pasang's code - are you getting an error when saving, not getting an <img> tag back or getting an <img> tag with a broken image?
Are you sure the current page has a property with the alias NodeImage? Usually the property names start with lowercase ie nodeImage.
Also, you can apply the same practice to Related Links, but instead of $currentPage you can get the "picked" page using umbraco.library:GetXmlNodeById(), ex:
<!-- inside your related links for-each loop.... --> <xsl:variable name="pickedPage" select="umbraco.library:GetXmlNodeById(./@link)"/> <!-- grabs the picked page by accessing the link attribute from your related links xml --> <xsl:if test="not($pickedPage/error)"> <!-- makes sure the page still exists --> <xsl:if test="number($pickedPage/NodeImage) > 0"> <img src="{umbraco.library:GetMedia($pickedPage/NodeImage,false())/umbracoFile}" alt="image"/> </xsl:if> </xsl:if>
accessing media picker in xslt in umbraco 4.7
I am using 4.7 version.
How can I access media picker image that is selected in xslt?
Hi,
Check out this blog post from Lee Kelleher which has a code sample: How to use umbraco.library GetMedia in XSLT for Umbraco v4.5
-Tom
Tom , but I am using 4.7.0. So I need code for that.
Hello,
The example in which Tom provide works on 4.7.0 also. Umbraco 4.5+ is based on new schema.
Here is one more example:
the siteLogo is the media picker property name
Thanks
PTamang
thanx...
But it is not working...
see the code below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:fulltextsearch.search="urn:fulltextsearch.search" xmlns:fulltextsearch.helper="urn:fulltextsearch.helper"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets fulltextsearch.search fulltextsearch.helper ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:if test="number($currentPage/NodeImage) > 0">
<img src="{umbraco.library:GetMedia($currentPage/NodeImage,false)/umbracoFile}" alt="image"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
also actually I want to modify relatedlinks xslt. I want to access media pickker image field (field name-nodeImage) of the nodes which are added in related links. So that for all links, link title along with image(media picker) of that particular page are shown as list.
so how can I access that node? as I just have related link urls in the xslt.
Hi,
As Pasang mentioned the code is the same for all versions 4.5+ so that should work.
What isn't working about Pasang's code - are you getting an error when saving, not getting an <img> tag back or getting an <img> tag with a broken image?
Are you sure the current page has a property with the alias NodeImage? Usually the property names start with lowercase ie nodeImage.
Also, you can apply the same practice to Related Links, but instead of $currentPage you can get the "picked" page using umbraco.library:GetXmlNodeById(), ex:
-Tom
hi Tom,
yes u r right.... propertyname is nodeImage .... and also thank you for giving code of pickedpage... it is not showing image
is working on a reply...