开发者

Extending DataForm Web part Not showing Node Value

I'm trying to create a custom web part by inheriting the dataformwebpart. the problem i'm facing is that in xsl i'm not able to display value of xml nodes although i'm getting the names of nodes.

below is my sample code, 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&amp;w=90&amp;h=90&amp;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>

kindly suggest where i'm going wrong


I found the answer for the same i had to override one more method

protected override XPathNavigator GetXPathNavigator(string viewPath)

        {

            return doc.CreateNavigator();

        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜