Copied to clipboard

Flag this post as spam?

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


  • Chris 4 posts 24 karma points
    Dec 22, 2010 @ 06:55
    Chris
    0

    Inline XSLT not rendering image in Template

    I have 4 images I am using to try to display an image inline. (Code Below). I just upgraded to 4.5.2 today. this code did not exist prior to the upgrade. It's new content for our website.

    The field names are spelled correctly. double and triple checked.

    I tried hard coding the first link to no avail and you will see on the other three links are using the field names.

    One avenue I am walking down is whether XSLT needs to compile? If so what would stop the inline code from compiling just in time.   ANY HELP WOULD BE AWESOME... I am at a loss.

     

    Thanks,  Chris

    <asp:ContentPlaceHolder ID="mainDefault" runat="server">
            <div class="smallGalleryImage">
                <a href='<umbraco:Item field="featurelink1" runat="server"></umbraco:Item>'>
                <umbraco:Item runat="server" field="featureimage1" xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia(1911, true())/umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true"/>
                </a>
            </div>
                <div class="smallGalleryImage">
                <a href='<umbraco:Item field="featurelink2" runat="server"></umbraco:Item>'>
                <umbraco:Item runat="server" field="featureimage2" xslt="concat('&lt;img src=&quot;', umbraco.library:GetMedia({0},false())//umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true" />
                <a>
            </div>
            <div class="smallGalleryImage">
                <a href='<umbraco:Item field="featurelink3" runat="server"></umbraco:Item>'>
                <umbraco:Item runat="server" field="featureimage3" xslt="concat('&lt;img src=&quot;', umbraco.library:GetMedia({0},false())//umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true" />
                <a>
            </div>
            <div class="smallGalleryImage">
                <a href='<umbraco:Item field="featurelink4" runat="server"></umbraco:Item>'>
                <umbraco:Item runat="server" field="featureimage4" xslt="concat('&lt;img src=&quot;', umbraco.library:GetMedia({0},false())//umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true" />
                <a>
            </div>
           
        </asp:ContentPlaceHolder>

  • Fredrik Esseen 610 posts 906 karma points
    Dec 22, 2010 @ 08:59
    Fredrik Esseen
    1

    Hi Chris!

    If I compare your code with the wiki page with the example of inline xslt with the new schema I can see a difference:

    Your code:

    <umbraco:Item runat="server" field="mediaItem" xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia({0},false())//umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true" />

    The example:

    <umbraco:Item runat="server" field="mediaItem" xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia({0}, true())/umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true"/>

    You use false insteas of true and theres two slashes before umbracoFile.

    Can this be the issue?

    Im referrering to this page:

    http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt

  • Chris 4 posts 24 karma points
    Dec 22, 2010 @ 18:18
    Chris
    0

    Thanks for the Reply!... I made the changes you outlined, thanks for identifying the error in my syntax. It is still not rendering anything in the img tag.

     

    Here is the HTML output I get from the code.

                       <div class="smallGalleryImage">
                <a href=''>
                <img src="" />
    
              </a>
            </div> 
                <div class="smallGalleryImage">
                <a href='http://www.myurl.ca'>
                <img src="" />
                <a>
            </div> 
            <div class="smallGalleryImage">
                <a href='http://www.myurl.ca'>
                <img src="" />
    
              <a>
            </div> 
            <div class="smallGalleryImage">
                <a href='http://www.myurl.ca'>
    
                <a>
            </div> 
    
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 22, 2010 @ 18:25
    Tom Fulton
    0

    Hi Chris,

    That code should work, I just tested on my end and it's fine.  You mentioned you just upgraded to 4.5.2 - can you try resaving one of the images that's not displaying?  There was a recent issue where images needed to be republished after an upgrade before they would show up.

    -Tom

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 22, 2010 @ 18:29
    Tom Fulton
    0

    If that does turn out to be the issue, you can visit hte following URL to republish all media:

    /umbraco/dialogs/republish.aspx?xml=true

    Also, it might be cleaner to use a generic macro for inserting the image instead of inline xslt.  Simple example here

  • Chris 4 posts 24 karma points
    Dec 23, 2010 @ 04:52
    Chris
    0

    Thanks Tom!

    I will give it a try.

     

    Thanks

     

    Chris

  • MartinB 411 posts 512 karma points
    Feb 27, 2011 @ 20:35
    MartinB
    0

    Hi Froad

    Your inline XSLT worked great for me, thanks!

Please Sign in or register to post replies

Write your reply to:

Draft