J
Julie C (little ninja)
Guest
I have a piece of code which is supposed to detect the user's browser type, and then display an XML document with the relevant XSL stylesheet, but it just displays the HTML title and H1 information on the web page and nothing else:
<html>
<head>
<title>Determining Browser Type</title>
</head>
<body>
<h1>Determining Browser Type</h1>
<br />
<?php
if(substr_count ($_SERVER["HTTP_USER_AGENT"], "MSIE") > 0){
$xsltproc=xslt_create();
$xslt_result = xslt_process ($xsltproc,'uk.xml','IE.xsl');
xslt_free($xsltproc);
}
else if(substr_count ($_SERVER["HTTP_USER_AGENT"], "Opera") > 0){
$xsltproc=xslt_create();
$xslt_result = xslt_process ($xsltproc,'uk.xml','Opera.xsl');
xslt_free($xsltproc);
}
else if(substr_count ($_SERVER["HTTP_USER_AGENT"], "Firefox") > 0){
$xsltproc=xslt_create();
$xslt_result = xslt_process ($xsltproc,'uk.xml','Firefox.xsl');
xslt_free($xsltproc);
}
?>
</body>
</html>
p.s. I added a few spaces in the code so it would show up
<html>
<head>
<title>Determining Browser Type</title>
</head>
<body>
<h1>Determining Browser Type</h1>
<br />
<?php
if(substr_count ($_SERVER["HTTP_USER_AGENT"], "MSIE") > 0){
$xsltproc=xslt_create();
$xslt_result = xslt_process ($xsltproc,'uk.xml','IE.xsl');
xslt_free($xsltproc);
}
else if(substr_count ($_SERVER["HTTP_USER_AGENT"], "Opera") > 0){
$xsltproc=xslt_create();
$xslt_result = xslt_process ($xsltproc,'uk.xml','Opera.xsl');
xslt_free($xsltproc);
}
else if(substr_count ($_SERVER["HTTP_USER_AGENT"], "Firefox") > 0){
$xsltproc=xslt_create();
$xslt_result = xslt_process ($xsltproc,'uk.xml','Firefox.xsl');
xslt_free($xsltproc);
}
?>
</body>
</html>
p.s. I added a few spaces in the code so it would show up