日期:2013-06-23  浏览次数:20528 次

使用时需要加载XSLT模块,程序下载地址:http://xiaocon.51.net/tree/tree.zip
演示地址:
http://xiaocon.51.net/tree/tree.htm
" target=_blank>
http://xiaocon.51.net/tree/tree.htm


http://xiaocon.51.net/tree/navi.xml
" target=_blank>
http://xiaocon.51.net/tree/navi.xml

51.net上不支持xslt :(
程序文件:
===========================================================
<?php
$xslstring = implode('',file("navigator.xsl"));
$xmlstring = implode('',file("navi.xml"));
$arguments = array(
     '/_xml' => $xmlstring,
     '/_xsl' => $xslstring
);

$xh = xslt_create();

$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if ($result) {
    print $result;
}
else {
    print "Err";
    
}
xslt_free($xh);

?>
xml文件
===========================================================
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="navigator.xsl" ?>
<Navigation>

    <Navigator ID="1" AncestorID="1" Layer="0" Title="花园首页" Childs="0" Url="default.asp&" Image="images/dc.gif"/>
    <Navigator ID="2" AncestorID="2" Layer="0" Title="我的花园" Childs="4" Url="#" Image="default"/>
    <Navigator ID="3" AncestorID="2" Layer="1" Title="收藏夹" Childs="4" Url="#" Image="default"/>
    <Navigator ID="21" AncestorID="3" Layer="2" Title="我管理的花坛" Childs="0" Url="mybbs.asp?cat=g" Image="images/dc-new.gif"/>
    <Navigator ID="22" AncestorID="3" Layer="2" Title="我种下的种子" Childs="0" Url="mybbs.asp?cat=t" Image="images/dc-new.gif"/>
    <Navigator ID="23" AncestorID="3" Layer="2" Title="我喜欢的花园" Childs="0" Url="myfavorite.asp?cat=g&s=test" Image="images/dc-new.gif"/>
    <Navigator ID="24" AncestorID="3" Layer="2" Title="我收藏的文章" Childs="0" Url="myfavorite.asp?cat=t" Image="images/dc-new.gif"/>
    <Navigator ID="4" AncestorID="2" Layer="1" Title="个人工具箱" Childs="2" Url="#" Image="default"/>
    <Navigator ID="25" AncestorID="4" Layer="2" Title="配置和管理" Childs="0" Url="personal.asp" Image="images/dc-config.gif"/>
    <Navigator ID="26" AncestorID="4" Layer="2" Title="花瓣兑换点" Childs="0" Url="apetal.asp" Image="images/dc-config.gif"/>
    <Navigator ID="27" AncestorID="2" Layer="1" Title="我的日记本" Childs="0" Url="mydiary.asp" Image="images/dc-diary.gif"/>
    <Navigator ID="6" AncestorID="2" Layer="1" Title="好友和短讯" Childs="0" Url="myfriend.asp" Image="images/dc-friends.gif"/>
    <Navigator ID="7" AncestorID="7" Layer="0" Title="计算机技术" Childs="