无缘无故多出来" 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>