DB2 10.5 for Linux, UNIX, and Windows

Important considerations for transforming XML documents

When using the built-in XSLTRANSFORM function to convert XML documents some important considerations and restrictions apply.

Note the following when transforming XML documents:

  • Source XML documents must be single-rooted and well-formed.
  • Because XSLT transformation by default produces UTF-8 characters, the output stream might lose characters if inserted into columns defined with a character data type.

Restrictions

  • Only the W3C XSLT Version 1.0 Recommendation is supported.
  • All parameters and the result type must be SQL types; they cannot be file names.
  • Transformation with more than one stylesheet document (using an xsl:include or xsl:import declaration) is not supported.

Usage note

There are many methods you can use to transform XML documents including the XSLTRANSFORM function, an XQuery update expression, and XSLT processing by an external application server. For documents stored in a DB2® XML column, many transformations can be performed more efficiently by using an XQuery update expression rather than with XSLT because XSLT always requires parsing of the XML documents that are being transformed.

If you decide to transform XML documents with XSLT, you should make careful decisions about whether to transform the document in the database or in an application server.

If you specify the document function of XSLT in your XSLT stylesheet, ensure that the DB2_XSLT_ALLOWED_PATH registry variable is set to the directories from where you can download additional XML documents.