XSLT Sablotron output
| From: | Daniele Baroncelli | Date: | Sat, 02 Nov 2002 21:25:13 +0000 |
| Subject: | XSLT Sablotron output | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122534@lists.php.net to get a copy of this message | ||
Hi guys,
I have typed a simple script to test the Sablotron module recently
installed.
I found out that the HTML is output all in one line, without newlines, which
is very annoying.
Anyone can tell me if this is a bug of the module, or I have to specify
something somewhere?
Here is the script on the server, where you can watch the result:
http://www.rockit.it/redazione/sixth/prova.php
Below you can find my PHP, XML and XSL files.
Cheers
Daniele
==========
PHP file
----------
<?php
// Allocate a new XSLT processor
$xh = xslt_create();
// call the XSLT processor directly
xslt_process($xh, 'prova.xml', 'prova.xsl', 'prova.html');
// output the result
readfile('prova.html');
xslt_free($xh);
?>
==========
XML file
-----------
<?xml version="1.0"?>
<me>
<name>John Doe</name>
<address>94, Main Street, Nowheresville 16463, XY</address>
<tel>738 2838</tel>
<email>johndoe@black.hole.com</email>
<url>http://www.unknown_and_unsung.com/</url>
</me>
===========
XSL file
---------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
</head>
<body>
<h1>Contact information for <b><xsl:value-of select="me/name"
/></b></h1>
<h2>Mailing address:</h2>
<xsl:value-of select="me/address" />
<h2>Phone:</h2>
<xsl:value-of select="me/tel" />
<h2>Email address:</h2>
<xsl:value-of select="me/email" />
<h2>Web site URL:</h2>
<xsl:value-of select="me/url" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
==========