protected File transformInputFile ( File from ) throws MojoExecutionException { // create a temp file File tempFile ; try { tempFile = File . createTempFile ( "dotml-tmp" , ".xml" ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "error creating temp file to hold DOTML to DOT translation" , e ) ; } // perform an XSLT transform from the input file to the temp file Source xml = new StreamSource ( from ) ; Result result = new StreamResult ( tempFile ) ; try { Source xslt = new StreamSource ( getClass ( ) . getClassLoader ( ) . getResourceAsStream ( "dotml/dotml2dot.xsl" ) ) ; transformerFactory . newTransformer ( xslt ) . transform ( xml , result ) ; } catch ( TransformerException e ) { throw new MojoExecutionException ( String . format ( "error transforming %s from DOTML to DOT file" , from ) , e ) ; } // return the temp file return tempFile ; }
when we are using DOTML files we need to transform them to DOT files first .