954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

xml and php

Hello,
I was wondering if someone could point me in the right direction.
Is their anyway in php that I can change the outlook of an xsl file and include variables from my php script. I have an xsl file, I changed the file extension to php and it worked great in IE but gave me an error in firefox. so I changed it back to xsl. But now the php code will not work because of the file extension.

Dsiembab
Junior Poster
156 posts since Mar 2007
Reputation Points: 18
Solved Threads: 2
 

Have you included the MIME type header to the .php file so that its treated as xsl?

If not, in your .php file put:

[php]header('Content-Type: text/xml');[/php]

see: http://www.dpawson.co.uk/xsl/sect2/mimetypes.html
for others.

make sure you place the header() call before any output is made, or else see ob_start() in the php.net manual. http://php.net/ob_start/

If you would rather use an xsl extension you can use mod_rewrite in apache to have the .xsl resource handled by your .php file.

digital-ether
Nearly a Posting Virtuoso
Moderator
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
 

you know I am pretty new to php and I've been looking in the wrong places all day, Maybe it's the coffee and the cigarettes rotting my brain. thanks apprecaiate it. Dave

Dsiembab
Junior Poster
156 posts since Mar 2007
Reputation Points: 18
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You