Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
line-o opened this issue Feb 8, 2023 · 0 comments · May be fixed by #5370
Open

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

line-o opened this issue Feb 8, 2023 · 0 comments · May be fixed by #5370
Labels
bug issue confirmed as bug xquery issue is related to xquery implementation

Comments

@line-o
Copy link
Member

line-o commented Feb 8, 2023

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
@line-o line-o added bug issue confirmed as bug xquery issue is related to xquery implementation labels Jul 24, 2023
line-o added a commit to line-o/exist that referenced this issue Jul 25, 2023
line-o added a commit to line-o/exist that referenced this issue Sep 12, 2023
line-o added a commit to line-o/exist that referenced this issue Jul 16, 2024
line-o added a commit to line-o/exist that referenced this issue Jul 16, 2024
line-o added a commit to line-o/exist that referenced this issue Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug xquery issue is related to xquery implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant