Friday, November 20, 2009

xslt1.0 and servlets

Two major accomplishments this week.

I've had to start processing "SPL" Files from the FDA. Turns out the XSLT the FDA publishes is (how to say this nicely) .. "Not the highest quality".
It wont process at all with saxon 9 due to errors. The errors exist in saxon 6 but are warnings so they were ignored. There were so many that I couldnt easily fix the XSL file so I needed to process it with saxon 6. I was able to implement an "xslt1" command which uses the saxon6 jar in the same JVM as saxon 9 ! Quite a feat ... so now xmlsh has xslt 1.0 and 2.0 commands built in.

In addition I needed to run XSLT from MarkLogic. Since its not natively supported the suggested workaround is using a servlet and http-post the xml to the servelet. Xmlsh to the rescue ! I wrote a simple Tomcat servlet for xmlsh. There were some weird problems with it taking over stdin/stdout so I had to imrove on the assumption about taking over System.in and System.out in a container environment. Also had to buffer the input and output or else strange things happened occasionally depending on the document size, but now its working !
Expect to see a xmlsh servlet, either as a seperate package or builtin to the core distro, I havent decided yet.



5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Interesting work. Some manpages or help docs will be helpful.

    ReplyDelete
  3. Thanks, when I am happy with the servelet code I'll include it with the next release and document it.

    Still on the fence on if I should include it as part of the core, or as a seperate download. Thinking mostly a seperate download so that I can include the whole WAR structure which will be easier to use.

    ReplyDelete
  4. The xmlsh servlet code is now part of release 1.0.0.1 and documented at http://www.xmlsh.org/EmbeddingServlet

    ReplyDelete
  5. Excellent post and writing style. Bookmarked.

    ReplyDelete

Due to comment spam, moderation is turned on. I will approve all non-spam comments.