简体   繁体   中英

Calling an External Perl Script From Within XSLT

我将如何从xslt内调用外部Perl脚本或任何脚本?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM