Skip to content

[BUG] doctype and html with output option indent 'no'  #4736

@line-o

Description

@line-o

Describe the bug

Setting the output option indent to 'no' in the prolog of a main XQuery module should put the contents on the same
line immediately after the doctype declaration.

xquery version "3.1";
declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:indent "no";
declare option output:method "html";
declare option output:html-version "5";

<html>
  <body>
    a
  </body>
</html>

yields

<!DOCTYPE html>
<html><body>
    a
  </body></html>

NOTE: You have to store the module and call it via HTTP request, eXide does not show the correct results.

Expected behavior

For the above module to return

<!DOCTYPE html><html><body>
    a
  </body></html>

This is what Saxon produces ( see: https://xqueryfiddle.liberty-development.net/94hwpid)

To Reproduce

  1. store the main module above in /db/apps/test-html5/index.xq in a local exist-db instance (or any other subcollection of apps that has no controller).
  2. curl http://localhost:8080/exist/apps/templating-test/index.xq
  3. compare the result

This also applies to fn:serialize#2. I added a test below

xquery version "3.1";

module namespace unindented-html5="http://exist-db.org/xquery/test";

declare namespace test="http://exist-db.org/xquery/xqsuite";

declare variable $unindented-html5:expected :=
"<!DOCTYPE html><html><body>
    some text
  </body></html>"
;

declare variable $unindented-html5:source :=
<html>
  <body>
    some text
  </body>
</html>
;

declare
    %test:assertTrue
function unindented-html5:test() {
    serialize($unindented-html5:source, map {
        "method": "html", "html-version": 5.0, "media-type": "text/html", 
        "indent": false()
    }) eq $unindented-html5:expected
};

Context (please always complete the following information)
One option is to use xst, and copy and paste the output produced by running xst info here:

Build: eXist-6.2.0-SNAPSHOT (ac2c7e1)
Java: 1.8.0_362 (Azul Systems, Inc.)
OS: Mac OS X 12.6.3 (aarch64)

Additional context

  • How is eXist-db installed? built from source
  • Any custom changes in e.g. conf.xml? none

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissue confirmed as bugxqueryissue is related to xquery implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions