How to dump the generated xml of a list view

From Sense/Net Wiki
Jump to: navigation, search
  •  
  •  
  •  
  •  
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned

Overview

The actual display of Sense/Net lists are usually automatically built from the underlying view and data. A view can be an explicitely implemented ascx, but this ascx can also be auto-generated from the view options/properties. In this latter case an xslt renderer is used to generate the ascx from the xml representation of the view. To create a proper xslt renderer it can be very handy to visualize the xml representation of the view. This article describes a way to do this.

Steps

1. Create a new xslt renderer

Create a new xslt renderer under /Root/System/SystemPlugins/ListView/Templates. The easiest way is to create a User Control.ascx, delete the content of the file, and rename it to DumpXml.xslt. Paste the following code:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output method="xml" />
  <xsl:template match="/">
    <textarea>
      <xsl:copy-of select="*"/>
    </textarea>
  </xsl:template>
</xsl:stylesheet>

2. Add a new view to a list

Navigate to a list and create a new view using the above template:

  • Select Manage Views from Settings
  • Click new
  • Type "Dump XML View" into display name
  • Expand "Show advanced fields"
  • Change markup template to DumpXml.xslt
  • Click Done Editing then click Done

3. Switch to Dump Xml View

In the view menu select Dump Xml View. A textarea will appear with the view xml in it. For example:

<Columns>
  <Column title="Display Name" fullName="GenericContent.DisplayName" bindingName="GenericContent_DisplayName" index="1" width="0" hAlign="" wrap="" modifiers="main" />
  <Column title="Modified By" fullName="GenericContent.ModifiedBy" bindingName="GenericContent_ModifiedBy" index="2" width="0" hAlign="" wrap="" modifiers="" />
  <Column title="Modification Date" fullName="GenericContent.ModificationDate" bindingName="GenericContent_ModificationDate" index="3" width="0" hAlign="" wrap="" modifiers="" />
</Columns>

Related links

References

There are no external references for this article.