JSP: Utlisation de XSLT dans une page JSP

Author:
       

/*
  Java, XML, and Web Services Bible
  Mike Jasnowski
  ISBN: 0-7645-4847-6
*/
<%@ page contentType="image/svg-xml" %>
<%@ page import="org.xml.sax.*" %>
<%@ page import="org.apache.xalan.xslt.*" %>
<%@ page import="java.io.*" %>
<%

try {

    XSLTProcessor processor = XSLTProcessorFactory.getProcessor(); 
       
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    
    processor.process(new XSLTInputSource("games.xml"),
                      new XSLTInputSource("games.xsl"),
                    new XSLTResultTarget(bos));

    out.println(bos);
    
} catch (Exception ex) {
    out.println(ex);
}

%>




  XML Invaders
  A Node in the XPath
  XPath Racers


//games.xsl

















           
              

Leave a Reply

Your email address will not be published. Required fields are marked *