Copied to clipboard

Flag this post as spam?

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


  • Paul Marden 233 posts 335 karma points c-trib
    Jul 18, 2011 @ 18:04
    Paul Marden
    0

    HTML in Parameters in Macro Container

    Guys,

    I'm trying to enable users to pass some HTML into an XSLT which editors can call from a Macro Container datatype.  If I setup either a Text or TextMultiLine field on the macro, when I pass any HTML into the macro it seems to screw around with the HTML and not output properly.

    So the following is the XSLT Macro

    <xsl:variable name="title" select="/macro/title"/>
    <xsl:variable name="bodyText" select="/macro/bodyText"/>
        
    <xsl:template match="/">
      <div class="heading">
          <strong><span><xsl:value-of select="$title"/></span></strong>
      </div>
      <ul><li><xsl:value-of select="$bodyText" disable-output-escaping="yes"/></li></ul>
    </xsl:template>

    So when I don't put any HTML into the bodyText parameter I get output like this....

                <div class="section">
                  <div class="heading"><strong><span>Contact us</span></strong></div><ul><li>For jobs in Risk: Call: 0207 601 6000 Email: [email protected]</li></ul>
                </div>
    

    ...totally what I was expecting.

    When I stick a single <br/> tag into bodyText like this....

    For jobs in Risk:<br/>Call: 0207 601 6000 Email: [email protected]

    ...then I get output like this....

     

                <div class="section">
                  <div class="heading"><strong><span>Contact us</span></strong></div><ul><li /></ul>Call: 0207 601 6000 Email: [email protected]"  />
                </div>
    

     


  • Paul Marden 233 posts 335 karma points c-trib
    Jul 18, 2011 @ 18:21
    Paul Marden
    0

    Should have mentioned this is Umbraco 4.7.0

  • Dan 1250 posts 3747 karma points admin c-trib
    Jul 18, 2011 @ 21:09
    Dan
    0

    Does the same happen if you insert non-self-closing HTML (e.g. a <p>some text wrapped by a paragraph</p>) rather than a self-closing tag like <br />?

  • 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