XSLT实现XML无极限树(精简版)[一]代码少,传输好!

博客内容仅为一个转载链接https://www.cnblogs.com/dsclub/archive/2004/08/16/33897.html,未包含其他关键信息技术信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数据文件:
xmltree.xml
None.gif<?xml version="1.0" encoding="GB2312" ?>
None.gif
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
None.gif
<Troot>
None.gif    
<Item id="1" pid="0" c="1">大学</Item>
None.gif    
<Item id="2" pid="0" c="3">中学</Item>
None.gif    
<Item id="3" pid="0" c="3">小学</Item>
None.gif    
<Item id="4" pid="2" c="2">高中</Item>
None.gif    
<Item id="5" pid="2" c="5">初中</Item>
None.gif    
<Item id="6" pid="15" c="3">清华大学</Item>
None.gif    
<Item id="7" pid="15" c="4">北京大学</Item>
None.gif    
<Item id="8" pid="5" c="3">天津铁三中</Item>
None.gif    
<Item id="9" pid="4" c="3">天津市二中</Item>
None.gif    
<Item id="10" pid="16" c="2">天津音乐学院</Item>
None.gif    
<Item id="11" pid="15" c="5">天津商学院</Item>
None.gif    
<Item id="12" pid="4" c="3">耀华中学</Item>
None.gif    
<Item id="13" pid="3" c="6">昆纬路小学</Item>
None.gif    
<Item id="14" pid="2" c="6">七中</Item>
None.gif    
<Item id="15" pid="1" c="1">综合类院校</Item>
None.gif    
<Item id="16" pid="1" c="1">艺术类院校</Item>
None.gif    
<Item id="17" pid="15" c="4">医科大学</Item>
None.gif    
<Item id="18" pid="15" c="4">天津师范大学</Item>
None.gif    
<Item id="19" pid="15" c="23">天津大学</Item>
None.gif    
<Item id="20" pid="15" c="7">南开大学</Item>
None.gif    
<Item id="21" pid="4" c="23">天津铁一中</Item>
None.gif    
<Item id="22" pid="5" c="5">天津铁一中</Item>
None.gif    
<Item id="23" pid="3" c="3">天津市铁路职工子弟第三小学</Item>
None.gif    
<Item id="24" pid="3" c="3">天津市铁路职工子弟第一小学</Item>
None.gif    
<Item id="25" pid="16" c="3">美术学院</Item>
None.gif    
<Item id="26" pid="16" c="3">体育学院</Item>
None.gif    
<Item id="0" pid="-1" c="2">学校</Item>
None.gif
</Troot>



XSLT: style.xsl
None.gif<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
None.gif    
<!-- 这个名称空间可以使用output,但是IE5不可解析 -->
None.gif    
<!-- 推荐使用环境,MSIE6,MSXML4.0 -->
None.gif    
<xsl:output method="html" version="4.0" encoding="GB2312" />
None.gif    
<xsl:template match="/">
None.gif        
<html>
None.gif            
<head>
None.gif                
<title>XMLTREE</title>
None.gif                
<style>
None.gif                    
<xsl:comment>
None.gif                
<![CDATA[
None.gif                h1
None.gif                {
None.gif                    display:list-item;
None.gif                    padding:2px;
None.gif                    list-style:none;
None.gif                }
None.gif                span.clsP
None.gif                {
None.gif                    list-style-type:square;
None.gif                    color:#222;
None.gif                }
None.gif                span.clsC
None.gif                {
None.gif                    list-style-type:disc;
None.gif                    color: #00b;
None.gif                }
None.gif                span
None.gif                {
None.gif                    padding: 2px;
None.gif                    font: 9pt;
None.gif                    cursor: default;
None.gif                    text-decoration:none;
None.gif                    margin: 0px;
None.gif                    margin-left: 16px;
None.gif                }
None.gif                div
None.gif                {
None.gif                    margin-left: 18px;
None.gif                    border-left: 1px solid #ddd;
None.gif                    border-bottom:1px solid;
None.gif                    border-bottom-color:expression(document.bgColor);
None.gif                    display:block;
None.gif                }                
]]>
None.gif                
</xsl:comment>
None.gif                
</style>
None.gif            
</head>
None.gif            
<body onselectstart="return false;">
None.gif                
<xsl:call-template name="NextPID">
None.gif                    
<xsl:with-param name="mPID">-1</xsl:with-param>
None.gif                    
<xsl:with-param name="mNum">0</xsl:with-param>
None.gif                
</xsl:call-template>
None.gif            
</body>
None.gif        
</html>
None.gif    
</xsl:template>
None.gif    
<xsl:template name="NextPID">
None.gif        
<xsl:param name="mPID" />
None.gif        
<xsl:param name="mNum" />
None.gif        
<xsl:for-each select="//Troot/Item[@pid = $mPID]">
None.gif            
<xsl:sort select="count(//Troot/Item[@pid = current()/@id])" order="descending" data-type="number" />
None.gif            
<!-- 首先按拥有孩子的数量来排序 -->
None.gif            
<xsl:sort select="@id" order="ascending" />
None.gif            
<xsl:choose>
None.gif                
<xsl:when test="count(//Troot/Item[@pid = current()/@id]) &gt; 0">
None.gif                    
<!-- 有孩子的节点 -->
None.gif                    
<h1>
None.gif                        
<span class="clsP">
None.gif                            
<xsl:attribute name="snode">
None.gif                                
<xsl:value-of select="@id" />
None.gif                            
</xsl:attribute>
None.gif                            
<xsl:value-of select="." />
None.gif                            [下属节点数:
<xsl:value-of select="format-number(count(//Troot/Item[@pid = current()/@id]),'00')" />]
None.gif                        
</span>
None.gif                    
</h1>
None.gif                    
<div>
None.gif                        
<xsl:attribute name="id">node<xsl:value-of select="@id" /></xsl:attribute>
None.gif                        
<xsl:call-template name="NextPID">
None.gif                            
<xsl:with-param name="mPID">
None.gif                                
<xsl:value-of select="@id" />
None.gif                            
</xsl:with-param>
None.gif                            
<xsl:with-param name="mNum">
None.gif                                
<xsl:value-of select="$mNum + @c" />
None.gif                            
</xsl:with-param>
None.gif                        
</xsl:call-template>
None.gif                    
</div>
None.gif                
</xsl:when>
None.gif                
<xsl:otherwise>
None.gif                    
<!-- 孤单的节点 -->
None.gif                    
<h1>
None.gif                        
<span class="clsC">
None.gif                            
<xsl:attribute name="snode">
None.gif                                
<xsl:value-of select="@id" />
None.gif                            
</xsl:attribute>
None.gif                            
<xsl:value-of select="." />[包含内容:<xsl:value-of select="@c" />]
None.gif                        
</span>
None.gif                    
</h1>
None.gif                
</xsl:otherwise>
None.gif            
</xsl:choose>
None.gif        
</xsl:for-each>
None.gif    
</xsl:template>
None.gif
</xsl:stylesheet>
None.gif
<!-- 最终版权归 DSclub(任兀)拥有,您可以在未授权的情况下使用,但请保留此信息 -->
None.gif
<!--
None.gif    EMail:dsclub@hotmail.com
None.gif    QQ:9967030
None.gif    Nick Name: DSclub(兀儿-干部)
None.gif    姓名:任兀
None.gif    性别:男生(未婚哦)
None.gif
-->
None.gif


对于单表的数据库,可以用ASP在Server上解析中间XML层,再用XSLT!
使用是可以自己根据喜好添加htc文件,和CSS!

这是一个很基础的版本,后期我还会不断升级它的功能!

转载于:https://www.cnblogs.com/dsclub/archive/2004/08/16/33897.html

内容概要:本文针对国内加密货币市场预测研究较的现状,采用BP神经网络构建了CCi30指数预测模型。研究选取2018年3月1日至2019年3月26日共391天的数据作为样本,通过“试凑法”确定最优隐结点数目,建立三层BP神经网络模型对CCi30指数收盘价进行预测。论文详细介绍了数据预处理、模型构建、训练及评估过程,包括数据归化、特征工程、模型架构设计(如输入层、隐藏层、输出层)、模型编译与训练、模型评估(如RMSE、MAE计算)以及结果可视化。研究表明,该模型在短期内能较准确地预测指数变化趋势。此外,文章还讨论了隐层节点数的优化方法及其对预测性能的影响,并提出了若干改进建议,如引入更多技术指标、优化模型架构、尝试其他时序模型等。 适合人群:对加密货币市场预测感兴趣的研究人员、投资者及具备定编程基础的数据分析师。 使用场景及目标:①为加密货币市场投资者提供种新的预测工具和方法;②帮助研究人员理解BP神经网络在时间序列预测中的应用;③为后续研究提供改进方向,如数据增强、模型优化、特征工程等。 其他说明:尽管该模型在短期内表现出良好的预测性能,但仍存在定局限性,如样本量较小、未考虑外部因素影响等。因此,在实际应用中需谨慎对待模型预测结果,并结合其他分析工具共同决策。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值