简体   繁体   中英

Applying the <!DOCTYPE html> in xquery file

I'm trying to add dateTimePicker of jquery to my UI through xquery code. without dateTimePicker functionality is not working correctly.

I'm using below method to apply !DOCTYPE, but browser is unable to render it as html, it is returning as text, please suggest.

let $document := <html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"></meta>
    <title>Demo - jquery-simple-datetimepicker</title>

    <!--Requirement jQuery-->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <!--Load Script and Stylesheet -->
    <script type="text/javascript" src="jquery.simple-dtpicker.js"></script>
    <script type="text/javascript" src="date.js"></script>
    <link type="text/css" href="jquery.simple-dtpicker.css" rel="stylesheet" />
    <!---->


</head>
<body onload ="function()">

    <h3>Append to Input-field</h3>
    <input type="text" name="date" value=""></input>

</body>
</html>

return document { 

      text{ '<!DOCTYPE html>' }, 
      xdmp:quote($document) 

    }

Try adding xdmp:set-response-content-type("text/html") .

xdmp:set-response-content-type("text/html"),
let $document := ...
return document { ... }

That way, you can explicitly set the mime type of the response.

XQuery does not have a means of producing a DOCTYPE declaration the same way that XSLT does with xsl:output , but you can just add it to the result sequence. And as Dave Cassel suggested, you can also use xdmp:set-response-content-type() to ensure that the response content-type is text/html:

return (
  xdmp:set-response-content-type("text/html"), 
  "<!DOCTYPE html>", 
  document{ $document} 
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM