Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 01, 2009 @ 13:22
    Simon Dingley
    0

    Problems using a Macro for Content Template

    I am building a macro for the purposes of allowing editors to input preformatted content into a site but I am having a few issues.

    The macro accepts 3 params:

    1. Description(textMultiLine)
    2. Image(mediaCurrent)
    3. ContentNode (contentPicker)

    My XSLT at the moment is as follows and really only for testing purpose:

    [code]
    ]>

    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"
    exclude-result-prefixes="msxml umbraco.library">











    [/code]

    At the moment I am getting the line break characters '\r\n' in the description string with output escaping on or off and I get no path for the image file however the image object is present since if I output $Image I get the string of data associated with the image.

    Am I missing something really obvious or just having a dumb day?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jun 01, 2009 @ 14:59
    Dirk De Grave
    0

    Hi,

    Seen this post? http://forum.umbraco.org/yafpostst8317Linebreaks-appear-in-parameters.aspx
    Might be the solution to the multiline parameter issue.

    As for the image stuff, would it help not to have a space between $Image and '/'?

    Hope this helps.

    Regards,
    /Dirk


  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 01, 2009 @ 15:07
    Simon Dingley
    0

    Thanks Dirk however it seems a bit extreme as I am guessing this will turn Tidy off across the site, I'm wondering if there is another way of implementing what I am trying to achieve?

    Removing the space after $Image had no effect - this is a strange one!

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 01, 2009 @ 15:19
    Simon Dingley
    0

    Just remembered that I have the following template saved from another project.
    [code]
    [/code]

    This gets around the line breaking issue.

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 03, 2009 @ 17:06
    Simon Dingley
    0

    So...no progress! What I don't understand is why this:

    [code][/code]

    Gives me this:

    [code][/code]

    And this:

    [code][/code]

    Gives me:

    [code][/code]

  • dandrayne 1138 posts 2262 karma points
    Jun 03, 2009 @ 17:38
    dandrayne
    0

    Mediacurrent is a bit... odd.

    try this

    [code]

    [/code]

    paramname and mediaCurrentAlias should be changed to your xslt parameter and macro paramater alias of course

  • dandrayne 1138 posts 2262 karma points
    Jun 03, 2009 @ 17:45
    dandrayne
    0

    should add, it's helpful to use to see the xml being returned from a given query, it helps to use this to construct the right xpath

    Also, for linebreaks in textboxes you can use

    [code]

    [/code]

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 03, 2009 @ 17:47
    Simon Dingley
    0

    I just solved it thanks to this post:

    http://forum.umbraco.org/yafpostst6295MediaCurrent-in-macro.aspx

    Mediacurrent certainly is odd and certainly confusing!

    Here is my final working XSLT:



    It won't render the image in the RTE though - another problem for another day!

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 03, 2009 @ 17:56
    Simon Dingley
    0

    [quote=ddrayne]Mediacurrent is a bit... odd.

    try this

    [code]

    [/code]

    paramname and mediaCurrentAlias should be changed to your xslt parameter and macro paramater alias of course

    [/quote]

    The problem is that this replaces all the line breaks with
    . There were no line breaks in the original copy it is the multi-line textbox that is assuming line breaks when it reaches the end of the line.

  • Simon Dingley 1431 posts 3332 karma points c-trib
    Jun 03, 2009 @ 17:57
    Simon Dingley
    0

    [quote=ddrayne]should add, it's helpful to use to see the xml being returned from a given query, it helps to use this to construct the right xpath

    Also, for linebreaks in textboxes you can use

    [code]

    [/code][/quote]

    The problem is that this replaces all the line breaks with
    . There were no line breaks in the original copy it is the multi-line textbox that is assuming line breaks when it reaches the end of the line

  • 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