SharePoint DVWP: view XML results of your query

When you create your own XSLT transformations in the data view web part you need to know the format of the XML resulting from the specifed query. Given this XML you can expiriment outside of FrontPage with an XSL tool like XSelerator to do real XSLT debugging. Note that outside of FrontPage (or online editing of the DVWP) you can’t use functions in the ddwrt namespace. 

To get the XML results you can use a simple XSLT transformation. Edit the XSLT part of the DVWP via frontpage, or press the XSL Editor “Source Editor…” button in the toolpane of the data view web part:

DVWPSourceEditor

Now replace the current xslt transformation with the following code:

To get a view like this:

DVWPSourceViewSimple

Or if you want to have a more fancy view like this:

DVWPSourceViewLeftDVWPSourceViewRight

use the following code which utilizes dp.SyntaxHighlighter

With this more advanced view I had FrontPage crashing on save of the code. So maybe you can better stick to the simple view. Another problem I had with the advanced view is that the output was not always rendered correctly, I thing due to a shortcomming in the syntax highlighting code.

One problem is that any typo in your query will result in an error message, use the back button to get back to your edit screen again and solve the problem (if your working with the online view). With FrontPage you can directly correct the problem because you have a complete source code view.

3 Comments

  • Nice and usefull EROL

  • Thanks. This is excellent.

  • I have been trying to vary the selectcommand="CAMLQuery" value so that when I have wildcards in a postback I could get all the enties in the list by removing that fieldref from the CAMLQuery for the wildcard field. The xsl style sheet normally starts beyond this section of the webpart file. I was wondering if it would mater if I started the xsl stylesheet before the selectcommnad so I could generate the CAMLQuery depending on the Request.QueryString parameters in the postback.

    bedankt voor u hulp.
    Mel

Comments have been disabled for this content.