57

I want to change an XML file to a modified XML file via an XSLT file and XSLT processing tool.

For example: xsltprocess.exe -src a.xml -dest b.xml -xslt c.xslt

Can anyone assist me?

Tagc
  • 8,736
  • 7
  • 61
  • 114
sjuu
  • 657
  • 1
  • 6
  • 11

8 Answers8

29

If you are looking for an XSLT processor you can use Saxon: http://saxon.sourceforge.net/

You can see the command line options here: http://saxon.sourceforge.net/saxon6.5.1/using-xsl.html

Mathias Schwarz
  • 7,099
  • 23
  • 28
26

Microsoft has a simple command line tool that wraps their XML Parser - http://www.microsoft.com/en-us/download/details.aspx?id=21714.

As @Mathias said though, it only supports XSL 1.0 while Saxon supports XSL 2.0.

To run the convertor you downloaded from the given URL run this command

msxsl.exe backEnd.xml inspectcode.xslt -o backEnd.html

This will tranform the xml file using the xslt file into the output file in html format

Mauricio Gracia Gutierrez
  • 10,288
  • 6
  • 68
  • 99
studgeek
  • 14,272
  • 6
  • 84
  • 96
  • if I remember well, via .NET you could have XSL 2.0 - I think at https://github.com/Zoomicon/tranXform/tree/master/web/tools/XSLTransform I was supporting it (source code available only in zip there at the moment) - I think the trick was to use Mvp.Xml.dll for that (available in the bin subfolder) – George Birbilis Jan 23 '18 at 12:20
  • link is now broken, as of 2021-June – m1m1k Jun 17 '21 at 22:50
  • [new github link](https://zoomicon.github.io/tranXform/tools/XSLTransform/index.html) looks like MS doesn't support the .exe command line tool anymore, instead [a .js file](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms762796(v=vs.85)) [MS XML FAQ](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms757858(v=vs.85)) – m1m1k Jun 17 '21 at 22:55
7
# xsltproc [options] stylesheet file

This program is the simplest way to use libxslt. http://xmlsoft.org/XSLT/xsltproc2.html

athanassis
  • 1,039
  • 8
  • 5
  • 2
    Your example `# ...` indicates that you didn't read the entire question. It's tagged with `windows`. Your Un*x admin command prompt is inappropriate here. The link provided leads to a Gnome site. And the mentioned windows binaries there are far away from "simplest". It's difficult, so I would never recommend this as "simplest". – harper Aug 29 '18 at 08:05
7

You can use AltovaXML XSLT 1.0/2.0 engine (also well-formedness and validity checking). There is free of charge community edition with direct (I mean without Java) command line interface e.g.:

AltovaXML.exe -xslt2 stylesheet.xsl -in input.xml -out output.xml

Check AltovaXML.chm help file for usage.

Grzegorz Szpetkowski
  • 36,988
  • 6
  • 90
  • 137
3

ftp://xmlsoft.org/libxml2/

The Win32 directory has a lot of goodies, next to precompiled binaries for use on commandline.

I'm not linking to the directory directly, since the root of the project has a rich set of tools for - good for everyone's flavor of the month :)

1

You can find some XSLT engine wrappers, XSLer and XSLTransform (one in Delphi and one in .NET) with source code at https://github.com/zoomicon/tranXform

George Birbilis
  • 2,782
  • 2
  • 33
  • 35
1

There are lots of XSLT 1.0 processors available, and a handful of XSLT 2.0 processors, and as far as I know every single one of them runs on Windows and can be called from the command line. If your problem is choosing between them, then you're going to have to tell us more about your requirements and constraints.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
0

XQSharp includes an XSLT 2.0 command line processor. See the Xslt Command Line Reference documentation for details.

Tim
  • 69
  • 2
  • It only has a trial version. I've downloaded it and it doesn't work. Asks to download another version, lol. Don't recommend this tool – nZeus Aug 26 '16 at 12:56