如何获取xml某一项的数据?
如何获取xml某一项的数据?
比如,下面如何用js获取第一个 <Titem> 里的 <shu> 数据
<xml>
<Titem>
<item>
<shu> 2 </shu>
<shu> 2 </shu>
</item>
</Titem>
<Titem>
<item>
<shu> 1 </shu>
<shu> 1 </shu>
</item>
</Titem>
</xml>
[解决办法]
<xsl:stylesheet version= "1.0 " xmlns:xsl= "http://www.w3.org/1999/XSL/Transform " xmlns:fo= "http://www.w3.org/1999/XSL/Format " >
<xsl:output method= "html " encoding= "UTF-8 "/>
<xsl:template match= "xml ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=UTF-8 "/>
<title> yangzi </title>
</head>
<body>
<xsl:for-each select= "./Titem/item ">
<xsl:value-of select= "shu "/> <br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>