XQuery not producing doctype declaration

Issues related to W3C XQuery.
cedporter
Posts: 12

XQuery not producing doctype declaration

Wed Mar 07, 2018 3:17 pm

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>
adrian
Posts: 2461

Re: XQuery not producing doctype declaration

Thu Mar 08, 2018 5:45 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
cedporter
Posts: 12

Re: XQuery not producing doctype declaration

Thu Mar 08, 2018 11:05 pm

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.
adrian
Posts: 2461

Re: XQuery not producing doctype declaration

Fri Mar 09, 2018 12:29 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XQuery”

Who is online

Users browsing this forum: No registered users and 0 guests