One more solution could be to receive the result as text and parse it as XML fragments:

  let $xml := fn:doc('VCLP-A2 - admin.xml')
  let $xsl := fn:doc('DBK2BloomsburyDbk.xslt')
  let $result := xslt:transform-text($xml,$xsl)
  return parse-xml-fragment($result)

I didn’t try if it works out of the box.

Thanks all,
Christian



On Wed, Jun 6, 2018 at 1:30 PM, Martin Honnen <martin.honnen@gmx.de> wrote:
I think the problem is that your XSLT generates a result fragment with several top level chapter elements, lacking a single root element containing the other elements.
So you need to change the stylesheet to create a single root element or someone with more BaseX inside skills needs to tell how to use and process the result of a stylesheet that is not a well-formed document but a fragment.


Am 06.06.2018 um 13:18 schrieb DK Singh:
it is getting transformed on oxygen, but in the basex GUI not getting transformed, my req is to transformed file has to be write on the file system, but on the Basex GUI not getting transformed

Regards
Dharmendra Kumar Singh

On Wed 6 Jun, 2018, 4:26 PM Andy Bunce, <bunce.andy@gmail.com> wrote:
Hi  Dharmendra Kumar,

When I run this in Oxygen, loading the result into an editor window, I get the same message that BaseX  gives:

Description: The markup in the document following the root element must be well-formed.
Start location: 1:68199


Your transform is not generating a valid XML document.

Regards
/Andy

On 6 June 2018 at 11:07, DK Singh <dharam.mahi@gmail.com> wrote:
Hi Christian for your reference i am attaching the XSLT and XML which i am trying to transfom using BaseX GUI

QUERY
=========

let $xml := fn:doc('D:\2018\VCLP-A2 - admin.xml')
let $xsl := fn:doc('D:\2018\DBK2BloomsburyDbk.xslt')
return  xslt:transform($xml,$xsl)

Error
==========
Error:
Stopped at D:/2017/BLOOMSBURRY/testing-code/eBloomsbury/file, 3/23:
[FODC0002] "" (Line 1): The markup in the document following the root element must be well-formed.

you can try out to simply run the query on BaseX GUI , i have attached the XML and  XSLt

Regards
Dharmendra Kumar Sngh



On Wed, Jun 6, 2018 at 3:24 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi 
Dharmendra Kumar.

P
lease provide us with a little self-contained example (see http://sscce.org/ for more information). 

Thanks in advance ;)
Christian



On Wed, Jun 6, 2018 at 11:53 AM, DK Singh <dharam.mahi@gmail.com> wrote:
Hi Christian,
i am running the simple query on Basex GUI

let $xml := fn:doc('D:\2018\VCLP-A2 - admin.xml')
let $xsl := fn:doc('D:\2018\DBK2BloomsburyDbk.xslt')
return  xslt:transform($xml,$xsl)
Regards
​​
Dharmendra Kumar Singh

On Wed, Jun 6, 2018 at 2:49 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi ​Dhamendra Kumar,​

As usual,
​​
please provide us with a little example (see http://sscce.org/ for more information).

​​
Thanks in advance,
Christian


On Wed, Jun 6, 2018 at 11:16 AM, DK Singh <dharam.mahi@gmail.com> wrote:
Hi All,
I have a XML file when i apply xslt using xslt:transform function it is giving well formed error, even i tried on BaseX UI  using xslt:transform function

[FODC0002] "" (Line 1): The markup in the document following the root element must be well-formed.

but when the same file i transform on the oxygeng editor it getting transformed, can anyone suggest what going wrong.
Regards
Dharmendra Kumar Singh