How to display XML returned by SharePoint for web

2019-06-13 15:47发布

Lately I've been doing a lot of custom styling in SharePoint by modifying the XSL used to display various web parts. Knowing what the actual XML looks like, including which elements have actual values, really helps when working in the XSL. I've discovered a way to show this XML when using Ontolica web parts, but not when I'm using the default web parts included with SharePoint.

So, is there a way to do this, either programmatically or simply by adding a parameter to the URL? I could really use a tool like this and would be interested in developing one as OSS if I could determine if it's possible.

3条回答
家丑人穷心不美
2楼-- · 2019-06-13 16:07

Although the Data View web part does - many of the built in web parts will not use any form of XML/XSLT to render output.

Another option would be to use some javascript/jquery to modify the output from the built in web parts to suit - Christophe has some great articles on this.

查看更多
仙女界的扛把子
3楼-- · 2019-06-13 16:09

You can use this simple XSL template to dump the input XML:

<xsl:template match="/">
  <xsl:copy-of select="/" />
</xsl:template>
查看更多
可以哭但决不认输i
4楼-- · 2019-06-13 16:12

As Ryan has alluded to, not all (in fact hardly any) use XML/XSLT to render their output. It's a complete mix including hard-coding, CAML, as well as XSLT depending on the web part. So you won't be able to reliably approach the problem this way.

However there is a toolkit called ARF by Vincent Rothwell which contains its own controls to render SharePoint output using XML/XSLT. It's designed for publishing sites but states that it works under WSS as well. The source code is also available so you can either enhance what's there or extend the toolkit with your own controls. I would strongly recommend researching this as Vincent has a great blog and seems to know his stuff.

查看更多
登录 后发表回答