Create XSLT for an XML Spreadsheet

XSLT is a simple language containing looping, decision-making, evaluation, branching, and functional statements. It follows the same conventions as XML, and its sole purpose is to interpret and transform valid XML documents into some other text.

Excel qualifies the names of the XML nodes it creates with namespaces from the Microsoft Office schemas. An Excel workbook defines the following namespaces:

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40"
 xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml">

Notice that the default namespace (xmlns, highlighted in bold) is "urn:schemas-microsoft-com:office:spreadsheet". This is the same as the namespace for the ss prefix (xmlns:ss, also in bold). You use this ss namespace prefix when referring to workbook nodes in your XSLT file.

Different nodes in the XML spreadsheet use different default namespaces. For instance, the DocumentProperties node uses the following default namespace:

<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">

Therefore, when referring to the DocumentProperties node or its children, define a prefix for the namespace urn:schemas-microsoft-com:office:office in your XSLT and use that prefix to refer to ...

Get Programming Excel with VBA and .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.