View Javadoc
1 package net.sf.flock.support; 2 3 import java.util.HashMap; 4 import java.util.Map; 5 6 import org.jdom.DocType; 7 import org.jdom.Document; 8 import org.jdom.ProcessingInstruction; 9 10 /*** 11 * Exporter wrapper - prepends an XSL stylesheet processing instruction. 12 * 13 * @version $Revision: 1.3 $ 14 * @author $Author: phraktle $ 15 */ 16 public class StylesheetExportFilter { 17 18 private final String stylesheet; 19 20 public StylesheetExportFilter(String stylesheet) { 21 this.stylesheet = stylesheet; 22 } 23 24 public Document filter(Document originalDoc) { 25 26 Document doc = new Document(); 27 doc.setDocType( (DocType)originalDoc.getDocType().clone() ); 28 29 Map m = new HashMap(); 30 m.put("href", this.stylesheet); 31 m.put("type", "text/xsl"); 32 doc.addContent( new ProcessingInstruction("xml-stylesheet", m) ); 33 34 doc.setRootElement( originalDoc.detachRootElement() ); 35 return doc; 36 } 37 38 }

This page was automatically generated by Maven