Copied to clipboard

Flag this post as spam?

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


  • Ove Andersen 435 posts 1541 karma points c-trib
    Jan 16, 2009 @ 09:15
    Ove Andersen
    1

    XSLT RSS Feed and umbraco v4

    I am trying to make an RSS Feed on my page using the code below.
    The problem is that the resulting page is not recognized as an rss feed.

    Any idea how to make this page recognizable as an rss feed?

    [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"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    exclude-result-prefixes="msxml umbraco.library">


















    [/code]

  • Ove Andersen 435 posts 1541 karma points c-trib
    Jan 16, 2009 @ 09:26
    Ove Andersen
    0

    Nevermind, I managed to get it working by changing the template like this:
    [code]<%@ Master Language="C#" AutoEventWireup="false" %>

    <%
    Response.ContentType = "text/xml";
    %>

    [/code]

  • Lesley 284 posts 143 karma points
    Jan 16, 2009 @ 14:16
    Lesley
    0

    You should also think about putting something like this:
    [code]

    [/code]
    ... in your template's , so that smart browsers will recognise the feed and put the orange rss logo in the address bar.

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Feb 22, 2009 @ 12:10
    Warren Buckley
    0

    Hello all. I am opening this thread back up.
    I am using the RSS XSLT template inside umbraco which uses this line for mime type stuff.

    [code][/code]

    However in my master page if I have the macro on a new line it does not work.
    For example

    [code]

    [/code]

    but if I change it to all one line as the

  • Comment author was deleted

    Feb 22, 2009 @ 12:30

    It looks like this occurs once the contenttype is set to text/xml.

    Not sure if there is a fix for this (other then placing it directly after the content tag).

  • Comment author was deleted

    Feb 22, 2009 @ 12:36

    Setting the contenttype on the template instead of in the xslt can make it a bit more readable:

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Feb 22, 2009 @ 13:00
    Morten Bock
    0

    I guess the problem is that for valid xml, the xml declaration MUST be on the very first line. And it seems that the linebreak in your template creates a blank line at the top of the output.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Feb 22, 2009 @ 13:01
    Peter Dijksterhuis
    0

    in v4 you can use another way to set the contenttype:

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Feb 22, 2009 @ 14:02
    Warren Buckley
    0

    Thanks all guys, the best solution so far is Tim's

    [code]

    [/code]

    but to me it's still not perfect. If any of you come up with any other ideas let me know.

    Thanks,
    Warren

  • Daniel Lindstrom 454 posts 271 karma points
    Feb 22, 2009 @ 15:02
    Daniel Lindstrom
    0

    [quote=mortenbock]I guess the problem is that for valid xml, the xml declaration MUST be on the very first line. And it seems that the linebreak in your template creates a blank line at the top of the output.[/quote]

    Off topic, but related:
    OK, maybe explains a similar issue I had the other day on a 3.0.6 site. I used the change mime type macro from the utilities package, to change the mime type to text/xml.

    If I put the macro on a new line in the template, it broke the whole xml output and the response came back empty.

    Once I deleted the line break it worked.

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Feb 22, 2009 @ 15:05
    Warren Buckley
    0

    Yeh i understand the blank line issue Daniel. But I am intrested to see if there is a way around it somehow to ingore the first line break or something?!?

    Warren

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Feb 22, 2009 @ 16:26
    Niels Hartvig
    0

    Its drop dead simple: Make sure you don't have linebreaks in your template code. Umbraco doesn't insert linebreaks by it self. Notice this includes linebreaks after asp.net controls and headers too :-)

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Feb 22, 2009 @ 16:27
    Niels Hartvig
    0

    An then listen to peterd and use the contenttype control to change the type. Code directly on a template is horible and to avoid at any cost

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Feb 22, 2009 @ 18:00
    Warren Buckley
    0

    OK i will just have to agree this is the right way. I just thought their maybe a prettier way for people to read the code in the masterpage, as having on one line is not the easiest/prettiest way in my opinion.



    thanks everyone :)

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Feb 22, 2009 @ 20:39
    Niels Hartvig
    0

    If you add a line break you ask for a line break - Umbraco is a gentleman doing what he's told :-)

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Feb 23, 2009 @ 09:37
    Warren Buckley
    0

    It certainly is, it doesnt f-up your markup in anyway and like you said does what it is told.

Please Sign in or register to post replies

Write your reply to:

Draft