Copied to clipboard

Flag this post as spam?

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


  • Carlos 338 posts 472 karma points
    Jan 06, 2012 @ 23:19
    Carlos
    0

    XSLT XML output from tiny mce text editor. 4.5.X

    We are having issues with the output of our XML.  We are generating an XML sheet with XSLT and consuming it with Flash.  It seems that for some reason the text that is entered into our Rich Text Editor looks odd and adds line breaks in our XSLT even though the author has not put linebreaks into them.

    This is the output from looking at the XML

    <Description>
    <p>Ramses II. Genghis Khan. Benjamin Franklin. Some of
    the greatest names in history have been featured in spectacular
    temporary exhibitions, attracting millions of visitors to the
    Museum over the years. The new Temporary Exhibition Gallery
    connects with the existing Phipps temporary exhibition gallery,
    allowing for one expansive, dynamic space that greatly enhances the
    Museum's ability to bring blockbuster exhibitions to Denver. The
    new second gallery also may be used independently, allowing the
    Museum to present two different temporary exhibitions that appeal
    to different audiences.</p>
    </Description>


    Each of the line breaks creates odd breaks in the Flash text box.

    Is there a way to get rid of the line breaks in Umbraco using the Rich Text Editor. Or not?  Is there something in Flash we can do to get rid of this?  

    Thanks for the help in advance.


     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 06, 2012 @ 23:53
    Jan Skovgaard
    0

    Hi Carlos

    Have you tried using the umbraco.library:StripHtml() extension to remove the html entirely?

    /Jan

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 06, 2012 @ 23:56
    Chriztian Steinmeier
    1

    Hi Carlos,

    The output is perfectly valid XML, and if you were to copy the <p> element to an HTML page, you'd get perfectly good HTML from any browser; So to me, the problem you're having is rooted in the way Flash parses the XML. It's clearly not making HTML out of it - it's probably parsing it more like <pre> content.

    I'd check to see if the XML reader object (don't know what it's really called in ActionScript) has some kind of flag for whitespace handling during load/parse.

    Finally, you can try to do a replace in the XSLT that generates the above - if your text is in a bodyText property you can do something like this:

    <xsl:value-of select="translate(bodyText, '&#x0A;', ' ')" disable-output-escaping="yes" />

    instead of just outputting the bodyText property.

    But as I said: The XML is fine and the problem really is in the Flash component... but sometimes "fixing the wrong problem" is the only way to go.

    /Chriztian

  • Carlos 338 posts 472 karma points
    Jan 07, 2012 @ 00:27
    Carlos
    0

    Jan, we don't want to strip the HTML mainly because the author will be able to bold things, add italicize, etc. and Flash can do that by consuming HTML elements.
    (Whoops, just found out that bolding breaks in Flash. There are probably ways around it but too much effort and too little time. Can't wait until all browsers use HTML5)
    Switching to a multiline textbox. 

    Chriztian, The XML is valid.  The issue is the breaks in our output. I think it is the RTE or the TinyMCE itself.

    We tried getting rid of the whitespace in the Actionscript. That didn't work.

    Your "translate" worked to an extent.  Actually got rid of the spaces.  Nice trick, I will have to use that more often.

    On another note: I did notice there was an issue with when I changed my property from a rich text editor to a multiline text box with the text already in my RTE that the odd line breaks created by the RTE actually showed up in the multiline text box in the admin.  Give it a try. You will see it happen.  

    Thanks for the responses.  We are porbably just going to take the path of least resistance.  Plain text.

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 07, 2012 @ 10:18
    Jan Skovgaard
    0

    Hi Carlos

    Yeah, my bad. Read it wrong :)

    Have you tried doing this in the actionscript?

    txt.condenseWhite = true;
    txt.htmlText = myXML.myNode[0];
Please Sign in or register to post replies

Write your reply to:

Draft