Click here to Skip to main content
14,669,324 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi Friends,
I have the task to convert the XML files to word document, I have the XML with various dtd,
Each DTD have individual Stylesheet, the requirement was XML files must convert with a relevant stylesheet, I tried below code.

What I have tried:

@ECHO * * *

FOR %%i IN (D:\XML_to_Word\*.xml) DO (
@ECHO Start @ %date% %time%
findstr \c "Findstring1" "%%i"   
if %errorlevel%==0 (
D:Saxonica\Transform.exe -s:"%%i" -o:"D:\XML_to_Word\" -xsl:"zzzzz.xslt" -dtd:off 
del "%%i"
findstr "Findstring2" "%%i"
if %errorlevel%==0 (
C:Saxonica\Transform.exe -s:"%%i" -o:"D:\XML_to_Word\" -xsl:"yyyyy.xslt" -dtd:off 
del "%%i"
findstr "Findstring3" "%%i"
if %errorlevel%==0 (
D:Saxonica\Transform.exe -s:"%%i" -o:"D:\XML_to_Word\" -xsl:"xxxx.xslt" -dtd:off
del "%%i"
@ECHO End   @ %date% %time%
@ECHO * * *
Updated 4-Mar-20 5:47am
Richard MacCutchan 23-Feb-18 5:16am
What is the question?
smksamy 23-Feb-18 7:02am
i use the batch file for find the relevant xslt file for xml.
Richard MacCutchan 23-Feb-18 7:25am
No, I asked "what is the question"?
smksamy 23-Feb-18 8:50am
how to use the if else statement in batch file
Richard MacCutchan 23-Feb-18 10:01am
Open a cmd window on your PC and type "help if". The system will provide explanation and examples, especially how to use ERRORLEVEL.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100