Examples of XSLTProcess


Examples of org.apache.tools.ant.taskdefs.XSLTProcess

        FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report-dot-all.xsl"), style, null);
        return style.getAbsolutePath();
    }
   
    private void gen(CacheManager cache, String organisation, String module, String style, String ext) throws IOException {       
        XSLTProcess xslt = new XSLTProcess();
        xslt.setTaskName(getTaskName());
        xslt.setProject(getProject());
        xslt.init();
       
        String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
        xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
        xslt.setOut(new File(_todir, _outputname+"."+ext));
        xslt.setBasedir(cache.getCache());
        xslt.setStyle(style);
        xslt.execute();
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

        Project project = task.getProject();

        TempFile tempFileTask = new TempFile();
        tempFileTask.bindToOwner(task);

        XSLTProcess xsltTask = new XSLTProcess();
        xsltTask.bindToOwner(task);

        xsltTask.setXslResource(getStylesheet());

        // acrobatic cast.
        xsltTask.setIn(((XMLResultAggregator) task).getDestinationFile());
        File outputFile = null;
        if (format.equals(FRAMES)) {
            String tempFileProperty = getClass().getName() + String.valueOf(counter++);
            File tmp = FILE_UTILS.resolveFile(project.getBaseDir(), project
                    .getProperty("java.io.tmpdir"));
            tempFileTask.setDestDir(tmp);
            tempFileTask.setProperty(tempFileProperty);
            tempFileTask.execute();
            outputFile = new File(project.getProperty(tempFileProperty));
        } else {
            outputFile = new File(toDir, "junit-noframes.html");
        }
        xsltTask.setOut(outputFile);
        for (Iterator i = params.iterator(); i.hasNext();) {
            XSLTProcess.Param param = (XSLTProcess.Param) i.next();
            XSLTProcess.Param newParam = xsltTask.createParam();
            newParam.setProject(task.getProject());
            newParam.setName(param.getName());
            newParam.setExpression(param.getExpression());
        }
        XSLTProcess.Param paramx = xsltTask.createParam();
        paramx.setProject(task.getProject());
        paramx.setName("output.dir");
        paramx.setExpression(toDir.getAbsolutePath());
        final long t0 = System.currentTimeMillis();
        try {
            xsltTask.execute();
        } catch (Exception e) {
            throw new BuildException("Errors while applying transformations: " + e.getMessage(), e);
        }
        final long dt = System.currentTimeMillis() - t0;
        task.log("Transform time: " + dt + "ms");
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

        Project project = task.getProject();

        TempFile tempFileTask = new TempFile();
        tempFileTask.bindToOwner(task);

        XSLTProcess xsltTask = new XSLTProcess();
        xsltTask.bindToOwner(task);

        xsltTask.setXslResource(getStylesheet());

        // acrobatic cast.
        xsltTask.setIn(((XMLResultAggregator) task).getDestinationFile());
        File outputFile = null;
        if (format.equals(FRAMES)) {
            String tempFileProperty = getClass().getName() + String.valueOf(counter++);
            File tmp = FILE_UTILS.resolveFile(project.getBaseDir(), project
                    .getProperty("java.io.tmpdir"));
            tempFileTask.setDestDir(tmp);
            tempFileTask.setProperty(tempFileProperty);
            tempFileTask.execute();
            outputFile = new File(project.getProperty(tempFileProperty));
        } else {
            outputFile = new File(toDir, "junit-noframes.html");
        }
        xsltTask.setOut(outputFile);
        for (Iterator i = params.iterator(); i.hasNext();) {
            XSLTProcess.Param param = (XSLTProcess.Param) i.next();
            XSLTProcess.Param newParam = xsltTask.createParam();
            newParam.setProject(task.getProject());
            newParam.setName(param.getName());
            newParam.setExpression(param.getExpression());
        }
        XSLTProcess.Param paramx = xsltTask.createParam();
        paramx.setProject(task.getProject());
        paramx.setName("output.dir");
        paramx.setExpression(toDir.getAbsolutePath());
        final long t0 = System.currentTimeMillis();
        try {
            xsltTask.execute();
        } catch (Exception e) {
            throw new BuildException("Errors while applying transformations: " + e.getMessage(), e);
        }
        final long dt = System.currentTimeMillis() - t0;
        task.log("Transform time: " + dt + "ms");
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

    }

    private void genreport(ResolutionCacheManager cache, String organisation, String module)
            throws IOException {
        // first process the report with xslt
        XSLTProcess xslt = new XSLTProcess();
        xslt.setTaskName(getTaskName());
        xslt.setProject(getProject());
        xslt.init();

        String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
        xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
        xslt.setOut(new File(getTodir(), outputname + "." + xslext));

        xslt.setStyle(xslFile);

        XSLTProcess.Param param = xslt.createParam();
        param.setName("extension");
        param.setExpression(xslext);

        // add the provided XSLT parameters
        for (Iterator it = params.iterator(); it.hasNext();) {
            param = (XSLTProcess.Param) it.next();
            XSLTProcess.Param realParam = xslt.createParam();
            realParam.setName(param.getName());
            realParam.setExpression(param.getExpression());
        }

        xslt.execute();
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

        return style.getAbsolutePath();
    }

    private void gen(ResolutionCacheManager cache, String organisation, String module, String style,
            String ext) throws IOException {
        XSLTProcess xslt = new XSLTProcess();
        xslt.setTaskName(getTaskName());
        xslt.setProject(getProject());
        xslt.init();

        String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
        xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
        xslt.setOut(new File(getTodir(), outputname + "." + ext));
        xslt.setBasedir(cache.getResolutionCacheRoot());
        xslt.setStyle(style);
        xslt.execute();
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

      FileCopy.copyStreamToFile( in, xslFile );
    } catch (IOException e) {
      throw new IllegalStateException( "Could not copy " + JUNIT_XSL + " to results directory" );
    }

    final XSLTProcess xslt = new XSLTProcess();
    xslt.setProject( project );
    xslt.setStyle( xslFile.getAbsolutePath() );
    xslt.setBasedir( resultsDirectory );
    xslt.setIncludes( junitReportResult );
    xslt.setDestdir( resultsDirectory );
    xslt.execute();

    // show overall success/failure message in the console
    final boolean success = (testRunnerResult == AutoTestRunner.SUCCESS);
    final String summary = "TEST RESULT: "
        + (success ? "all tests passed" : "there were some test failures or errors\n");
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

  public void setUp() {
    // configureProject("build.xml"); // initialize Ant
    xsltunit = new XSLTTest();
    xsltunit.setProject(new Project());
    XSLTProcess.Factory factory = new XSLTProcess().createFactory();
    factory.setName("net.sf.saxon.TransformerFactoryImpl");
    xsltunit.addConfiguredFactory(factory);
  }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

    xsltunit.setTarget("target/output");
   
    xsltunit.addFileset(fileset);
   
    try {
        xsltunit.addConfiguredFactory(new XSLTProcess().createFactory());
        fail("multiple factories not permitted");
    } catch (BuildException be) {
        // ok
    }
  }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

   * @param in the input filename
   * @param out the output filename
   * @param xsl the template filename
   */
  private void transform(String in, String out, String xsl) throws BuildException {
    XSLTProcess transformer = new XSLTProcess();
    transformer.setProject(getProject());
    transformer.getXMLCatalog().setProject(getProject());
    transformer.setIn(new File(in));
    transformer.setOut(new File(out));
    transformer.setStyle(xsl);
    if (licenseFolder != null)
      transformer.setClasspath(new Path(getProject(), licenseFolder));
    transformer.setProcessor("trax");
           
    XSLTProcess.Factory factory = transformer.createFactory()
    factory.setName(this.factory.getName());
    log("javax.xml.transform.TransformerFactory=" + transformer.getFactory().getName(), Project.MSG_INFO);
    for (Enumeration e = this.factory.getAttributes(); e.hasMoreElements(); ) {
        XSLTProcess.Factory.Attribute attr = (XSLTProcess.Factory.Attribute) e.nextElement();
        log(attr.getName() + "=" + attr.getValue(), Project.MSG_INFO);
        factory.addAttribute(attr);
    }
   
    transformer.setTaskName("xslt")
       
   
   
    transformer.execute();
  }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.XSLTProcess

    }

    private void genreport(ResolutionCacheManager cache, String organisation, String module)
            throws IOException {
        // first process the report with xslt
        XSLTProcess xslt = new XSLTProcess();
        xslt.setTaskName(getTaskName());
        xslt.setProject(getProject());
        xslt.init();

        String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
        xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
        xslt.setOut(new File(todir, outputname + "." + xslext));

        xslt.setStyle(xslFile);

        XSLTProcess.Param param = xslt.createParam();
        param.setName("extension");
        param.setExpression(xslext);

        // add the provided XSLT parameters
        for (Iterator it = params.iterator(); it.hasNext();) {
            param = (XSLTProcess.Param) it.next();
            XSLTProcess.Param realParam = xslt.createParam();
            realParam.setName(param.getName());
            realParam.setExpression(param.getExpression());
        }

        xslt.execute();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.