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=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.
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?!?
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 :-)
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.
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]
Nevermind, I managed to get it working by changing the template like this:
[code]<%@ Master Language="C#" AutoEventWireup="false" %>
<%
Response.ContentType = "text/xml";
%>
[/code]
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.
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
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
Setting the contenttype on the template instead of in the xslt can make it a bit more readable:
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.
in v4 you can use another way to set the contenttype:
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
[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.
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
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 :-)
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
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 :)
If you add a line break you ask for a line break - Umbraco is a gentleman doing what he's told :-)
It certainly is, it doesnt f-up your markup in anyway and like you said does what it is told.
is working on a reply...