Maximo Open Forum

 View Only

how to apply an XLST (stylesheet) through batch file on an XML and move the transformed XML to maximo inbound queue

  • 1.  how to apply an XLST (stylesheet) through batch file on an XML and move the transformed XML to maximo inbound queue

    Posted 02-06-2024 22:51

    Hello Experts,

    I have an external system xml and i am able to apply xlst manually and it gives me a new xml as per maximo OS format. I want to automate this process through batch job. Below is the batch code which is not working ? can anyone guide what is wrong with the bat file?

    @echo off
     
    pause
     
    set "sourceFolder=C:\Users\Aayansh\Desktop\AXML"
    set "destinationFolder=C:\Users\Aayansh\Desktop\BXML"
    set "xsltFile=C:\Users\Aayansh\Desktop\transform.xsl"
     
    if not exist "%destinationFolder%" mkdir "%destinationFolder%"
     
    for %%F in ("%sourceFolder%\*.xml") do (
        set "inputFile=%%~fF"
        set "outputFile=!destinationFolder!\%%~nF_output.xml"
        call :applyXslt
    )
     
    echo Done.
    exit /b
     
    :applyXslt
    echo Applying XSLT mapping to !inputFile!...
    @echo off
    msxsl "!inputFile!" "!xsltFile!" -o "!outputFile!" >nul 2>&1
    if errorlevel 1 (
        echo Error applying XSLT mapping to !inputFile!
    ) else (
        echo XSLT mapping applied successfully. Output saved to !outputFile!
    )
    goto :eof

    #EverythingMaximo
    #Integrations
    #MaximoUserGroups

    ------------------------------
    Pradeep Rout
    TCSL
    ------------------------------