Transforming OXML with XSLT

Using the OMS command, you can route output to OXML, which is XML that conforms to the Output XML schema. This section provides a few basic examples of using XSLT to transform OXML.

  • These examples assume some basic understanding of XML and XSLT. If you have not used XML or XSLT before, this is not the place to start. There are numerous books and Internet resources that can help you get started.
  • All of the XSLT stylesheets presented here are installed with IBM® SPSS® Statistics in the Samples folder. See the topic Sample Files for more information.

OMS Namespace

Output XML produced by OMS contains a namespace declaration:

xmlns="http://xml.spss.com/spss/oms"

In order for XSLT stylesheets to work properly with OXML, the XSLT stylesheets must contain a similar namespace declaration that also defines a prefix that is used to identify that namespace in the stylesheet. For example:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0" xmlns:oms="http://xml.spss.com/spss/oms">

This defines "oms" as the prefix that identifies the namespace; therefore, all of the XPath expressions that refer to OXML elements by name must use "oms:" as a prefix to the element name references. All of the examples presented here use the "oms:" prefix, but you could define and use a different prefix.