Reputation: 593
How would I go about calling an external Perl script, or any script, from within an xslt?
Upvotes: 1
Views: 680
Reputation: 4581
Please look at the register_function()
method in XML::LibXSLT
. The XML::LibXSLT
documentation has a small example how to register a small perl function to be used in an XSLT stylesheet. From personal experience, there's no problem to define also larger functions here.
Upvotes: 3
Reputation: 57600
This doesn't make any sense. Tying an XSLT stylesheet to external commands would void any portability, especially to browsers.
Specific XSLT processors could allow scripting¹, but this won't be generally available. The XSLT specification does not contain anything related to calling external commands. The spec does say how extensions to the language are handled, which makes it possible for vendors to include supports for scripting or calling external commands.
If your problem cannot be solved in the (Turing-complete) XSLT language, then it may be the wrong tool for your job. Rewriting some parts in Python or Perl may be more appropriate.
1. A Microsoft implementation allows you to define extra functions in JavaScript.
Upvotes: 0