Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 21:27
    Sajid Riaz
    0

    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

  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 21:32
    Sajid Riaz
    0

    Hi again:

    my conversion of above:

    select="umbraco.library:GetMedia($imageRoot, 'true')/umbracoFile"


  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 22:15
    Sajid Riaz
    0

    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

  • Warren Buckley 2089 posts 4578 karma points MVP ∞ admin hq c-trib
    Jul 15, 2010 @ 22:22
  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 22:30
    Sajid Riaz
    0

    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

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jul 15, 2010 @ 22:31
    Dirk De Grave
    1

    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:

    <textarea><xsl:copy-of select="$currentPage/yourImage" /></textarea>

    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 

    <xsl:value-of select="umbraco.library:GetMedia($currentPage/yourImage, false())/Image/umbracoFile"/>

    (See this wiki entry for more info)

     

    Hope this helps.

    Regards.

    /Dirk

  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 22:40
    Sajid Riaz
    0

    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

  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 22:42
    Sajid Riaz
    0

    just checked the wiki...ok makes sense no need to answer.

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jul 15, 2010 @ 22:45
    Dirk De Grave
    0

    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

  • Sajid Riaz 142 posts 165 karma points
    Jul 15, 2010 @ 22:49
    Sajid Riaz
    0

    thanks Dirk, Warren...

  • 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.

Please Sign in or register to post replies