Fix #1340: "XML Schema xs:import doesn't support relative paths"

- improve resolution relative
- move some code to Scala

Things that I noticed (which were already the case before this commit):

- inline schema doesn't use dependencies to update if imports change
- inline schema in separate deployment has server CWD as base URI