![]() |
XML XSLT and PHP AddType Question
Hello,
I am trying to come up with a system to style sitemaps. I have everything working except I can't execute <?php> tags inside the .xslt document. I think that I am not enabling something in the .htaccess but, I just can't figure it out. Help would be very awesome. MODULES I have this extension loaded.... do I need others? php_xsl.dll Here are my various pages. .XML Code:
<?xml version="1.0" encoding="utf-8" ?>Code:
<?xml version="1.0" encoding="utf-8"?>Code:
AddType x-mapp-php5 .html .htm .xsl .xml |
I have had a similar problem. I have an XML file that is successfully transformed using an XSL stylesheet, but when I copy that XML into a PHP file (and echo out the tags starting with <? ) it does not transform the XML.
I'm running IIS, so I don't know if .htaccess will work for me. I have included examples below. The XSL stylesheet doesn't do much, I was just trying to do a case-in-point. Here is the first bit of the plain XML. Code:
<?xml version="1.0"?>PHP Code:
Code:
<?xml version="1.0" encoding="utf-8"?> |
I think I have a solution.
If you want to execute PHP in your XML or XSL documents, take the following steps.
Here is how you designate the mime-type PHP Code:
|
Thanks for the response. I still couldn't get it working though. I think I have given up on executing PHP within an xml/xsl document. My focus now is learning how to pass the xml and xsl files through a PHP file, then echo out the result...
Looks like I have some reading to do.:eek: Article on using PHP with XML and XSLT http://www.codewalkers.com/c/a/Misce...-XSLT-and-PHP/ XSLT @ PHP.net http://us.php.net/manual/en/book.xslt.php xslt_process @ PHP.net http://us3.php.net/xslt_process Download Sablotron XML toolkit http://www.gingerall.org/sablotron.html Download Expat XML Parser http://expat.sourceforge.net/ Article on using expat with PHP http://www.phpbuilder.com/columns/justin20000428.php3 |
I have found a solution for my application.:thumbsup:
Now I just need an auto-sitemap generator so that it is updated for search engines and my site without me doing anything....?? sitemap.php Code:
<html>....Code:
<?xml version="1.0" encoding="utf-8"?>Code:
<?xml version="1.0" encoding="UTF-8" ?> |
Thanks for your solution ..
I was looking at techniques for embedding php code in xhtml files using a technique like this .. for svg .. http://www.carto.net/papers/svg/samp..._svg_php.shtml this would require a new mime type to be created in Apache mime.types file .. let's call it .pxhtml .. similar to .psvg example In fact you could embed svg in an xform # ________________________________ # added new type pxhtml .. embedding php in xhtml files # http://www.456bereastreet.com/archiv...html_properly/ application/xhtml+xml xhtml xht pxhtml # ________________________________ But it seems that your code might offer a neater solution .. also see here .. accepting XForms in PHP http://www.ibm.com/developerworks/xm...php/index.html |
I have found myself trying to execute PHP tags within an XSL file again. I was told in another forum that this will do it.
In HTACCESS: AddHandler application/x-httpd-php5 .xsl It does not work for me. I would like to place a "php includes statement" for my menus. Code:
<ul>Code:
<?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/menu.php'); ?>What am I missing here? |
Looks like it is better to use the XSL include for this application.
I am still looking for a solution to executing PHP in these templates??....BUMP! This is the file that needs to be included. Code:
<?xml version="1.0" encoding="utf-8"?>File doing the including.... Code:
<?xml version="1.0" encoding="utf-8"?> |
| All times are GMT +1. The time now is 08:28 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.