帮忙把这个XML文件写出一个XSL文件 用表格显示出来
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE contactlist SYSTEM "contactlist.dtd">
<contactlist>
<classmate>
<name sex="男">张三
<contact>
<tel>334323234</tel>
<email>zhangsan@126.com</email>
</contact>
<address>
<homeaddr>中国河南省</homeaddr>
<workaddr>中国北京</workaddr>
</address>
<photo>1.jpg</photo>
</name>
</classmate>
<friend>
<name sex="男">李四
<contact>
<tel>1234455</tel>
<email>lisi@126.com</email>
</contact>
<address>
<homeaddr>中国河南省</homeaddr>
<workaddr>中国北京</workaddr>
</address>
<photo>2.jpg</photo>
</name>
</friend>
<home>
<name sex="女">王五
<contact>
<tel>23545435</tel>
<email>wangwu@126.com</email>
</contact>
<address>
<homeaddr>中国河南省</homeaddr>
<workaddr>中国南京</workaddr>
</address>
<photo>3.jpg</photo>
</name>
</home>
</contactlist>
最后一定要用表格显示出来才行,谢谢啦
[解决办法]
这XML格式不好。
<?xml version="1.0" encoding="GB2312"?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output encoding="gb2312" method="html"/> <xsl:template match="/"> <html> <head> </head> <body> <xsl:for-each select="contactlist/*"> <strong> <xsl:value-of select="name()"/> </strong> <table border="1"> <tbody> <tr> <td><xsl:value-of select="name/text()"/></td><td><img src="{name/pic}"/></td> </tr> <tr> <td>性别</td><td><xsl:value-of select="name/@sex"/></td> </tr> <xsl:for-each select="name/*/*"> <tr> <td> <xsl:value-of select="name()"/> </td> <td> <xsl:value-of select="."/> </td> </tr> </xsl:for-each> </tbody> </table> <br/> </xsl:for-each> </body> </html> </xsl:template></xsl:stylesheet>