catch( Exception e )
catch( BuildException e )
    private void transformFile( Transformer transformer, File content, File srcDir,                                String base, String extension, File toDir )    {        System.setProperty( "user.dir", toDir.getAbsolutePath() );        final String year = getYear();        final String org = getOrganization();        final String copyright =          "Copyright "           + year           + ", "           + org           + " All rights reserved.";        final String svnRoot = getProject().getProperty( DOC_ANCHOR_URL_KEY );        final String svnSource = svnRoot + getRelSrcPath( srcDir ) + "/" + base;        final int pos = base.lastIndexOf( '.' );        if( pos > 0 )        {            base = base.substring( 0, pos );        }        base = base + extension;        final File newDest = new File( toDir, base );        final StreamSource xml = new StreamSource( content );        final StreamResult out = new StreamResult( newDest );        transformer.clearParameters();        transformer.setParameter( "directory", getRelToPath( toDir ) );        transformer.setParameter( "fullpath", getRelToPath( newDest ) );        transformer.setParameter( "file", base );        transformer.setParameter( "svn-location", svnSource );        transformer.setParameter( "copyright", copyright );        transformer.setParameter(            "logoright_file",            getProject().getProperty( DOC_LOGO_RIGHT_FILE_KEY ).trim() );        transformer.setParameter(            "logoright_url",            getProject().getProperty( DOC_LOGO_RIGHT_URL_KEY ).trim() );        transformer.setParameter(            "logoleft_file",            getProject().getProperty( DOC_LOGO_LEFT_FILE_KEY ).trim() );        transformer.setParameter(            "logoleft_url",            getProject().getProperty( DOC_LOGO_LEFT_URL_KEY ).trim() );        transformer.setParameter(            "logomiddle_file",            getProject().getProperty( DOC_LOGO_MIDDLE_FILE_KEY ).trim() );        transformer.setParameter(            "logomiddle_url",            getProject().getProperty( DOC_LOGO_MIDDLE_URL_KEY ).trim() );        transformer.setParameter(            "brand_name",            getProject().getProperty( DOC_BRAND_NAME_KEY ).trim() );        transformer.setParameter( "generated_date", getNow() );        setOtherProperties( transformer );        try        {            transformer.transform( xml, out );        }        catch( Exception e )        {            log( "ERROR: " + getRelToPath( newDest ) + " : " + e.getMessage() );            throw new BuildException( "Unable to transform document." );        }    }