Your XSL is not suitable for what you want.
Your output is not XML or HTML but plain text.
Try to use
<xsl:output method = "text"/> to generate textual output. And don't think
you mast use CDATA sections in your XSL.
Sergiu
-----Original Message-----
From: Ard Schrijvers [mailto:Ard(_at_)hippo(_dot_)nl]
Sent: 23 ianuarie 2003 12:00
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: Arthur Bogaart
Subject: [xsl] How to transform xml and xsl to a php format
I am serializing my xml input with an xsl , and want to get
an output like:
<?
if(!auth()){
header("Location: /Home/index.html");
exit;
}
function auth(){
$valid = false;
session_start();
if (!isset($_SESSION['valid'])) {
$valid = false;
} else {
$valid = $_SESSION['valid'];
}
return $valid;
}
?>
<html>
<head>
etc.............
So, at the beginning , I want to have <? ... some code ?>
I tried it in various way, ending up with essentially the
same problem:
When i try it , like for example below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:hc="http://www.hippo.nl/xml/hippocontent"
xmlns:xhive="http://hippo.nl/xhive/1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:res="http://www.hippo.nl/xml/resource"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsl:param name="current"/>
<xsl:param name="php"/>
<xsl:template match="/">
<xsl:if test="$php = 'true'">
<![CDATA[
<?
if(!auth()){
header("Location: /Home/index.html");
exit;
}
function auth(){
$valid = false;
session_start();
if (!isset($_SESSION['valid'])) {
$valid = false;
} else {
$valid = $_SESSION['valid'];
}
return $valid;
}
?>
]]>
</xsl:if>
<html xmlns="http://www.w3.org/1999/xhtml">
<xsl:comment>
ETC................................
The output generated, will look like : >? if(!auth()){
header("Location: /Home/index.html");
exit;
........
etc.....
?<
and then the html code. I am not able to get the output
like: <? ......... ?>.
Is there anybody who knows how to do this???
kind regards,
Ard Schrijvers
------------------------------------------------------
Professional Services Department
Hippo Webworks
Grasweg 35
1031 HW Amsterdam
The Netherlands
Tel: 0031-(0)20-6345173
Fax: 0031-(0)20-6345179
http://www.hippo.nl
------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list