If you're unsure about how to get to a certain property or node, use a xsl-copy statement to get the actual xml output from GetMedia(). If you put this in a textarea, you soon find out what could be wrong:
I don't think you need to pass in 'true' as the 2nd param to GetMedia, as this will return the complete media structure below the selected media item (and don't think you need anything but the selected media)
Anyway, to get to the actual image that has been selected using a media picker, you'll need to use
As explained in that wiki post (both Warren and myself have posted some links), v4.5 has introduced a complete new xml schema, both for content and media... so, yes, this is new in v4.1 (which is renamed to 4.5)
convert xslt from v4 to v5 4.5
hello everyone,
can some one help me.
I want to convert:
select="umbraco.library:GetMedia($imageRoot, 'true')/node/data[@alias='umbracoFile']"
to the 4.5 version.
thanks
>sajid
Hi again:
my conversion of above:
select="umbraco.library:GetMedia($imageRoot, 'true')/umbracoFile"
Hi,
I still haven't got this working:
<xsl:if test="string($currentPage/yourImage) != '-1' ">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/yourImage, 'true')/umbracoFile"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
I have a property on the doc type named youImage of type mediapicker. In the content page i've selected an image for this property
so i am correct in thinking the above is from current page get the youImage property and get its path?
is there a guide any where that shows the old way and the new way of doing things in xslt.
things like getting images, loops if statement etc etc
>sajid
Hi Saijd,
Here are two great WIKI posts on the new XML schema
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema
Warren :)
warren thanx buddy...
I checked these 2 out already thanx for posting them.
Is there any more docs which go thru more changes like if statement, loops, and other common v4 xslt translations etc etc.
i'm having problems with:
<xsl:if test="string($currentPage/yourImage) != '-1' ">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/yourImage, 'true')/umbracoFile"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
thanx for answering so quickly.
>sajid
Hi Sajid,
If you're unsure about how to get to a certain property or node, use a xsl-copy statement to get the actual xml output from GetMedia(). If you put this in a textarea, you soon find out what could be wrong:
I don't think you need to pass in 'true' as the 2nd param to GetMedia, as this will return the complete media structure below the selected media item (and don't think you need anything but the selected media)
Anyway, to get to the actual image that has been selected using a media picker, you'll need to use
(See this wiki entry for more info)
Hope this helps.
Regards.
/Dirk
Dirk,
Many Thanks you've done it..
But can you tell me where did the Image come from below: was this also in v4? or is this new.
<xsl:value-of select="umbraco.library:GetMedia($currentPage/yourImage, false())/Image/umbracoFile"/>
thanks again
>sajid
just checked the wiki...ok makes sense no need to answer.
Hi Sajid,
As explained in that wiki post (both Warren and myself have posted some links), v4.5 has introduced a complete new xml schema, both for content and media... so, yes, this is new in v4.1 (which is renamed to 4.5)
Cheers,
/Dirk
thanks Dirk, Warren...
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.