(view source code of xml2xpath.bat as plain text)
@ECHO OFF
:: Check Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
:: A single mandatory command line argument
IF "%~1"=="" GOTO Syntax
IF NOT "%~2"=="" GOTO Syntax
:: Command line arguments must be an XML file
IF /I NOT "%~x1"==".xml" GOTO Syntax
:: File must exist
IF NOT EXIST "%~f1" GOTO Syntax
:: XSL file must exist
IF NOT EXIST "%~dpn0.xsl" GOTO Syntax
:: Saxon must be available; hard-coded path to executable may need to be modified to match your own system
IF NOT EXIST "%ProgramFiles%\Saxon\bin\Transform.exe" IF NOT EXIST "%ProgramFiles(x86)%\Saxon\bin\Transform.exe" GOTO Syntax
SETLOCAL
IF EXIST "%ProgramFiles%\Saxon\bin\Transform.exe" SET Transform="%ProgramFiles%\Saxon\bin\Transform.exe"
IF EXIST "%ProgramFiles(x86)%\Saxon\bin\Transform.exe" SET Transform="%ProgramFiles(x86)%\Saxon\bin\Transform.exe"
%Transform% -s:"%~f1" -xsl:"%~dpn0.xsl" 2>NUL
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO XML2XPath.bat, Version 1.00 for Windows 2000 and later
ECHO Display an XML file as a list of XPath statements
ECHO.
ECHO Usage: XML2XPATH xmlfile.xml
ECHO.
ECHO Notes:
ECHO Requires XML2XPath.xsl, located in the same directory as this batch file.
ECHO XSL borrowed from Paul Gallagher:
ECHO tardate.blogspot.com/2007/02/extracting-xpath-refs-from-xml-document.html
ECHO Requires Saxon XSLT processor: http://saxon.sourceforge.net/
ECHO Hard-coded path to Saxon's Transform.exe may need to be modified.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" COLOR 00
page last modified: 2024-04-16; loaded in 0.0077 seconds