Here you can find the source of internalTransformWithParams(Reader doc, Templates templates, Result r, boolean trace, String[] params)
protected static Result internalTransformWithParams(Reader doc, Templates templates, Result r, boolean trace, String[] params)
//package com.java2s; //License from project: Open Source License import java.io.StringWriter; import javax.xml.transform.Templates; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.stream.StreamSource; import java.io.Reader; public class Main { protected static Result internalTransformWithParams(Reader doc, Templates templates, Result r, boolean trace, String[] params) {//from w w w .ja va 2 s . co m StringWriter sw = new StringWriter(); try { Transformer transformer = templates.newTransformer(); if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) transformer.setParameter("param_" + i, params[i]); } transformer.transform(new StreamSource(doc), r); sw.close(); return r; } catch (Throwable th) { th.printStackTrace(); return r; } } }