Announcement

Collapse
No announcement yet.

How to automatically preprocess XML files (with XSL) before comparison in BC3 ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to automatically preprocess XML files (with XSL) before comparison in BC3 ?

    Hello,

    I have some complex XML files with many information which i would like to filter (not to compare). For that i did a XSLT which extract the important information and generate a CSV file which i would like to compare with beyond compare 3.

    So far, i "manually" run the XSLT transformation with a batch file and then i launch BC3 to compare the 2 generated CSV files. I would like to improve that process so that the XSLT file is executed directly from BC3 when i start the comparison of my XML files. Is it possible ? Is there a tutorial explaining it ?

    Thank you
    Philippe

  • #2
    Hello,

    Yes, we have an article detailing how to auto-run a pre-process (External Conversion) here:
    http://www.scootersoftware.com/suppo...rnalconversion

    This specific example uses an RESX conversion. We also have a few examples for download on our File Formats download page. In fact, we have an XML Sorted and Tidied that uses both a sort and an XSLT, which you could download and review. Is is in the "Alternatives" section:
    http://www.scootersoftware.com/downl...kb_moreformats

    After you've created your format, if you feel other users might benefit, please feel free to post your results here or email them to us at [email protected] with a set of example files.
    Aaron P Scooter Software

    Comment


    • #3
      Thank you Aaron, i will try it today

      Comment


      • #4
        Hello Aaron,
        What i did so far is not working. When i drag and drop the 2 files i want to compare i get an error "Conversion Error".
        The preprocess tool i am using to convert my files (xml to csv) is a batch file and works ok when i run it in command line.
        Is there in BC3 a log which could tell me more about the error i get ?
        Thank you
        Philippe

        Comment


        • #5
          Hello,

          Does your conversion return an error code on the command line? If it does, please try placing it inside of a batch file to swallow this return.

          BC3 does not have a log for the Conversion Error. We try to show whatever message is passed back by the tool, but default to that message if there is no content. This message will also display if the generated temp file is entirely blank.
          Aaron P Scooter Software

          Comment


          • #6
            Hello Aaron,
            Here is the batch file which should run on both files i want to compare. From a Dos command line, it is working fine.
            go.bat:
            -------
            cls
            @Echo on
            set jre=D:\DATA\ts_mirr\xml\jre1.5.0\bin\java.exe
            set saxon=D:\DATA\ts_mirr\xml\Saxon-B\saxon9.jar
            %jre% -jar %saxon% -s:%1 -xsl:autosar2csv.xsl -o:%2
            Echo End transformation

            I think my problem is on the BC configuration: In the file formats dialog, i set the conversion as following:
            Conversion:
            External program (ANSI filenames)
            loading : Helpers\Autosar\go.bat %s %t
            Disable editing is not checked
            Saving is empty

            Do you see any wrong configuration of the conversion options ?

            Thank you in advance
            Philippe

            Comment


            • #7
              Hello,

              With the command line go.bat "source.txt" "temptext.txt", when run from the Windows Command Prompt, ends up with a temptext.txt file which contains the plain text you wish to display in BC3? If so, I would expect this to work when called from within BC3, too.

              We'll display the error if, for example, temptext.txt was empty (as this usually indicates a failed conversion).

              Maybe try an absolute command line, including the quote characters:
              "C:\Program Files (x86)\Beyond Compare 3\Helpers\Autosar\go.bat" "%s" "%t"

              Does this help provide any additional information?
              Aaron P Scooter Software

              Comment


              • #8
                Hello Aaron,
                Thank you for the tip. It works perfect now.
                I had to put the relative path to my xsl in my batch file

                go.bat
                ------
                cls
                @Echo on
                set saxon=Helpers\Autosar\saxon9.jar
                java.exe -jar %saxon% -s:%1 -xsl:"Helpers\Autosar\autosar2csv.xsl" -o:%2
                Echo End transformation

                Thank you
                Philippe

                Comment

                Working...
                X