Skip to content

Instantly share code, notes, and snippets.

@xquery
Created September 9, 2014 15:24
Show Gist options
  • Save xquery/885d227151ee9ee9ac06 to your computer and use it in GitHub Desktop.
Save xquery/885d227151ee9ee9ac06 to your computer and use it in GitHub Desktop.
check out the new annotations for RXQ functions (%output: , %xdmp:gzip) ... neat
(: -------------------------------------------------------------------------- :)
(: XSLT and XQuery Serialization 3.0 :)
(: -------------------------------------------------------------------------- :)
declare
%rxq:produces('text/plain')
%output:method('text')
%output:encoding('iso-8859-1')
%output:omit-xml-declaration('no')
%output:indent('no')
%rxq:GET
%rxq:path('/text-serialization-iso-8859-1')
function text-serialization-iso-8859-1(){
<e>Hello World</e>
};
declare
%rxq:produces('text/html')
%output:method('xhtml')
%output:indent('no')
%output:doctype-system('http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd')
%output:doctype-public('-//W3C//DTD XHTML 1.0 Strict//EN')
%output:omit-xml-declaration('no')
%output:standalone('no')
%rxq:GET
%rxq:path('/xhtml-with-doctype')
function xhtml-with-doctype(){
<html xmlns="http://www.w3.org/1999/xhtml">
<head />
<body>
<p>Hello World</p>
</body>
</html>
};
(: -------------------------------------------------------------------------- :)
(: xdmp annotations, e.g. xdmp:gzip, maybe multipart etc :)
(: -------------------------------------------------------------------------- :)
declare
%rxq:produces('text/plain')
%output:method('text')
%rxq:GET
%xdmp:gzip
%rxq:path('/text-content-gzipped')
function text-content-gzipped(){
text { "Hello World, gzipped" }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment