List Publisher Advanced Design Features

A List Publisher module dynamically publishes data from a list in a Microsoft Office Live Small Business application to a module that appears on the account's Web site.

If the Advanced Design features are activated for an account, you can customize the display of a List Publisher module using Extensible Stylesheet Language Transformations (XSLT). The Office Live Small Business parser takes XML that describes the underlying list and the XSLT template rules that you provide, to transform XSLT into the output that you want.

Using the Advanced Design features, you can create the look that you want for the List Publisher module by writing a completely custom layout, including scripts. Your could, for example, create scripts that do the following:

  • Sort the data

  • Create dynamic behaviors

  • Create a mashup with data from external data sources such as Microsoft Virtual Earth or other List Publisher modules.

The Advanced Design features also extend the value of custom views defined for business application lists, because you can publish a list based on a view. For more information about views, see Add and Delete Views of a List.

This article discusses how the XML is generated, how to view the XML, how to write the XSLT for the List Publisher module customization process, and shows examples of each.

To learn more about publishing lists to your public Web site, see Publish a List on a Web Site.

To activate the Advanced Design features, see Activate and Deactivate Advanced Design Features.

Generate XML to Describe the List

Before you can use an XSLT transformation to customize a List Publisher module's layout, you must first generate XML that describes the underlying list. XML is generated based on the columns that you select in List Publisher. To open List Publisher for an existing List Publisher module, right-click the module, and then select Properties.

Use columns from an existing view

Using Advanced Design features, you can automatically select the columns to be published based on a view previously created for this list. To do this, on the Data Details tab of List Publisher, click Use columns from an existing view, and select the view from the drop-down list to the right. For more information about creating views for a list, see Add and Delete Views of a List.

The choice of a view fills the grid at the bottom of the Data Details tab with rows for only the columns from the list that are included in that view. You can customize the display name for each column by typing over the Display name in each row in the grid, but the set of columns included is determined by the view that you choose.

Create a custom information view

If you prefer not to start with the columns filtered by an existing list view, you can select the individual columns that you want to include in this published version of the list. To do this, on the Data Details tab of the List Publisher, click Create custom information view.

This selection fills the grid at the bottom of the Data Details tab with rows for all of the columns included in this list. Use the grid to reorder and include and exclude columns. In addition, you can update the display names for the columns. The changes that you make here affect the XML that is available when the XSLT transformation takes place.

Note

It is best to select only the columns you need to publish your list. This will help to keep your XML smaller, making the XSLT transformation more efficient and your page display faster for your customers.

To view the XML that describes the columns that you selected, in List Publisher click View XML Source. The XML opens in a separate browser window, and can remain open as a reference for you while you write your XSLT.

The XML Created For You

Each column appears inside the schema section of the XML as a field element. Fields are useful to obtain the display names for each of the columns so that you can label the data properly.

After the closing schema tag (</Schema>), you find a data section with an ItemCount attribute. In the data section, there is one row element for each row of data from the underlying list.

Each row element has attributes that match the columns you selected. Your XSLT has access to each item. This lets you to lay out the data in just about any way you see fit.

Example

Following is example XML for the Tasks list found in the Team Workspace.

- <Root>
- <Schema>
  <Field Type="Text" Name="Title" DisplayName="Title" Required="TRUE" /> 
- <Field Type="Choice" Name="Status" DisplayName="Status">
- <CHOICES>
  <CHOICE>Not Started</CHOICE> 
  <CHOICE>In Progress</CHOICE> 
  <CHOICE>Completed</CHOICE> 
  <CHOICE>Deferred</CHOICE> 
  <CHOICE>Waiting on someone else</CHOICE> 
  </CHOICES>
- <MAPPINGS>
  <MAPPING Value="1">Not Started</MAPPING> 
  <MAPPING Value="2">In Progress</MAPPING> 
  <MAPPING Value="3">Completed</MAPPING> 
  <MAPPING Value="4">Deferred</MAPPING> 
  <MAPPING Value="5">Waiting on someone else</MAPPING> 
  </MAPPINGS>
  <Default>Not Started</Default> 
  </Field>
  <Field Type="Number" Name="PercentComplete" Percentage="TRUE" Min="0" Max="1" DisplayName="% Complete" /> 
  <Field Type="User" List="UserInfo" Name="AssignedTo" DisplayName="Assigned To" /> 
  <Field Type="Note" RichText="TRUE" Name="Body" DisplayName="Description" /> 
- <Field Type="DateTime" Name="StartDate" DisplayName="Start Date" Format="DateOnly">
  <Default>[today]</Default> 
  <DefaultFormulaValue>2007-10-26T00:00:00Z</DefaultFormulaValue> 
  </Field>
  <Field Type="DateTime" Name="DueDate" DisplayName="Due Date" Format="DateOnly" /> 
  </Schema>
- <Data ItemCount="1">
  <Row Title="" Status="" PercentComplete="" AssignedTo="" Body="" StartDate="" DueDate="" /> 
  </Data>
  </Root>

Providing Your Own XSLT Code

To provide your own XSLT code to customize a List Publisher module, you use the Layout tab of List Publisher. On the Layout tab, there are options that let you replace the standard layouts in two ways, depending on your needs.

You can upload an XSLT file to your Web site's Document Gallery. For more information, see Add an XSLT File to the Document Gallery. Then, from the Layout tab in List Publisher, you can use Browse to select the XSLT file to associate with your List Publisher module.

Edit XSLT

The Edit XSLT option on the Layout tab of List Publisher lets you paste or write your XSLT code directly into a text area. This is useful when you are writing your XSLT, because you can quickly update and save your changes and see the list published on the page.

Example XSLT

The code below is the XSLT that supports the default "grid" style of any list created using a List Publisher module.

This code first loops through all field elements in the schema section and extracts the DisplayName attribute to present as column headers in a table.

      <tr valign="top">
        <xsl:for-each select="//Schema/Field">
          <th nowrap="true" class="BG_Mid">
            <span class="F_VeryLight">
              <xsl:value-of select="@DisplayName"/>
            </span>
          </th>
        </xsl:for-each>
      </tr>

The code then creates a new table row (<tr>) for each row element in the XML. A test is done on the position within the XML to add alternating colors to the table row elements.

      <xsl:for-each select="//Data/Row">
        <tr valign="top">
          <xsl:if test="(position()mod 2) = 0">
            <xsl:attribute name="class">BG_Light</xsl:attribute>
          </xsl:if>

The code then creates a new table cell (<td>) for each attribute in the row.

          <xsl:for-each select="@*">
            <td>
              <xsl:value-of select="." disable-output-escaping="yes"/>
              &#160;
            </td>
          </xsl:for-each>
        </tr>
      </xsl:for-each>

See also

Publish a List on a Web Site
Activate and Deactivate Advanced Design Features