I need to output view in XML format. I'm able to format all the fields and such so i get the whole XML in $page['content'].
Just can't figure out how to remove everything what is before and after it (HTML head, body tag and such).

Comments

I'd use template suggestions and override the page.tpl.php etc. Though, it might be easier using a module like this http://drupal.org/project/views_data_export

===================
www.web-assistant.co.uk

Data export module exports a file through a page -> useless in my case. I need clean XML directly when i go to http://mypage.com/myxml
Also how i get rid of everything whats around the stuff rendered in page--myxml.tpl.php?

Have you tried Views Data Export, it produces an XML "page" (not sure why you are using a page-myxml.tpl.php file)

I'm pretty sure you can view the XML as a page in that module.

===================
www.web-assistant.co.uk

OMG you are right, it's just "hidden" under "Batched export:" option.
Thanks you.

PS: anyway would like to know how to strip those things around "content". :)

Your page.tpl.php would output just $content and you would need a custom html.tpl.php (see http://drupal.org/node/1041768#comment-4011104, you will want to override based in path though). In your custom html.tpl.php either output nothing or output XML wrappers.

Ok, so now in template.php i have

function yourthemename_preprocess_html(&$variables) {
  if (machesMyViewCondition) {
$variables['theme_hook_suggestions'][] = 'html__myhtml';
  }
}

which loads html--myhtml.tpl.php
<?php print "<?xml version =1.0 encoding=utf-8?>";
print $page; ?>

and in page--myview.tpl.php is
<?php
print render($page['centent']);
?>

still i'm getting some wrapers around it and content of other regions :(

Are you sure your templates are being used (did you clear the theme registry)?

They're not from the Views templates are they?

===================
www.web-assistant.co.uk