Betsy Rolland
LIS 600 Independent Study

Transforming XML to Microsoft XML
Terry Brooks
Winter 2006

Transform Plain XML into a Microsoft Excel XML (SpreadsheetML) File that Opens in MS Excel

The instructions below will walk you through creating an XSLT file that transforms simple plain XML into SpreadsheetML that opens in Microsoft Excel.

Documents:

Steps:

  1. Create a new XSLT file.

  2. Insert the following header and processing instructions at the top:

  3. The main document-level element in spreadsheetML is the "Workbook," always prefixed with the ss namespace. Within a Workbook, you can have multiple Worksheet elements. In our example, there is only one Worksheet, named Sheet1. In this example, we are first creating a header row before inserting our information into the spreadsheet. Because all of our information will be contained in one "Table," we open the Table element first. Our header information is all in one row, so we open that element next. We need to create a "Cell->Data" structure for each of our header cells. Our data is all of type String, so we set the attribute "ss:Type="String"". The string we want to show up in the first cell is "Last Name," so we add a text element to hold that information.


  4. After completing our header row, we tell XSLT to apply the template we've defined to get our actual data in:


  5. Close off all tags, transform your XML, then open in Excel.