用xsl怎么提取当前的属性

用for-each遍历属性,怎能能得到属性的值啊?

1<xsl:for-each select="@*">
2<xsl:if test="xxxx!='ID'">
3<td nowrap="true" width="32%">
4<xsl:value-of select="xxxx"></xsl:value-of>
5</td>
6</xsl:if>
7</xsl:for-each>

上面遍历属性,不知道属性的名字,怎么能得到里面当前属性的名字和值啊?
xxxx处就是想获得属性的地方.
大侠帮忙.
---------------------------------------------------------------

节点名字:

1<xsl:value-of select="local-name()"></xsl:value-of>

值:

1<xsl:value-of select="."></xsl:value-of>

---------------------------------------------------------------

例子:
a.xml

 1<root>
 2<result>
 3<table01 fiedl01="haha" field02="www"></table01>
 4<table02 fiedl01="2222" field02="eeee"></table02>
 5<goods id="1" name="namevalue" type="typevalue"></goods>
 6<palce acount="acountvalue" id="2" number="numbervalue"></palce>
 7<table04 dd="ddvalue" ee="eevalue" kk="3"></table04>
 8<table05 dd="ddvalue" ee="eevalue" kk="3"></table05>
 9<table06 dd="ddvalue" ee="eevalue" kk="3"></table06>
10</result>
11</root>

a.xsl

 1<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 2<xsl:template match="/root/result">
 3<xsl:for-each select="node()">
 4<hr/>节点名字:   
 5<xsl:value-of select="local-name()"></xsl:value-of>
 6<p></p>   
 7属性名字和值:   
 8<xsl:for-each select="@*">
 9<xsl:value-of select="local-name()"></xsl:value-of>=<xsl:value-of select="."></xsl:value-of> ¦</xsl:for-each>
10</xsl:for-each>
11</xsl:template>
12</xsl:stylesheet>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus