Debugging

When you think that you do all right, but Sunbox dataview not displaying what you want - you need to debug your code.
There is two main reasons why your code not work:
  1. Error while querying data (you can make a mistake in query options);
  2. Error while transforming source XML tree (you can wrote incorrect XSL template).

At the both of this types of problem you need to activate debug mode in the web part options ("Miscellaneous" section):

debugging-1.png

Press "Ok".

Error while querying data

When you activate Debug mode you will see all errors of querying data at the "Error" section.

Example: I edit my News data source and specify invalid Query parameter:
<Where>
  <Eq>
    <FieldRef Name="ID" ></FieldRef>
    <Value Type="Int">{querystring[id]}</Value>
  </Eq>
</Where>


After save settings I will see the next:

debugging-2.png

Go back and modify Query parameter:

<Query>
  <Where>
    <Eq>
      <FieldRef Name="ID" ></FieldRef>
      <Value Type="Int">{querystring[id]}</Value>
    </Eq>
  </Where>
</Query>


Now we see that out code works:

debugging-3.png

Sometimes SharePoint not returns the error message. If so, that you need to use developer tools (IE), web inspector (chrome) or firebug (firefox) to see what the query sending to SharePoint and what his return.

Error while transforming source XML tree

If you have no error of querying data and markup not shown anyway, that reason in XML transformation. At this sutuation you have two tabs (in debug mode):
  1. Source XML;
  2. Source XSL.

Sunbox dataview renders the content of this tabs before transformation starts.
In the "Source XML" tab you can see the source XML tree, which will transform.
In the "Source XSL" tab you can see source XSL template. Most browser edit them if it contains parsing errors.
For example I add an error to my XSL:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet1 version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
        <div>
          <h3>Latest news:</h3>
          <div id="news-items">
            <xsl:for-each select="/response/News/Rows/Row">
              <a href="Lists/News/DispForm.aspx?ID={ID}">
                <xsl:value-of select="Title" />
              </a>
              <p class="news-announcement">
                <xsl:value-of select="Announcement" />
              </p>
            </xsl:for-each>
          </div>
          <div id="news-pager">
          </div>
        </div>
	</xsl:template>
</xsl:stylesheet>


After saving in the "Source XSL" tab will appear parseerror text:

debugging-4.png

After analyzing them you can fix problem

For best validating of XSL you can use Visual Studio. After saving XSL you can open it at "Style Library/SUnbox/ SunboxDataView/XSL/<filename>.xsl" via WEBDAV protocol.

Read more: Binding query string parameters

Last edited Feb 8, 2012 at 5:44 AM by Bukharin, version 3

Comments

No comments yet.