January 2002
Intermediate to advanced
480 pages
11h 5m
English
Although you often might find it useful to load DOM trees before applying style sheets, many times, you already have an XML document and a style sheet and you just want to perform the transform. In these cases, you can use a stream source and a stream result to simply perform the transform without an intermediate DOM representation.
Listing 10.10 shows a JSP that uses getResourceAsStream and a Transformer to apply a style sheet without using DOM at all.
<%@ page contentType=”text/html” %><%@ page import=”javax.xml.parsers.*,org.w3c.dom.*” %><%@ page import=”javax.xml.transform.*,javax.xml.transform.dom.*” %><%@ page import=”javax.xml.transform.stream.*,java.io.*” %><% // Create ... |
Read now
Unlock full access