Question

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..

Was it helpful?

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));

OTHER TIPS

You could use sys_xmlgen:
select sys_xmlgen(xmlforest(a.value, a.value2)) from
(select 'value' value, 2 value2 from dual) a

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top