在引用的xml文档中对节点的xpath正确写法的问题
xml文档名称为ppacd.xml
<?xml version= "1.0 " encoding= "GB2312 "?>
<catalog>
<cd>
<NAME> 姓名 </NAME>
<id> name </id>
</cd>
<cd>
<NAME> 性别 </NAME>
<id> sex </id>
</cd>
<cd>
<NAME> 年龄 </NAME>
<id> age </id>
</cd>
<cd>
<NAME> 籍贯 </NAME>
<id> native </id>
</cd>
</catalog>
xslt文档如下:
<?xml version= "1.0 " encoding= "GB2312 "?>
<xsl:stylesheet version= "1.0 "
xmlns:xsl= "http://www.w3.org/1999/XSL/Transform ">
<xsl:output method= "html "/>
<xsl:param name= "ppacd.xml "/>
<xsl:template match= "*|@*|text() ">
<xsl:copy>
<xsl:apply-templates select= "*|@*|text() "/>
</xsl:copy>
</xsl:template>
<xsl:variable name= "ppacd " select= "document($ppacd.xml) "/>
<xsl:variable name= "ppacd2 " select= "document( 'ppacd.xml ') "/>
<xsl:variable name= "hello " select= "catalog/cd/NAME "/>
<xsl:template match = "td ">
<tr>
<td width= "20% " height= "20 ">
<xsl:value-of select= "$ppacd/catalog/cd/*[name] "/>
<span>
<xsl:attribute name= "id ">
<xsl:variable name= "QQ " select= "$ppacd/catalog/cd[id= 'age '] "/>
<xsl:variable name= "span " select= "concat(QQ, 'language ') "/>
<xsl:value-of select= "$span "/>
</xsl:attribute>
</span>
</td>
<td>
<input type= "text ">
<xsl:attribute name= "id ">
<xsl:value-of select= "catalog/cd/id " />
</xsl:attribute>
<xsl:attribute name= "name ">
<xsl:value-of select= "catalog/cd/id " />
</xsl:attribute>
</input>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
在ppacd.xml选择id的内容或者name的内容应该怎么做??为什么 <xsl:value-of select= "$ppacd/catalog/cd/*[name] "/> 不行啊 求教正确写法
[解决办法]
已经将答案发到邮箱