Click here to Skip to main content
15,888,065 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 XML2FO
@ECHO Start @ %date% %time%
findstr \c "Findstring1" "%%i"   
if %errorlevel%==0 (
D:Saxonica\Transform.exe -s:"%%i" -o:"D:\XML_to_Word\%%~ni.fo" -xsl:"zzzzz.xslt" -dtd:off 
del "%%i"
)
findstr "Findstring2" "%%i"
if %errorlevel%==0 (
C:Saxonica\Transform.exe -s:"%%i" -o:"D:\XML_to_Word\%%~ni.fo" -xsl:"yyyyy.xslt" -dtd:off 
del "%%i"
)
findstr "Findstring3" "%%i"
if %errorlevel%==0 (
D:Saxonica\Transform.exe -s:"%%i" -o:"D:\XML_to_Word\%%~ni.fo" -xsl:"xxxx.xslt" -dtd:off
del "%%i"
)
@ECHO End   @ %date% %time%
@ECHO * * *
)
Posted
Updated 4-Mar-20 5:47am
Comments
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900