Copied to clipboard

Flag this post as spam?

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


  • Claus Nedergaard 62 posts 104 karma points
    Feb 17, 2011 @ 13:44
    Claus Nedergaard
    0

    inline getmedia works..BUT does not validate against w3c - & issue

    Hi all,

    This puzzles my mind. Like the header says the inline xslt functions but it does not validate.

    heres the inline:

    xslt="concat('<img alt="" src="/umbraco/ImageGen.ashx?image=', umbraco.library:GetMedia({0},0)/umbracoFile,' &;width=350 &;constrain=true" />')"

     

    The problem is with this part: &;width=350 &;

    The error I receive upon validating is:

    1.  Line 61, Column 75: character "&" is the first character of a delimiter but occurred as data
    2. …co/ImageGen.ashx?image=/media/4668/forside.png &;width=350 &;constrain=true" />
    1. Warning Line 61, Column 87: character "&" is the first character of a delimiter but occurred as data
    2. …co/ImageGen.ashx?image=/media/4668/forside.png &;width=350 &;constrain=true" />

    Can anyone tell what's wrong.  I typed the & as & as ssen in the code up top. So what's up with this inline xslt stuff :-)

     

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 17, 2011 @ 14:09
    Tom Fulton
    0

    Hi,

    I think the problem is you are rendering a semicolon after the & sign

    It should output to …co/ImageGen.ashx?image=/media/4668/forside.png&width=350&constrain=true" /> instead of …co/ImageGen.ashx?image=/media/4668/forside.png &;width=350 &;constrain=true" />

    Try changing your inline XSLT to:

    xslt="concat('<img alt="" src="/umbraco/ImageGen.ashx?image=', umbraco.library:GetMedia({0},0)/umbracoFile,'&width=350&constrain=true" />')"

    I think that should work.

    That being said, I personally would favor using a generic macro to insert images instead of inline XSLT.  I normally create a macro called "Insert Image" that accepts fields like the field's alias, width, height, constrain, etc.  I think it's a bit cleaner than inline XSLT, you have more control, and you can re-use it easily.

    -Tom

  • Claus Nedergaard 62 posts 104 karma points
    Feb 17, 2011 @ 14:22
    Claus Nedergaard
    0

    Hi Tom,

     

    Thanks for replying :-)

    The semicolon I actually added because the validator choked on the w in witdth. So just for the sake of trying I added the semicolon and it worked well. So apparently w3c accepts this as valid markup. However I'm aware that's not how it's normally done.

    And I have to agree with you on the macro issue. I use macro as well and they certainly are easy to handle and they validate :-)

    I would just like for the inline solution to validate also because I often use inline getmedia as an 'qiuck'n dirty' way to present pictures instead of copying-up a macro.

  • Claus Nedergaard 62 posts 104 karma points
    Feb 22, 2011 @ 08:50
    Claus Nedergaard
    0

    Solved it by skipping the inline xslt and creating a macro instead

Please Sign in or register to post replies

Write your reply to:

Draft