0

Is it possible to do XSL Transformations in a List Function in CouchDB? Is seems rather improbable, since something like var xsltProcessor = new XSLTProcessor() can't be done outside the context of a browser.

Is there a way?

5
  • Since CouchDB internal format is JSON, a more common use case is to generate XML from JSON in "list" (or "show") functions, and to parse XML to JSON in "update" functions. Why do you need to convert XML to XML? Apr 22, 2014 at 10:10
  • I have XML documents stored in CouchDB, that follow slightly different schemas (different versions of the same schema actually). I'd like to use XSLT (I have the .xslt files ready) to "unify" those schemas to the latest version.
    – lalibi
    Apr 22, 2014 at 10:33
  • Did you try with a javascript XSLT library? Apr 22, 2014 at 15:40
  • I haven't to be honest, but I tried instantiating a XSLTProcessor inside a List Function and predictably it failed. All such libraries depend on browser "components" to do the work (ActiveX etc). I'm pretty sure at this point that there is no solution to this.
    – lalibi
    Apr 22, 2014 at 16:56
  • And all NodeJS XSLT libraries seem to be wrappers for native libraries and tools. I'm afraid your direction is not the one to follow... As I said earlier, a better solution would be to use XML externally and JSON internally. Apr 22, 2014 at 21:13

1 Answer 1

0

If you control the CouchDB server, there's definitely a way. CouchDB supports pluggable query engines, so you could code up a query engine that supports some kind of XSL transformations.

I guess the default SpiderMonkey-based query engine doesn't support it out of the box. I think there's an experimental NodeJS-based query engine floating around that might do better.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.