Forum Moderators: open
This is what I use today:
<xsl:transform version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" omit-xml-declaration="yes" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" encoding="UTF-8"/>
:
:
<xsl:template mode="newpage" match="*">
<xsl:param name="filename">
:
</xsl:param>
<xsl:document href="{normalize-space($filename)}">
<html>
<xsl:apply-templates select="." mode="skel.header">
:
:
My generated php files come out as:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
:
:
<?php include 'authorizeUser.php' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
:
:
[edited by: eelixduppy at 11:20 pm (utc) on Mar. 11, 2009]
[edit reason] disabled smileys [/edit]
remove the <xsl:output> element, or change its method attribute. When you start injecting <?stuff?>, You're not outputting HTML any more :)
try putting this in your XSLT
<xsl:text>
<![CDATA[
<?php print("test"); ?>
]]>
</xsl:text>
when you do output the php, you'll need to ensure that the output is being parsed by the PHP engine. depending on when/how the XML->XSLT->output is being done, you might just end up with PHP code rendered on the page. Do please report back here if you get it working!