Today I needed a very quick hack to convert a XML file in a very nice looking and readable HTML file. So I wrote my XSL Transformation file in couple of  minutes and used XMLStarlet to generate HTML file I was asked for. They liked it so much and asked if they could generate HTML out of XML. Sure they could, but I wasn’t sure if they can. So I needed a simple solution to call XMLStarlet without using the command line.

 

THE IDEA

Writing a batch file, that will open a windows “Open Dialog” where you select your XML file. After opening this file the batch process will convert this file into HTML and write it into the same directory where XML is.

 

THE SOLUTION

  • Download Wfile (Homepage)
    Wfile is the key to this Solution. It will be used to create an open dialog out of our batch file.
  •  Create your batch file to call Wfile and process the selected file (this example converts XML to HTML).

Screen Shot 2015-12-06 at 15.35.47I know batch is ugly 😉

 

THE EXPLANATION

I think this batch is not difficult to understand, but one expression might look weird. This one:

 

Screen Shot 2015-12-06 at 15.37.14

This expression will get drive letter + path + filename without extension of the selected XML file. Read more about it…