I’ve written a very simple batch script that will do an XSLT transform for me, to translate a bunch of html files to xml files:
FOR %%i IN (*.htm) DO java -jar saxon.jar -o:"..\Front_Matter\%%i.xml" "%%i" "C:\Documents and Settings\Robert\Desktop\xsl\htm2xml.xsl"
The XSLT works fine, but just the file gets created doesn’t have the desired file name, for example, if the original file name is “Happy Christmas.htm”, I want the output xml to be called “Happy_Christmas.xml”, so there are only just two things, first is to get rid of the .htm part of the original file name, the second is to replace the space by underscore.
The current resulting file name is ugly, like: “Happy Christmas.htm.xml”.
Thanks in advance!
Use
%%~niinstead of%%ito extract the base file name without extension.Use the
%var: =_%syntax to replace spaces in the value of thevarvariable with underscores.So, basically, you need something like this: