@echo off
setlocal

set dist=%~dp0

set jars=%dist%\xerces.jar;%dist%\resolver.jar

if exist "%dist%\xxe.jar" goto jar
set cp=%dist%\..\class;%jars%
goto fi
:jar
set cp=%dist%\xxe.jar;%jars%
:fi

set config_dir=%dist%\..\addon\config
set c1=%config_dir%\catalog.xml
set c2=%config_dir%\dita\catalog.xml
set c3=%config_dir%\docbook\catalog.xml
set c4=%config_dir%\xhtml\catalog.xml
if exist "%c1%" set XML_CATALOG_FILES=%c1%;%c2%;%c3%;%c4%;%XML_CATALOG_FILES%

if exist "%dist%\jre\bin\java.exe" goto privatejre
set java=java
goto fi2
:privatejre
set java=%dist%\jre\bin\java.exe
:fi2

"%java%" -Dxml.catalog.files="%XML_CATALOG_FILES%" -classpath "%cp%" com.xmlmind.xmledit.stylesheet.StyleSheetLoader %*
