@Override public ValidationResult validate(final String subject, final String input, final ValidationContext validationContext) { final Tuple<String, ValidationResult> lastResult = this.cachedResult; if (lastResult != null && lastResult.getKey().equals(input)) { return lastResult.getValue(); } else { String error = null; final File stylesheet = new File(input); final TransformerFactory tFactory = new net.sf.saxon.TransformerFactoryImpl(); final StreamSource styleSource = new StreamSource(stylesheet); try { tFactory.newTransformer(styleSource); } catch (final Exception e) { error = e.toString(); } this.cachedResult = new Tuple<>(input, new ValidationResult.Builder() .input(input) .subject(subject) .valid(error == null) .explanation(error) .build()); return this.cachedResult.getValue(); } } }
factory = new net.sf.saxon.TransformerFactoryImpl();
public static String saxonTransform(String source, String xslt) throws TransformerException, FileNotFoundException { TransformerFactoryImpl f = new net.sf.saxon.TransformerFactoryImpl(); f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE); StreamSource xsrc = new StreamSource(new FileInputStream(xslt)); Transformer t = f.newTransformer(xsrc); StreamSource src = new StreamSource(new FileInputStream(source)); StreamResult res = new StreamResult(new ByteArrayOutputStream()); t.transform(src, res); return res.getOutputStream().toString(); }
public static byte[] saxonTransform(Map<String, byte[]> files, byte[] source, byte[] xslt) throws Exception { TransformerFactory f = new net.sf.saxon.TransformerFactoryImpl(); f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE); StreamSource xsrc = new StreamSource(new ByteArrayInputStream(xslt)); f.setURIResolver(new ZipURIResolver(files)); Transformer t = f.newTransformer(xsrc); t.setURIResolver(new ZipURIResolver(files)); StreamSource src = new StreamSource(new ByteArrayInputStream(source)); ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamResult res = new StreamResult(out); t.transform(src, res); return out.toByteArray(); }
public static byte[] saxonTransform(Map<String, byte[]> files, byte[] source, byte[] xslt) throws TransformerException { TransformerFactory f = new net.sf.saxon.TransformerFactoryImpl(); f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE); StreamSource xsrc = new StreamSource(new ByteArrayInputStream(xslt)); f.setURIResolver(new ZipURIResolver(files)); Transformer t = f.newTransformer(xsrc); t.setURIResolver(new ZipURIResolver(files)); StreamSource src = new StreamSource(new ByteArrayInputStream(source)); ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamResult res = new StreamResult(out); t.transform(src, res); return out.toByteArray(); }
data.factory = new net.sf.saxon.TransformerFactoryImpl();
public static void saxonTransform(String xsltDir, String source, String xslt, String dest, URIResolver alt, Map<String, String> params) throws FileNotFoundException, TransformerException { TransformerFactoryImpl f = new net.sf.saxon.TransformerFactoryImpl(); f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE); StreamSource xsrc = new StreamSource(new FileInputStream(xslt)); f.setURIResolver(new MyURIResolver(xsltDir, alt)); Transformer t = f.newTransformer(xsrc); if (params != null) { for (Map.Entry<String, String> entry : params.entrySet()) { t.setParameter(entry.getKey(), entry.getValue()); } } t.setURIResolver(new MyURIResolver(xsltDir, alt)); StreamSource src = new StreamSource(new FileInputStream(source)); StreamResult res = new StreamResult(new FileOutputStream(dest)); t.transform(src, res); }
private TransformerFactory createTransformerFactory() { return new TransformerFactoryImpl( this.configuration ); }
public static Templates getTemplates() throws TransformerConfigurationException { if (templates != null) { return templates; } else { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream xsltStream = classLoader.getResourceAsStream(resourceURL); StreamSource xslt = new StreamSource(xsltStream); TransformerFactory tf = new TransformerFactoryImpl(); return tf.newTemplates(xslt); } } }
protected TransformerFactory createTransformerFactory() { if (getConfiguration() != null) { return new TransformerFactoryImpl(getConfiguration()); } else { return new TransformerFactoryImpl(); } }
protected TransformerFactory createTransformerFactory() { if (getConfiguration() != null) { return new TransformerFactoryImpl(getConfiguration()); } else { return new TransformerFactoryImpl(); } }
private Transformer createTransformer(Task task, String xsltFile) throws TransformerFactoryConfigurationError, TransformerConfigurationException { StreamSource styleSource; File xslt = new File(task.getTransformDirectory() + "/" + xsltFile); if (xslt.exists()) { styleSource = new StreamSource(xslt); } else { logInfo("Loading predefined xslt file:" + xsltFile); styleSource = new StreamSource(this.getClass().getResourceAsStream(xsltFile)); } TransformerFactory transformerFactory = new net.sf.saxon.TransformerFactoryImpl(); return transformerFactory.newTransformer(styleSource); }
public XQuery10ExpressionCompilerImpl(String bpelNS) { _bpelNS = bpelNS; _qnLinkStatus = new QName(_bpelNS, Constants.EXT_FUNCTION_GETLINKSTATUS); _qnVarProp = new QName(_bpelNS, Constants.EXT_FUNCTION_GETVARIABLEPROPERTY); _qnVarData = new QName(_bpelNS, Constants.EXT_FUNCTION_GETVARIABLEDATA); _qnXslTransform = new QName(_bpelNS, Constants.EXT_FUNCTION_DOXSLTRANSFORM); _properties.put("runtime-class", "org.apache.ode.bpel.elang.xquery10.runtime.XQuery10ExpressionRuntime"); TransformerFactory trsf = new net.sf.saxon.TransformerFactoryImpl(); XslTransformHandler.getInstance().setTransformerFactory(trsf); }
private Transformer createTransformer(Task task, String xsltFile) throws TransformerFactoryConfigurationError, TransformerConfigurationException { StreamSource styleSource; File xslt = new File(task.getTransformDirectory() + "/" + xsltFile); if (xslt.exists()) { styleSource = new StreamSource(xslt); } else { logInfo("Loading predefined xslt file:" + xsltFile); styleSource = new StreamSource(this.getClass().getResourceAsStream(xsltFile)); } TransformerFactory transformerFactory = new net.sf.saxon.TransformerFactoryImpl(); return transformerFactory.newTransformer(styleSource); }
public static String saxonTransform(String source, String xslt) throws TransformerException, FileNotFoundException { TransformerFactoryImpl f = new net.sf.saxon.TransformerFactoryImpl(); f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE); StreamSource xsrc = new StreamSource(new FileInputStream(xslt)); Transformer t = f.newTransformer(xsrc); StreamSource src = new StreamSource(new FileInputStream(source)); StreamResult res = new StreamResult(new ByteArrayOutputStream()); t.transform(src, res); return res.getOutputStream().toString(); }
public static byte[] saxonTransform(Map<String, byte[]> files, byte[] source, byte[] xslt) throws Exception { TransformerFactory f = new net.sf.saxon.TransformerFactoryImpl(); f.setAttribute("http://saxon.sf.net/feature/version-warning", Boolean.FALSE); StreamSource xsrc = new StreamSource(new ByteArrayInputStream(xslt)); f.setURIResolver(new ZipURIResolver(files)); Transformer t = f.newTransformer(xsrc); t.setURIResolver(new ZipURIResolver(files)); StreamSource src = new StreamSource(new ByteArrayInputStream(source)); ByteArrayOutputStream out = new ByteArrayOutputStream(); StreamResult res = new StreamResult(out); t.transform(src, res); return out.toByteArray(); }
public CompiledScript compile(Reader script) throws ScriptException { try { TransformerFactory factory = new TransformerFactoryImpl(); Templates templates = factory.newTemplates(new StreamSource(script)); return new XsltCompiledScript(this, templates); } catch(TransformerException e) { throw new ScriptException(e); } }
public XPath10ExpressionCompilerBPEL20(String bpelNS) { super(bpelNS); TransformerFactory trsf = new net.sf.saxon.TransformerFactoryImpl(); XslTransformHandler.getInstance().setTransformerFactory(trsf); _qnDoXslTransform = new QName(bpelNS, "doXslTransform"); }
public Object eval(Reader reader, ScriptContext context) throws ScriptException { Transformer transformer; try { TransformerFactory factory = new TransformerFactoryImpl(); transformer = factory.newTransformer(new StreamSource(reader)); } catch(Exception e) { throw new ScriptException(e); } return evaluate(transformer, context); }
/** * Initialize XSL Transformer * * @param properties properties * * @throws ConfigurationException ConfigurationException */ public void initialize(Map properties) throws ConfigurationException { TransformerFactory trsf = new net.sf.saxon.TransformerFactoryImpl(); XslTransformHandler.getInstance().setTransformerFactory(trsf); }