You are not logged in.
Is it possible to invoke shell commands within XSLT? Something like
<code syntax="python">print(1+2)</code>
and generate
<code>3</code>
or something like that? A newbee here ;-)
Last edited by xanb (2014-07-11 12:27:20)
Owning one OpenRC (artoo way) and other three systemd machines
Offline
I don't think xslt itself can call external interpreters. Xslt can do the calculations and even conditionals, but if you want to use python, or other interpreters, you'd need some sort of "preprocessor" step.
Depending on your actual goals, you may be interested in the various "literate programming" tools. I don't know of one of the top of my head for having scripting languages embedded in an xml document, but it wouldn't surprise me if there were some. Most of the ones I know are for embedding various code (C, R) in (La)Tex documents. I use Sweave daily which is a latex document with R code that the R interpreter processes first to replace with the results, then the latex tools make the final document.
EDIT: This may be of interest.
Last edited by Trilby (2014-07-11 12:35:00)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks, Trilby, for quick answer.
I want to avoid specificity of languages: there are many tools in language X for run commands in language X in XML. But I want to run commands in *whatever* language and get the results back in the XML. So I want to tranform (XML with some code in language X, Y, ...) --> (XML with the executed code). And that the transformation was language agnostic.
Owning one OpenRC (artoo way) and other three systemd machines
Offline