无缘无故多出来" xmlns="" ",怎么回事

lycey 2006-01-19 10:29:16
代码如下:

<xsl:for-each select="/mainpage/navigation/item">
<xsl:if test="parent[.= $id]">
<h2><xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="href"/></xsl:attribute>
<xsl:value-of select="name"/>
</xsl:element></h2>
</xsl:if>
</xsl:for-each>


生成后,

<h2 xmlns=""><a href="category.asp?ptid=1&cgid=3">aaaaaa</a></h2>

h2后面怎么多了个那么一段??恳请各位帮忙,谢谢

这里是全部
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration = "yes" indent="yes" version="4.0"/>

<xsl:template name="nav" xmlns="http://www.w3.org/1999/xhtml">
<div id="mainleft">
<div class="title"><img src="{$images}channel_title.jpg" alt="商品分类" width="171" height="19" /></div>
<xsl:for-each select="/category/navigation/item">
<xsl:if test="depth[.=0]">
<h1><xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="href"/></xsl:attribute>
<xsl:attribute name="title"><xsl:value-of select="name"/></xsl:attribute>
<xsl:value-of select="name"/>
</xsl:element></h1>
<div class="main">
<xsl:call-template name="childnav">
<xsl:with-param name="id" select="id"/>
</xsl:call-template>
</div>
</xsl:if>
</xsl:for-each>
</div>
</xsl:template>

<xsl:template name="childnav">
<xsl:param name="id" />
<xsl:for-each select="/category/navigation/item">
<xsl:if test="parent[.= $id]">
<h2><xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="href"/></xsl:attribute>
<xsl:attribute name="title"><xsl:value-of select="name"/></xsl:attribute>
<xsl:value-of select="name"/>
</xsl:element></h2>
</xsl:if>
</xsl:for-each>
</xsl:template>
...全文
234 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lycey 2006-04-18
  • 打赏
  • 举报
回复
改成那样怎么没有用啊?
lycey 2006-03-31
  • 打赏
  • 举报
回复
加在最上面吗?
孟子E章 2006-01-19
  • 打赏
  • 举报
回复

<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration = "yes" indent="yes" version="4.0"/>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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