
February 18th, 2004, 01:20 AM
|
|
Contributing User
|
|
Join Date: Feb 2002
Posts: 186
Time spent in forums: 2 h 43 m 11 sec
Reputation Power: 7
|
|
|
not well-formed (invalid token)
im working on a php parser and have run into a problem. the error i get is Cannot process XSLT document [2]: XML parser error 4: not well-formed (invalid token)
ill post the parser code, and the xml/xsl code
PHP Code:
<?php
$xml = 'C:\Program Files\Apache Group\Apache2\htdocs\rss\a.xml';
$xsl = 'C:\Program Files\Apache Group\Apache2\htdocs\rss\b.xsl';
$xh = xslt_create();
$result = xslt_process($xh, $xml, $xsl);
if (!$result) {
die(sprintf("Cannot process XSLT document [%d]: %s",
xslt_errno($xh), xslt_error($xh)));
}
echo $result;
xslt_free($xh);
?>
below is the xml file
PHP Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<XSLTMessage>
Hello World!
</XSLTMessage>
and below is the xsl file
PHP Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="name(/XSLTMessage)" /></title>
</head>
<body>
<xsl:apply-templates select="/XSLTMessage" />
</body>
</html>
</xsl:template>
<xsl:template match ="XSLTMessage">
<p><b><xsl:value-of select="text()" /></b></p>
</xsl:template>
</xsl:stylesheet>
by the way, if i link the stylesheet by typing so within the xml document, it works-i dont know why the php parser is giving me this error... 
|