日期:2014-05-16  浏览次数:20719 次

xml输出超链接问题 100分 - Web 开发 / Ajax
像这样的字符串<a href="http://www.163.com"> 项目数据管理</a>
xml显示超链接出来网易而不是原样输出

如何修改xsl文件 请高手指点

------解决方案--------------------
<?xml version= "1.0" encoding= "gb2312"?>
<xsl:stylesheet version= "1.0 " xmlns:xsl= "http://www.w3.org/1999/XSL/Transform " >
<xsl:template match= "/" >
<xsl:apply-templates/>
</xsl:template >
<xsl:template match="a">
<a href="{@href}">
<xsl:value-of select="."/>
</a>
</xsl:template>
</xsl:stylesheet >

<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type='text/xsl' href='tree.xsl'?>
<Menus>
<Id> 1 </Id>
<Title> <![CDATA[网页链接]]> </Title>
<URL> <a href= "http://www.12554.com " > 网页链接 </a> </URL>
</Menus>
------解决方案--------------------
http://www.cnblogs.com/yesun/archive/2006/08/24/485536.aspx

也并不是 xml里运用脚本
xml用xslt解析出来就是一个html
你也可以直接在html里面写脚本
只要找到你的那个html元素,然后用下面
el.innerHTML = el.textContent;

http://www.hua2r.com/html/blog.html
右键 有js源码 可以参考下
------解决方案--------------------
是这个意思吧:
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match= "/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match= "URL">
<body onload="">
<xsl:attribute name="onload" >aaa('<xsl:value-of select= "."/>')</xsl:attribute > 
<div id="div1">
</div>
</body>
<script>
<![CDATA[
function aaa(o){
document.getElementById("div1").innerHTML=o
}
]]>
</script>
</xsl:template>
</xsl:stylesheet>