Search in sources :

Example 1 with XSLTProcess

use of org.apache.tools.ant.taskdefs.XSLTProcess in project ant by apache.

the class TraXLiaison method configure.

/**
 * Specific configuration for the TRaX liaison.
 * @param xsltTask the XSLTProcess task instance from which this liaison
 *        is to be configured.
 */
public void configure(final XSLTProcess xsltTask) {
    project = xsltTask.getProject();
    final XSLTProcess.Factory factory = xsltTask.getFactory();
    if (factory != null) {
        setFactory(factory.getName());
        // configure factory attributes
        for (final XSLTProcess.Factory.Attribute attr : Collections.list(factory.getAttributes())) {
            setAttribute(attr.getName(), attr.getValue());
        }
        for (final XSLTProcess.Factory.Feature feature : factory.getFeatures()) {
            setFeature(feature.getName(), feature.getValue());
        }
    }
    final XMLCatalog xmlCatalog = xsltTask.getXMLCatalog();
    // use XMLCatalog as the entity resolver and URI resolver
    if (xmlCatalog != null) {
        setEntityResolver(xmlCatalog);
        setURIResolver(xmlCatalog);
    }
    // configure output properties
    for (final XSLTProcess.OutputProperty prop : Collections.list(xsltTask.getOutputProperties())) {
        setOutputProperty(prop.getName(), prop.getValue());
    }
    suppressWarnings = xsltTask.getSuppressWarnings();
    traceConfiguration = xsltTask.getTraceConfiguration();
}
Also used : XMLCatalog(org.apache.tools.ant.types.XMLCatalog) SAXParserFactory(javax.xml.parsers.SAXParserFactory) TransformerFactory(javax.xml.transform.TransformerFactory) XSLTProcess(org.apache.tools.ant.taskdefs.XSLTProcess)

Example 2 with XSLTProcess

use of org.apache.tools.ant.taskdefs.XSLTProcess in project ant-ivy by apache.

the class IvyRepositoryReport method gen.

private void gen(ResolutionCacheManager cache, String organisation, String module, String style, String ext) {
    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();
}
Also used : ModuleId(org.apache.ivy.core.module.id.ModuleId) XSLTProcess(org.apache.tools.ant.taskdefs.XSLTProcess) File(java.io.File)

Example 3 with XSLTProcess

use of org.apache.tools.ant.taskdefs.XSLTProcess in project ant-ivy by apache.

the class IvyRepositoryReport method genreport.

private void genreport(ResolutionCacheManager cache, String organisation, String module) {
    // 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 xslExt = xslt.createParam();
    xslExt.setName("extension");
    xslExt.setExpression(xslext);
    // add the provided XSLT parameters
    for (XSLTProcess.Param param : params) {
        XSLTProcess.Param realParam = xslt.createParam();
        realParam.setName(param.getName());
        realParam.setExpression(param.getExpression());
    }
    xslt.execute();
}
Also used : ModuleId(org.apache.ivy.core.module.id.ModuleId) XSLTProcess(org.apache.tools.ant.taskdefs.XSLTProcess) File(java.io.File)

Aggregations

XSLTProcess (org.apache.tools.ant.taskdefs.XSLTProcess)3 File (java.io.File)2 ModuleId (org.apache.ivy.core.module.id.ModuleId)2 SAXParserFactory (javax.xml.parsers.SAXParserFactory)1 TransformerFactory (javax.xml.transform.TransformerFactory)1 XMLCatalog (org.apache.tools.ant.types.XMLCatalog)1