ECHO OFF

REM Set up temp working folder, exff folder, Winzip folder and EXPRESS text editor.

set EXFFTEMP=C:\WINDOWS\Temp
set EXFFDIR=C:\$user\data\Eurostep\exff\exff.sourceforge.net
set EXFFZIP=C:\Program Files\WinZip
set EXFFEXPEDIT=C:\Program Files\Accessories\wordpad.exe

echo ** exff u2e - STEP 1 OF 5: Erase old files in exff temp - IGNORE any error message from erase.

cd "%EXFFTEMP%"
if NOT exist "%EXFFTEMP%\exfftemptempdir" goto exffmk

cd exfftemptempdir
erase *.xmi temp.zip express.txt 99-10-15.dtd
cd ..
rmdir exfftemptempdir

:exffmk
mkdir exfftemptempdir
cd exfftemptempdir


echo **
echo ** exff u2e - STEP 2 OF 5: Extract XMI file from Poseidon zargo file.
echo **

copy %1 temp.zip
"%EXFFZIP%\wzunzip.exe" -yb temp.zip *.xmi
If Not ErrorLevel 0 Goto Exit1
rename *.xmi temp.xmi

echo **
echo ** exff u2e - STEP 3 OF 5: Add Doctype to XMI file
echo **

copy "%EXFFDIR%\dtd\99-10-15.dtd" .\99-10-15.dtd
msxsl temp.xmi "%EXFFDIR%\xsl\add_doctypex10.xsl" -o temp2.xmi
If Not ErrorLevel 0 Goto Exit2

echo **
echo ** exff u2e - STEP 4 OF 5: Transform XMI file to EXPRESS text
echo **

msxsl temp2.xmi "%EXFFDIR%\xsl\u13x10toe1_r01.xsl" -o express.txt
If Not ErrorLevel 0 Goto Exit3

echo **
echo ** exff u2e - STEP 5 OF 5: Save the text somewhere
echo **

PAUSE

start "%EXFFEXPEDIT%" express.txt
Goto ExitOK
:Exit1
Echo ***UNZIP failed***
Goto ExitOut
:Exit2
Echo ***Add DOCTYPE failed***
Goto ExitOut
:Exit3
Echo ***Transformation failed***
Goto ExitOut
:ExitOK
echo **
echo ** exff u2e Complete. 
echo **
:ExitOut
PAUSE
EXIT