Copied to clipboard

Flag this post as spam?

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


  • trfletch 598 posts 604 karma points
    Sep 27, 2010 @ 17:31
    trfletch
    0

    RSS feed with no images

    Hi All,

    I have an umbraco 4.5.2 site that is running the old XSLT schema. I want to create an RSS feed that shows the first 200 characters of a certain type of page but without any images. Is this possible using XSLT and if so how would go about doing it? I am using the RSS feed XSLT template and I know how to only show 200 characters so the main question is how can I show only text and no images, most of the pages start with an image or have one or two images within the first 200 characters (i.e. the images are within a rich text editor document property that I am pulling in). Thanks in advance for any help

  • jc 64 posts 101 karma points
    Sep 27, 2010 @ 17:40
    jc
    0

    You can use the StripHtml method in the umbraco library:

    <xsl:value-of select="umbraco.library:StripHtml(data [@alias = 'MyRichTextArea'])"/>
  • trfletch 598 posts 604 karma points
    Sep 27, 2010 @ 17:50
    trfletch
    0

    No sure why this got double posted! Thanks for the response, I am now using the following to get 350 characters, is there a nicer way of doing this or is it ok using two variables like I am? Also is it possible to finish at the end of a word or better still the end of a sentence as opposed to cutting it off half way through a word?

     <xsl:variable name="mainTextNoHtml" select="umbraco.library:StripHtml(data [@alias='nonmemberstext'])"/>
     <xsl:variable name="mainTextNoHtmlTruncate" select="umbraco.library:TruncateString($mainTextNoHtml,350,'')"/>
             <xsl:value-of select="concat('&lt;![CDATA[ ', $mainTextNoHtmlTruncate,']]&gt;')" disable-output-escaping="yes"/>...
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 27, 2010 @ 17:58
    Sebastiaan Janssen
    0

    Looks good to me!

    I created an XSLT extension the other day that would just find the second dot in a string (which would be the end of the second sentence) and then returns that. You could easily do it like: find the first dot after 350 characters.

  • trfletch 598 posts 604 karma points
    Sep 27, 2010 @ 18:14
    trfletch
    0

    Don't suppose you would be willing to share the code you used to do that? That sounds like the perfect solution.

Please Sign in or register to post replies

Write your reply to:

Draft