2
votes

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?

1

1 Answers

3
votes

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.