I can't help you with the whitespace issues, but I recently wrote a simple error handler in PHP to write those pesky hidden Sablotron messages off to a log file (and coincidentally stop those msgtype warnings).
Here's the relevant PHP source:
<?php
/* Figure out the base URI */
$therealpath = $HTTP_SERVER_VARS["PATH_TRANSLATED"];
$path_parts = pathinfo ($therealpath);
$baseURI = $path_parts["dirname"];
/* Open the log file at that base URI */
$logfile = $baseURI . '/sablot.log';
$XSLTerrorlog = fopen ($logfile, "w");
/* Make a time stamp for the log file */
$timearray = getdate();
$timestamp = "Sablotron Runtime: " . $timearray["year"] . "-" . $timearray["mon"] . "-" . $timearray["mday"] . " " . $timearray["hours"] . ":" . $timearray["minutes"] . ":" . $timearray["seconds"] . "\n";
/* Establish values to pass to Sablotron */
$xsl = 'xsl-transform.xml';
$xml = 'content.xml';
$xslt_params["foo1"] = "foovalue1";
$xslt_params["foo2"] = "foovalue2";
/* Formats the $errors array with Tabs and CR's for text log file */
function tabarraydata($value, $key) {
global $XSLTerrorlog;
fwrite ($XSLTerrorlog,"\t$key\t$value\n");
}
/* Writes Sablotron error info to log file */
function xsl_error_handler($parser, $code, $level, $errors) {
global $XSLTerrorlog, $timestamp;
fwrite ($XSLTerrorlog,$timestamp);
fwrite ($XSLTerrorlog,"Parser: $parser\n");
fwrite ($XSLTerrorlog,"Code: $code\n");
fwrite ($XSLTerrorlog,"Level: $level\n");
fwrite ($XSLTerrorlog,"Messages: \n");
array_walk ($errors, "tabarraydata");
fwrite ($XSLTerrorlog,"\n");
}
/* Instantiate Sablotron */
$theXSLTproc = xslt_create();
/* Set the error handler for this instance (this is NOT in the PHP docs) */
xslt_set_error_handler($theXSLTproc, "xsl_error_handler");
/* Run the Transform with Sablotron */
xslt_run ($theXSLTproc, $xsl, $xml, "arg:/_result", $xslt_params);
/* Grab the transform's results */
$result = xslt_fetch_result ($theXSLTproc);
/* Write results to Response */
echo $result;
/* Clean it up */
xslt_free($theXSLTproc);
fclose ($XSLTerrorlog);
?>
This codes works on my install of Apache 3.14/PHP 4.04pl1/Sablotron 0.51 under Mac OS X/Darwin.
- Mars
On Monday, April 16, 2001, at 02:01 , [EMAIL PROTECTED] wrote:
Hi
�
I'm using sablotron under php with apache and mysql.
�
anybody in my case, i would be interested to share experience
�
about sablot :
�
�
I noticed that sablot is sensitive to "<" sign in CDATA sections and even between quotes in test attribute of an xsl:if.
�
and that it is not possible to have a CR between
�<xsl:attribute name="href">..///something</xsl:attribute>
�
if i write it like this in the file
�
�<xsl:attribute name="href">
��� ..///something
</xsl:attribute>
�
it inserts very bad characters %a0%09%09 i think.
�
�
is it conformal , and if not is it going to be fixed in a near future ?
�
�
for the rest it works fine !
�
i use sablocmd from the command line to have the error messages, because through php
�
you have an error message but not the type of error nor source line incriminated which makes impossible to debug after some time.
�
is it a sablot bug or php ?
�
thanks
�
�
