Page 1 of 1

XSL Transform Error: "Start tag expected, '<' no

Posted: Wed Mar 29, 2006 11:46 am
by mutatron
I'm using PHP5, trying to learn how to do an xsl transform on output from a php script. I've tested it with a static xml file, so I know that part works. When I try to do

Code: Select all

$domdocument->load('phpscript.php');
I get the error

Code: Select all

Start tag expected, '<' not found in /html/phpscript.php, line: 37
Line 37 is the line after the last line in the script. What's up with that? I've checked the output of phpscript.php, it gives well-formed xml, beginning with

Code: Select all

<?xml version="1.0"?><root>
What am I missing?

Posted: Wed Mar 29, 2006 11:50 am
by feyd
I believe it loads the file directly. As in, it's not executed by php prior to the data being loaded into the class.

Posted: Wed Mar 29, 2006 12:19 pm
by mutatron
Ack! So then it's taking everything between the <? and the ?> as a comment or something, and then expecting the xml to start after the ?>. That's kind of sucky.

Okay, now I've tacked my xsl transform script onto the end of my xml production script, and then used loadXML to load from the string output, and it works. Should have thought of that before! Just going by someone else's examples.

Still, wouldn't you think php would let you load from a script so it would be dynamic? Well, it is dynamic now, but I'd rather be able to separate the transform script from the data gathering script.