php xml xsl 问题

leo963258 2012-03-05 02:19:31
使用DOM XML 创建 XML ,
怎样添加XML样式表。。XSL .

...全文
96 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
coder 2012-03-05
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 leo963258 的回复:]

PHP Fatal error: Class 'xsltprocessor' not found

这个又是怎么回事。
[/Quote]
需要安装扩展
ubuntu 的话 sudo apt-get install php5-xsl

extension=xsl.so

windows我就不知道了。是xsl.dll?
leo963258 2012-03-05
  • 打赏
  • 举报
回复
PHP Fatal error: Class 'xsltprocessor' not found

这个又是怎么回事。
coder 2012-03-05
  • 打赏
  • 举报
回复
用XSLTProcessor

<?php

# LOAD XML FILE
$XML = new DOMDocument();
$XML->load( 'data.xml' );

# START XSLT
$xslt = new XSLTProcessor();

# IMPORT STYLESHEET 1
$XSL = new DOMDocument();
$XSL->load( 'template1.xsl' );
$xslt->importStylesheet( $XSL );

#IMPORT STYLESHEET 2
$XSL = new DOMDocument();
$XSL->load( 'template2.xsl' );
$xslt->importStylesheet( $XSL );

#PRINT
print $xslt->transformToXML( $XML );
?>

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧