Database Reference
In-Depth Information
XSL transformation. The serializer used by the REST Server also processes any XSL
processing instructions declared in an XML document before returning the result to
you. You can control this behavior by appending the _xsl parameter in the query part
of the URL. You can also exploit this parameter to specify your own stylesheet at call
time, as Table 13-1 shows.
Table 13-1. _xsl query parameters
XSL parameter value
Explanation
Disables the processing of XSL processing instructions.
no
Enables the processing of XSL processing instructions.
yes
You may provide a URI to an XSL stylesheet that you wish to apply. The URI can be a database URI
(e.g., /db/my-stylesheet.xslt ).
uri
The default behavior of whether XSL processing instructions are
processed or not by the serializer is configurable in
$EXIST_HOME/conf.xml at the attribute indicated by the
XPath /exist/serializer/@enable-xsl .
For example, to apply the XSL transformation at /db/my-stylesheet.xslt when retriev‐
ing /db/some-document.xml , you could use the following cURL command:
curl http://localhost:8080/exist/rest/db/some-document.xml
?_xsl = /db/my-stylesheet.xslt
If you just want to know the size of a document, or when a docu‐
ment or collection was last modified, you can use the HEAD method
instead of GET . This returns just some basic metadata in the HTTP
response headers instead of the resource content or collection
listing.
Storing a document
You may store an XML or binary document into a collection in eXist via the REST
Server API, by submitting the content of the document you wish to store as the body
of a PUT request. You should also specify the Internet media type in the HTTP
Content-Type header of your request. If the collection you are PUT ing the document
into does not allow execute and write access by other users, then you will also need to
provide a username and password for an account that does have such access.
For example, the following cURL command will store the XML document /tmp/my-
doc.xml into the collection /db/docs/personal :
 
Search WWH ::




Custom Search