Skip to content

Instantly share code, notes, and snippets.

@grantmacken
Last active March 24, 2016 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantmacken/929cbb7a041ae5e07132 to your computer and use it in GitHub Desktop.
Save grantmacken/929cbb7a041ae5e07132 to your computer and use it in GitHub Desktop.
make function to get the right mime-type from an extension using #eXistdb mimetypes file
getMimeType = $(shell java -cp $(SAXON) \
net.sf.saxon.Query \
\!method=text \
-qversion:3.1 \
-qs:"doc('file:///$(EXIST_HOME)/mime-types.xml')//mime-type[matches(./extensions,'\$(1),|\$(1)$$')]/@name/string()"\
)
@grantmacken
Copy link
Author

$(SAXON) points to saxaon-he jar
param $(1) is a file extension like '.xq'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment