Search code examples
xmloraclexsltxmltype

XSL transform in Oracle using XMLTYPE.TRANSFORM returns a fragment, document required


This should be an easy one...

In Oracle I am using XMLTYPE.TRANSFORM(myxml, myxsl) to perform a transformation.

The XMLTYPE returned is a fragment (i.e. there is no XML document declaration). I require the output to be a document (i.e. with the <?XML version="1.0" ?> declaration).

My trasform works fine using standalone tools.

Any help would be appreciated..


Solution

  • I ended up solving this by prepending the declaration string to the CLOB output like so : return ('<?xml version="1.0" encoding="UTF-8"?>' || xmltype.GETCLOBVAL(L_RESULT));