请问已知节点的属性如何获得该节点的值?
在Xsl和JavaScript中分别如何做到?
比如:test.xml如下:
<?xml version= "1.0 " encoding= "GB2312 "?>
<?xml-stylesheet type= "text/xsl " href= "test.xsl " ?>
<col-list>
<part pId= "1 ">
<pTitle> aaaa </pTitle>
<pContent> bbbbbb </pContent>
</part>
<part pId= "2 ">
<pTitle> cccc </pTitle>
<pContent> ddddd </pContent>
</part>
</col-list>
在test.xsl里如何根据给定的属性值pId= "2 "得到节点pTitle和pContent的值?
[解决办法]
<xsl:template match= "//part[@pId= '2 '] ">
<xsl:value-of select= "pTitle "/>
<xsl:value-of select= "pContent "/>
</xsl:template>