I also put a, use the time as long as the preparation of the XML file on the line, even the program does not have to change

Source: Internet
Author: User
Tags config xsl xslt
Xml| program is used to load XSLT module, program download address: Http://xiaocon.51.net/tree/tree.zip
Demo Address:
Http://xiaocon.51.net/tree/tree.htm
"Target=_blank>
Http://xiaocon.51.net/tree/tree.htm

Or
Http://xiaocon.51.net/tree/navi.xml
"Target=_blank>
Http://xiaocon.51.net/tree/navi.xml

XSLT:(not supported on 51.net
Program Files:
===========================================================
<?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 file
===========================================================
<?xml version= "1.0" encoding= "GB2312"?>
<?xml-stylesheet type= "text/xsl" href= "navigator.xsl"?>
<Navigation>

<navigator id= "1" ancestorid= "1" layer= "0" title= "Garden Home" childs= "0" url= "default.asp&" image= "images/dc.gif"/ >
<navigator id= "2" ancestorid= "2" layer= "0" title= "my Garden" childs= "4" url= "#" image= "Default"/>
<navigator id= "3" ancestorid= "2" layer= "1" title= "Favorites" childs= "4" url= "#" image= "Default"/>
<navigator id= "ancestorid=" 3 "layer=" 2 "title=" I managed the flower bed "childs=" 0 "url=" mybbs.asp?cat=g "image=" images/ Dc-new.gif "/>
<navigator id= "ancestorid=" 3 "layer=" 2 "title=" The seed I planted "childs=" 0 "url=" mybbs.asp?cat=t "image=" images/ Dc-new.gif "/>
<navigator id= "ancestorid=" 3 "layer=" 2 "title=" My favorite Garden "childs=" 0 "url=" myfavorite.asp?cat=g&s=test "Image= "Images/dc-new.gif"/>
<navigator id= "ancestorid=" 3 "layer=" 2 "title=" My collection of articles "childs=" 0 "url=" myfavorite.asp?cat=t "image=" images/ Dc-new.gif "/>
<navigator id= "4" ancestorid= "2" layer= "1" title= "personal Toolbox" childs= "2" url= "#" image= "Default"/>
<navigator id= "ancestorid=" 4 "layer=" 2 "title=" Configuration and Management "childs=" 0 "url=" personal.asp "image=" images/ Dc-config.gif "/>
<navigator id= "ancestorid=" 4 "layer=" 2 "title=" Petal Exchange Point "childs=" 0 "url=" apetal.asp "image=" Images/dc-config.gif " />
<navigator id= "ancestorid=" "2" layer= "1" title= "My Diary" childs= "0" url= "mydiary.asp" image= "Images/dc-diary.gif" />
<navigator id= "6" ancestorid= "2" layer= "1" title= "Friends and SMS" childs= "0" url= "myfriend.asp" image= "images/ Dc-friends.gif "/>
<navigator id= "7" ancestorid= "7" layer= "0" title= "Computer Technology" childs= "2" url= "#" image= "Default"/>
<navigator id= "8" ancestorid= "7" layer= "1" title= "Dhtml,jscript" childs= "0" url= "bbsgroup.asp" Image= "images/ Dc.gif "/>
<navigator id= "9" ancestorid= "7" layer= "1" title= "net,asp+" childs= "0" url= "bbsgroup.asp" image= "Images/dc.gif" />
<navigator id= "Ten" ancestorid= "7" layer= "1" title= "ASP Mutual Assistance" childs= "0" url= "bbsgroup.asp" image= "Images/dc.gif"/>
<navigator id= "One" ancestorid= "one" layer= "0" title= "Jing Jing Campus" childs= "2" url= "#" image= "Default"/>
<navigator id= "ancestorid=" layer= "1" title= "Nanjing University" childs= "0" url= "bbsgroup.asp" image= "Images/dc.gif"/>
<navigator id= "ancestorid=" layer= "1" title= "Southeast University" childs= "0" url= "bbsgroup.asp" image= "Images/dc.gif"/>
<navigator id= "ancestorid=" layer= "0" title= "garden • There is a square" childs= "2" url= "#" image= "Default"/>
<navigator id= "ancestorid=" layer= "1" title= "Suggestion Box" childs= "0" url= "bbsgroup.asp" image= "Images/dc.gif"/>
<navigator id= "ancestorid=" layer= "1" title= "garden • People story" childs= "0" url= "bbsgroup.asp" image= "images/dc.gif"/ >
<navigator id= "ancestorid=" layer= "0" title= "Gardener's Office" childs= "0" url= "bbsgroup.asp" image= "Images/dc-key.gif" />
<navigator id= "ancestorid=" layer= "0" title= "Green Grass" childs= "0" url= "bbsgroup.asp" image= "images/dc.gif"/ >
<navigator id= "ancestorid=" layer= "0" title= "Statistical information" childs= "0" url= "viewlog.asp" image= "Images/dc-chart.gif" />
<navigator id= "ancestorid=" layer= "0" title= "activecard" childs= "0" url= "Activecard?fromgarden" Image= " Images/dc-card.gif "/>
</Navigation>


XSLT file

============================================================
<?xml version= "1.0" encoding= "GB2312"?>
<xsl:stylesheet version= "1.0" xmlns:xsl= "Http://www.w3.org/1999/XSL/Transform" >
<xsl:output method = "html" version= "1.0" encoding= "GB2312" indent= "yes"/>
<xsl:template match= "/" >
<HTML>
<HEAD>
<title>xslt Tree navigation bar </TITLE>
<link rel= "stylesheet" type= "Text/css" href= "Navigator.css"/>
<script src= "Toggle.js" ></SCRIPT>
</HEAD>
<BODY>

<div >
<TABLE>
<TR>
<td><div nowrap= "true" style= "PADDING-LEFT:0EM;" > Garden Catalogue </DIV></TD>
</TR>
<xsl:for-each select= "Navigation/navigator" >
<TR>
<xsl:attribute name= "TITLE" ><xsl:value-of select= "@Title"/></xsl:attribute>
<xsl:attribute name= "Class" >navigator<xsl:if test= "@Layer [. >0]" >-hidden</xsl:if></xsl: Attribute>
<xsl:attribute name= "ID" ><xsl:value-of select= "@ID"/></xsl:attribute>
<xsl:attribute name= "Ancestorid" ><xsl:value-of select= "@AncestorID"/></xsl:attribute>
<xsl:attribute name= "Depth" ><xsl:value-of select= "@Layer"/></xsl:attribute>
<xsl:if test= "@Childs [. >0]" >
<xsl:attribute name= "Expanded" >no</xsl:attribute>
</xsl:if>
&LT;TD style= "Cursor:hand" >
<div nowrap= "true" ><xsl:attribute name= "STYLE" >padding-left:<xsl:value-of select= "@Layer"/>em; </xsl:attribute>
<xsl:choose>
<xsl:when test= "@Childs [. >0]" ><xsl: Attribute name= "onclick" >toggle (' <xsl:value-of select= "@ID"/> ") </xsl:attribute></img></ Xsl:when>
<xsl:otherwise><xsl:attribute name= "src" ><xsl:value-of select= "@Image"/></xsl: Attribute></img></xsl:otherwise>
</xsl:choose>
<a><xsl:if test= "@Childs [. >0]" ><xsl:attribute name= "onclick" >toggle (' <xsl:value-of Select = "@ID"/> ") </xsl:attribute></xsl:if><xsl:attribute name=" href ><xsl:value-of select= "@Url "/></xsl:attribute><xsl:value-of select=" @Title "/></a></div></td>
</TR>
</xsl:for-each>
</TABLE>
</DIV>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.