How to Use XSL in Excel
Excel is capable of exporting files into the XML format. XSL can then be used to format the raw XML data so that it can be read in a programming environment or designed to look nice on a Web browser. When a spreadsheet is intended for people, simply writing a label adjacent to its data is sufficient. A computer must be told explicitly what the labels mean. Excel has built-in processes that allow for the specifications necessary to export clean XML code.
Instructions
-
Format and Export an XML Document in Excel
-
1
Launch Microsoft Excel. Click "Start," "All Programs," "Microsoft Office Suite," "Excel."
-
2
Create horizontal labels. For example, in cell A1, type "Name" and then press "Enter." Select cells A1 and B1 by clicking and dragging over the two cells. Click "Insert," "Name," "Create." Select "Left Column" and click "OK." Cell B1 will be labeled with the text in A1. The same process can be used with any text and any combination of cells.
-
-
3
Create vertical labels. For example, in cell A2, type "Address" and then press "Enter." Select cells A2, A3, A4 and A5 by clicking and dragging over the cells. Click "Insert," "Name," "Create." Select "Top Row" and click "OK." The three cells directly below A2 will now be lines of an address.
-
4
Add the Developer tab. If the tab with the label "Developer" is not present, click "File," "Excel Options." Select "Show the Developer Tab," then click "OK."
-
5
Export XML. In the Developer tab, there will be a set of options above the "XML" label. Click "Export." A dialog box will pop up asking for a mapping sequence. The mapping sequence is purely a preference decision. The default will work if you do not have a preference. Click "OK."
-
6
Save the XML file. Navigate to any directory, name the file and click "OK."
Writing an XSL File
-
7
Launch any text or code editor.
-
8
Save the blank file into the same directory as the XML file. Click "File," "Save As." Then browse to the directory and save with any filename. Use the extension .xsl.
-
9
Open the XML document into a text or code editor. Click "File," "Open" and then select the file.
-
10
Write the XSL document based on the tags generated by Excel.
-
1
References
- Photo Credit number background image by kuhar from Fotolia.com