XLST biến đổi bằng cách sử dụng JDOM Vì vậy, bạn đã sử dụng JAXP để biến đổi sử dụng . Bạn cũng có thể viết chương trình Java của bạn bằng cách sử dụng JDOM thay vì Chương 14: Chuyển đổi và đóng tài liệu XML của bạn | Chapter 14 Transforming and Binding Your XML Documents head title xsl value-of select TITLE title head body h1 xsl value-of select TITLE h1 xsl apply-templates select ACT body html xsl template xsl template match ACT xsl apply-templates xsl template xsl template match SCENE xsl apply-templates xsl template xsl template match SPEECH br xsl apply-templates xsl template xsl template match SPEAKER br b xsl apply-templates b xsl template xsl template match TITLE br h2 xsl apply-templates h2 xsl template xsl template match STAGEDIR br em xsl apply-templates em xsl template xsl template match LINE br xsl apply-templates xsl template xsl stylesheet XLST transformations using JDOM So far you ve used JAXP to transform using . You could also have written your Java program using JDOM instead of JAXP. Just like the JAXP program Transform1 Transform2 is an adaptation of CueMyLine5. In Chapter 13 you created this program to make changes to by using JDOM and then saved the changes. You may need to refer back to Chapter 13 to review setting up your computer to run JDOM applications. Here s a partial listing of the JDOM version of CueMyLine5java package cue imports 276 Chapter 14 Transforming and Binding Your XML Documents public class CueMyLine5 Document document public CueMyLine5 try SAXBuilder builder new SAXBuilder document new File catch JDOMException e There s a JDOM problem. public void addPrologue . public void saveTheDocument try XMLOutputter xmlOutputter new XMLOutputter true true document new FileWriter catch Exception e Transformer Config Exception public static void main String args CueMyLine5 cueMyLine new CueMyLine5 As with Transforml other than renaming the class and methods you need to make surprisingly few alterations. You will create in the