Xquery - Output DocType

Questions about XML that are not covered by the other forums should go here.
Posts: 7

Xquery - Output DocType

Wed Jul 16, 2014 2:17 am

Hi all,

I have an xquery file (.xql) that I use to generate an XML table via an xquery module (.xqm).
The module contains a function that generates a table similar to this:

Code: Select all


I retrieve this table in the .xql file.
Now, I would like to add a doctype on top of that table, to look like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Doctype PUBLIC "my-doctype-public" "my-doctype.dtd">

Note that I use xquery 3.0. I found that I should be able to output the doctype by declaring an option on top of the .xql file (right below 'xquery version "3.0";') like this:

Code: Select all

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "xml";
declare option output:media-type "text/xml";
declare option output:omit-xml-declaration "no";
declare option output:indent "yes";
declare option output:doctype-public "my-doctype-public";
declare option output:doctype-system "my-doctype.dtd";

I tried this both in the .xql and .xqm files, without success.
Hard-coding the doctype in the .xqm doesn't work either.

Does any of you have an idea for this?

Thanks in advance,
Posts: 2471

Re: Xquery - Output DocType

Wed Jul 16, 2014 5:54 pm


What XQuery engine are you using for this (eXist, Saxon XQuery) and with what version of Oxygen?

Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
Posts: 7

Re: Xquery - Output DocType

Wed Jul 16, 2014 6:55 pm

Hi Adrian,

I use eXist 2.1 for this application. Via the eXide dashboard, I just run the "Run" command and get the output in the "XML Output" console, which also is on the Dashboard.
I don't use oXygen here.

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest