Page 1 of 1

XQuery not producing doctype declaration

Posted: Wed Mar 07, 2018 3:17 pm
by cedporter
I have configured an XQJ connection configured to a BaseX server running locally. When I run the following code block, the XML and doctype declarations do not appear in the output. Running the same query in the BaseX GUI, I do produce both. Is there a way to generate these in my output via oXygen?

Code: Select all


declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "xml";
declare option output:omit-xml-declaration "no";
declare option output:indent "yes";
declare option output:doctype-public "-//USP//DTD DITA Doc Std//EN";
declare option output:doctype-system "docstd_shell.dtd";
<docstd docclass="monograph-redesign" id="chapdep" xml:lang="en-US">
<title>XREF Extract</title>
{for $parent in collection('USP41-Prod-Export')//*[@testmethod='Y']
let $root := $parent/ancestor::node()[@docclass]
for $xref in $parent//xref[contains(@href, 'GUID-05F1D608-6135-4A21-B446-EE13FB4990B9')]
return
<docstd>
<docstd>
<title>{$root/data(@id)} - {$root/title/node()}</title>
<stdbody>
<p>{$xref}</p>
</stdbody>
</docstd>
<docstd id="before{$parent/@id}">{$parent}</docstd>
<docstd id="after{$parent/@id}">{$parent}</docstd>
</docstd>
}
</docstd>

Re: XQuery not producing doctype declaration

Posted: Thu Mar 08, 2018 5:45 pm
by adrian
Hi,

Unfortunately XQJ transformations support only XQuery 1.0. This is a limitation of the XQJ API.
I believe the problem is that the serialization parameters have only been standardized in XQuery 3.0/3.1. Note that the namespace http://www.w3.org/2010/xslt-xquery-serialization points to a XSLT and XQuery Serialization 3.1 Namespace Document. So they would not work with an XQuery 1.0 transformation (determined by the use of XQJ).

Regards,
Adrian

Re: XQuery not producing doctype declaration

Posted: Thu Mar 08, 2018 11:05 pm
by cedporter
Oh that's quite unfortunate. Is there no way to generate the doctype declaration? I've even tried to pass it through XSL using the BaseX transform function, which also works in BaseX, but not in O2.

Re: XQuery not producing doctype declaration

Posted: Fri Mar 09, 2018 12:29 pm
by adrian
Is there no way to generate the doctype declaration?
No, AFAIK it's not possible as long as the output is serialized by the XQJ transformation. It doesn't mater how you process it before, it's the serialization that must support this.

Regards,
Adrian