Copied to clipboard

Flag this post as spam?

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


  • trfletch 595 posts 571 karma points
    May 31, 2012 @ 10:46
    trfletch
    0

    Cleaning up an XML feed, removing  

    Hi all,

    I have an Umbraco 4.7 site that has an XSLT that pulls through an XML feed, the problem is my XML feed needs a bit of cleaning up because it contains lots of   that I do not need. I have tried using the replace function but I think it doesn't work because the   are together like this   &nbps;

    Does anyone know how I can clean this up? This is an example of the feed:

    <p>Pink Floyd, McCartney, Daltrey<br /> thrashing their ghosts for  charity.<br /> And how we remember.<br /> How the pledges pour  in.<br /> <br /> (how the ghosts inside us all<br /> & nbsp;&nbsp;&nbsp;&nbsp; tap their feet,<br /> & nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  click their bones)<br /> &nbsp;<br /></p>

    This is the XSLT I have tried so far but it does not work:

    <xsl:variable name="briefText" select="umbraco.library:StripHtml(articleMainText)"></xsl:variable>
    <xsl:variable name="cleanText" select="umbraco.library:Replace($briefText, '&nbsp;', '')"></xsl:variable>

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    May 31, 2012 @ 10:54
    Chriztian Steinmeier
    1

    Hi trfletch,

    Because the way the ampersand works in XML, when you replace, you really need to write the replace like this:

    <xsl:variablename="cleanText"select="umbraco.library:Replace($briefText, '&amp;nbsp;', ' ')"/>

    If that doesn't work, we might need to look at what you get from the StripHtml() method ...

    EDIT: Forgot a semicolon - hope the edit works...

    /Chriztian

  • trfletch 595 posts 571 karma points
    May 31, 2012 @ 11:03
    trfletch
    0

    Hi Criztian,

    Thank you very much for the quick response, that worked perfectly.

    Regards
    Tony 

  • 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