Can we use shell script (or any script/programming) to Transform XML using XSLT on Linux?
I want to know how I can work around with XSLTransformation in Linux OS.
Is it possible to use shell script to do that?
开发者_如何学PythonInstalling VS on Windows makes it much easier, because .Net has great support for XSLT 1.0 but never worked on Linux platform.
Just want to know, how you guys work with that.From man xsltproc
:
xsltproc is a command line tool for applying XSLT stylesheets to XML documents. It is part of libxslt(3), the XSLT C library for GNOME. While it was developed as part of the GNOME project, it can operate independently of the GNOME desktop.
On Ubuntu you can apt-cache search xslt
and find a bunch of other options.
Laurence already mentioned xsltproc
. There are also other XSLT processors packaged for Linux distributions. Here is a partial list:
- Saxon 6.5.x (XSLT 1, Java) - Ubuntu, Debian
- Saxon-B (XSLT 2, Java) - Ubuntu, Debian
- Xalan-C++ (XSLT 1, C++) - Ubuntu, Debian
- Xalan-Java (XSLT 1, Java) - Ubuntu, Debian
- xsltproc (XSLT 1, C) - Ubuntu, Debian
All of the packages come with some way of invoking the XSLT processor from the command line so that it can be used from shell scripts, etc.
Building on all of the above and a little more there is also DITA and specifically the DITA Open Toolkit to transform most XML types into other types using XSLTs:
- DITA-OT (XSLT 1 and 2, Java) - use Java install for all platforms
- DITA-OT docs (documentation for the above) - use DITA-OT to transform
- D4P (additional transformation recipes to meet non-tech writing needs)
All open source with permissive licensing (mostly Apache 2.0 or BSD/MIT) as these are specification implementations to be used for any purpose, including commercial purposes. Most commonly they're used to transform DITA to various types HTML and XHTML or DocBook to the same, but there are other recipes in there. The only real limitation is in the availability of XSLTs. The DITA for Publishers User Guide shows how to expand on these recipes with new plugins.
精彩评论