bon grace a votre inéstimable aide j'ai fini par trouver
Code :
- // 1. Instantiate a TransformerFactory.
- tFactory = javax.xml.transform.TransformerFactory.newInstance();
- // 2. Use the TransformerFactory to process the stylesheet Source and generate a Transformer.
- xslSource = new javax.xml.transform.stream.StreamSource(request.getRealPath([...]" ));
- // Load the stylesheet. If it's already compiled, Resin will just
- // load the compiled class. More sophisticated application will
- // cache the Templates object.
- stylesheet = tFactory.newTemplates(xslSource);
- // 3.Create a transformer. This could also be called from a
- // cached Templates object. The Transformer should not be cached.
- transformer = stylesheet.newTransformer();
- // 4.Sets a parameter for the xsl:param "source"
- transformer.setParameter("param1", param1);
- transformer.setParameter("param2", param2);
- // 5.The source is a file.
- source = new javax.xml.transform.stream.StreamSource(request.getRealPath([...]));
- // 6.The result is a file.
- StringWriter tampon = new StringWriter();
- PrintWriter sortie = new PrintWriter(tampon);
- result = new javax.xml.transform.stream.StreamResult(sortie);
- transformer.transform(source, result);
- user_agents_list = tampon.toString() ;
- //out.println(user_agents_list);
- sortie.flush();
- sortie.close();
- sortie = null;
|
Voià en esperant que cela vous servent !!