I've been puzzling over this for hours. I hope someone here can help me out.

I'm building a site that takes data from a MYSQL database and then dynamically
builds XML strings with PHP. This is then fed into Flash. So far, so good.
Everything's working.

Next I want to repurpose that XML (built by PHP) with XSL into a non-Flash
version of the site. Here's where I'm running into trouble.

When I apply the "XSL Transformation" behavior to a page and set the XML
source to my PHP page (which to be clear writes an XML string) I get the
following error:

MM_XSLTransform error.
../data/home.php is not a valid XML document.
XML parser error 4: not well-formed (invalid token) in file %s

<?php header('Content-Type: application/xml'); ?>
<?php require_once('../Connections/delutzMYSQL.php'); ?>
<?php
mysql_select_db($database_delutzMYSQL, $delutzMYSQL);
$rs_welcome = mysql_query("SELECT * FROM tbl_welcome ORDER BY wel_date DESC
LIMIT 1");
//
//
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<homePage>";
// WELCOME --
echo "<welcome>";
$welcomeRow = mysql_fetch_array($rs_welcome);
$WelcomeText = str_replace("
", "", $welcomeRow["wel_text"]);
@printf ("<![CDATA[%s]]>", $WelcomeText);
echo "</welcome>";
// --WELCOME
echo "</homePage>";
//
//
mysql_free_result($rs_welcome);
?>


The source of my start page looks like this:
<?php
//XMLXSL Transformation class

require_once('../../../../includes/MM_XSLTransform/MM_XSLTransform.class.php');
?>
<?php
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML("../data/home.php");
$mm_xsl->setXSL("index.xsl");
echo $mm_xsl->Transform();
?>

My PHP file looks like this:
<?php header('Content-Type: application/xml'); ?>
<?php require_once('../Connections/delutzMYSQL.php'); ?>
<?php
mysql_select_db($database_delutzMYSQL, $delutzMYSQL);
$rs_welcome = mysql_query("SELECT * FROM tbl_welcome ORDER BY wel_date DESC
LIMIT 1");
//
//
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<homePage>";
// WELCOME --
echo "<welcome>";
$welcomeRow = mysql_fetch_array($rs_welcome);
$WelcomeText = str_replace("
", "", $welcomeRow["wel_text"]);
@printf ("<![CDATA[%s]]>", $WelcomeText);
echo "</welcome>";
// --WELCOME
echo "</homePage>";
//
//
mysql_free_result($rs_welcome);
?>


It works fine when I set the XML source to a "*.XML" file, but fails when I
set it to my ".PHP" file.

I'm hoping that someone here could either point out an error in my code, show
me the right way to accomplish this, or tell me about an alternate technique.

thanks a lot,
-=Mason