|
|

楼主 |
发表于 2005-4-1 09:35:21
|
显示全部楼层
类似的,我使用以下代码:
vi.xsl:
[PHP]
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
<xsl:template match="TEST">
<xsl:value-of select="NAME"/><BR/>
</xsl:template>
</xsl:stylesheet>
[/PHP]
dom.php
[PHP]
<?php
$xml = new DOMDocument('1.0', 'utf-8'); //Change encoding to utf-8
$xsl = new DOMDocument;
$xsl->load('v1.xsl');
$proc = new XSLTProcessor;
$root = $xml->CreateElement("TEST");
$val = utf8_encode ('Andr?s Poluk'); //New Line
$child = $xml->CreateElement("NAME",$val);
$root->appendChild($child);
$xml->appendChild($root);
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>
[/PHP]
同样出现错误提示:
Fatal error: Cannot instantiate non-existent class: domdocument in d:\greenamp\www\dom.php on line 2
不过这次,我用的是apach1.3+php4.3.10+winxp。
但是我看手册中有这样一句话:
XXVII. DOM Functions
……
There is no installation needed to use these functions; they are part of the PHP core.
那如果是这样,为什么还会找不到函数呢? |
|