根据实例书操作出了不少的问题,请大家帮看看
根据一本vb.net的实例书去操作,可是出了不少的问题,现在代码粘贴如下:
duqu1.xml代码:
<?xml version="1.0" encoding="utf-8" ?>
<booklist>
<book>
<title>asp.net百例</title>
<author>永远学习</author>
<price>80.0</price>
</book>
<book>
<title>vb.net百例</title>
<author>赵钱</author>
<price>85.0</price>
</book>
<book>
<title>C#.net百例</title>
<author>王钱</author>
<price>95.0</price>
</book>
<book>
<title>C++.net百例</title>
<author>黄钱</author>
<price>90.0</price>
</book>
<book>
<title>JS.net百例</title>
<author>刘钱</author>
<price>20.0</price>
</book>
</booklist>
XSLTFile1.xslt代码:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<tr style="font-weight:bold"><td>书籍名称</td><td>作者</td><td>价格</td></tr>
<xsl:for-each select="/booklist/book">
<tr><td><xsl:value-of select="title"></xsl:value-of></td>
<td><xsl:value-of select="author"></xsl:value-of></td>
<td><xsl:value-of select="price"></xsl:value-of></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
pageload代码:
Dim objxml As System.Xml.XmlDocument = New System.Xml.XmlDocument
objxml.Load(Server.MapPath(".") & "\duqu1.xml")
Xml1.Document = objxml
Dim xsltf As System.Xml.Xsl.XslTransform = New System.Xml.Xsl.XslTransform
xsltf.Load(Server.MapPath(".") & "\XSLTFile1.xslt")
Xml1.Transform = xsltf