0

I intend to generate a HTML5 page using xquery/xpath environment... Below is my page template function.

(: Displays the page :) declare function mobunpage:display-page($pageinfo as element()) as element() { <!DOCTYPE HTML > <html> {mobunpage:get-head($pageinfo)} <body> {mobunpage:get-foot($pageinfo)} </body> </html> };

And with that I get and error:

"error found while loading module mobunpage: error found while loading module from modules/mobunpage.xqm: unexpected char: '!'"

I am running on an eXist XML database and getting the above error which comes when i add the without the doctype the page works fine and display the parsed variables. Anyone know how to go about such error. Escaping doesn't solve the problem and tried a couple of functions from the documentation(http://www.w3.org/TR/xpath-functions/) but with no luck so far. Will definitely appreciate some help. Thankies!

Joe Wicentowski
  • 5,159
  • 16
  • 26
lalilulelo
  • 85
  • 3
  • 9

1 Answers1

3

The <!DOCTYPE HTML > isn't valid XQuery syntax.

If your XQuery engine supports definition of serialization options then there will be options doctype-system and doctype-public to set the system ID and public ID of the generated XML/HTML. It's unlikely it will support the new syntax, but you should be able to use the alternative doctype-system="about:legacy-compat" as described in the lengthy thread Set HTML5 doctype with XSLT

Community
  • 1
  • 1
Michael Kay
  • 156,231
  • 11
  • 92
  • 164