Skip to content Skip to sidebar Skip to footer

I Need A Simple Command Line Program To Transform Xml Using An Xsl Stylesheet

I am on OSX Snow Leopard (10.6.2) I can install anything I need to. I would preferably like a Python or Java solution. I have searched on Google and found lots of information on wr

Solution 1:

Have you tried 'xsltproc'? It's probably already installed.

http://xmlsoft.org/XSLT/xsltproc2.html

Solution 2:

I'd recommend Saxon, which can be run from the command line like so:

java -jar /path/to/saxon.jar xmlfile xslfile

Solution 3:

If I assume correctly that you want to supply a stylesheet and an XML document then Xalan-J has a command line feature you can use to do this:

http://xml.apache.org/xalan-j/commandline.html

which can be invoked with:

java org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out

Solution 4:

Have you seen XMLStarlet (an XML command line toolset) ? It does lots of XML-related querying transformation, and in particular:

xml tr --help
XMLStarlet Toolkit: Transform XML document(s) using XSLT
Usage: xml tr [<options>] <xsl-file> {-p|-s <name>=<value>} [ <xml-file-or-uri> ... ]
where
   <xsl-file>      - main XSLT stylesheet for transformation
   <xml-file>      - input XML document file name (stdin is used if missing)
   <name>=<value>  - name andvalue of the parameter passed to XSLT processor
   -p              - parameter is XPATH expression ("'string'" to quote string)
   -s              - parameter is a string literal

Further documentation here.

Solution 5:

Post a Comment for "I Need A Simple Command Line Program To Transform Xml Using An Xsl Stylesheet"