我正在尝试通过继承 dataformwebpart 来创建自定义 Web 部件。我面临的问题是在 xsl 中我无法显示 xml 节点的值,尽管我正在获取节点的名称。
下面是我的示例代码,xsl,xml
public override void DataBind()
{
XmlDocument doc = GetFeedsXML();
XmlDataSource source = new XmlDataSource();
source.ID = "wallXML";
source.Data = doc.InnerXml;
this.DataSource = source;
base.Xsl = this.Xsl;
base.DataBind();
}
XSL
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" version="1.0"
exclude-result-prefixes="xsl msxsl ddwrt"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:variable name="dvt_1_automode">0</xsl:variable>
<xsl:template match="/">
<div>
<table>
<xsl:for-each select="/root/data/*">
<tr><td>
<xsl:value-of select="name()" />
abcd
<xsl:value-of select="." />
</td></tr>
</xsl:for-each>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
xml
<root>
<data>
<id>166358820071963_158352987564493</id>
<from>
<name>Sharepointworld By Ashutosh</name>
<category>Personal blog</category>
<id>166358820071963</id>
</from>
<message>http://www.sharepointworld.in/2011/06/filestream-with-sharepoint-2010.html</message>
<picture>http://external.ak.fbcdn.net/safe_image.php?d=AQDBGCIsqUOyGsf0&w=90&h=90&url=http%3A%2F%2Fsharepoint.microsoft.com%2Fblog%2FPublishingImages%2FBlog+images_Filestream%2Fblog_filestream_3.PNG</picture>
<link>http://www.sharepointworld.in/2011/06/filestream-with-sharepoint-2010.html</link>
<name>SharePoint World By Ashutosh: FILESTREAM with SharePoint 2010</name>
<caption>www.sharepointworld.in</caption>
<description>Ashutosh blog for sharepoint world</description>
<icon>http://static.ak.fbcdn.net/rsrc.php/v1/yD/r/aS8ecmYRys0.gif</icon>
<actions>
<name>Comment</name>
<link>http://www.facebook.com/166358820071963/posts/158352987564493</link>
</actions>
<actions>
<name>Like</name>
<link>http://www.facebook.com/166358820071963/posts/158352987564493</link>
</actions>
<privacy>
<description>Everyone</description>
<value>EVERYONE</value>
</privacy>
<type>link</type>
<created_time>2011-06-01T08:03:00+0000</created_time>
<updated_time>2011-06-01T08:03:00+0000</updated_time>
</data>
</root>
请建议我哪里出错了