views:

596

answers:

3

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.

+2  A: 

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

<xsl:template match="/">
  <xsl:copy-of select="/" />
</xsl:template>
dahlbyk
I do something similar while editing in Designer, but I'd like to simplify the process a bit. Being able to have a simple custom app that you can drill into sites, lists, etc, and display the returned XML would be helpful. I know there's an API, but don't know anything about it yet.
Chris Stewart
SPDataSource.GetView() returns an SPDataSourceView that has a Select() method that might return what you're looking for.
dahlbyk
A: 

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.

Ryan
+1  A: 

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.

Alex Angas