23.7. XSLT Example 1: XSLT Document Editor

Listing 23.13 shows a simple Swing document editor that presents three tabbed panes: one for an XML document, one for an XSL style sheet, and one for a resulting XSLT-transformed document. Both the XML and XSL document panes are editable, so after you load the XML and XSL files from disk you can edit the documents directly. Each tabbed pane contains a scrollable DocumentPane that inherits from a JEditorPane (see Listing 23.14). The XML and XSL panes are treated as plain text, and the XSLT pane is treated as HTML. If an XML file and XSL file are loaded, selecting the XSLT tab will invoke an XslTransformer (Listing 23.12) to process the XML file by using the style sheet, and present the results as HTML ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.