Joachim Breitner
Joachim Breitner

Reputation: 25782

Call an external tool from XSLT

I am processing XML document using XSLT (XSLT 2, Saxon B 9.1.0.8), producing HTML output. I want to support a tag

<markdown>
   This is some `markdown` text
</markdown>

with the semantics that the content of the tag (which should be parsed as-is, similar to a <pre> tag) would be filtered through pandoc -f markdown -t html.

How can I do that from an XSLT stylesheet?

Upvotes: 2

Views: 702

Answers (1)

Michael Kay
Michael Kay

Reputation: 163587

Saxon supports a number of mechanisms for writing extension functions, documented at http://www.saxonica.com/documentation/#!extensibility

This is all described in terms of calling Java methods. There's no direct support for doing an exec of a shell command. You would want to write a Java wrapper around java's Runtime.getRuntime().exec() library method to capture the output into a string so that you can return the string result.

Upvotes: 3

Related Questions