[Home] [By Thread] [By Date] [Recent Entries]
Florent Georges wrote:
echo %1| findstr /E /C:.xslt >nul I meant to refer to my original message. This is just a snippet, where you still have to create the instructions under the labels XMLFIRST and XMLSECOND. The following line: echo %1| findstr /E /C:.xslt >nul does the trick for determining whether the first command parameter ends with ".xslt". It is not easy to match if there are quotes involved, but remove "/E" and it will match any part in the first parameter. If you do use "/E", make sure there is no space between "%1" and "|". Also, of course, if your stylesheets are named ".xsl", change the line to: echo %1| findstr /E /C:.xsl >nul Here's a copy of the whole batch file for clarity. @echo off REM The pipeline and %1 may not have a space between! echo %1| findstr /E /C:.xslt >nul if ERRORLEVEL 1 goto XMLFIRST goto XMLSECOND REM The XML file is the first argument, this is normal :XMLFIRST echo Xml file is first argument echo saxon %1 %2 saxon %1 %2 goto END REM The XML file is the second argument, switch them :XMLSECOND echo Xml file is second argument, switching arguments echo saxon %2 %1 saxon %2 %1 goto END :END It works on Windows and solves the following commandlines, but you need more logic if you want to insert more parameters (because %1 will not be a file anymore, but a commandline switch): saxon somesource.xml somestylesheet.xslt saxon somestylesheet.xslt somesource.xml does not solve (etc): saxon -it main somestylesheet.xslt It would be nice if the OP would answer with what he/she wants. -- Abel
|

Cart



