|
|||||||||||||||||||
This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
StylesheetExportFilter.java | - | 0% | 0% | 0% |
|
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 | 0 |
public StylesheetExportFilter(String stylesheet) { |
21 | 0 |
this.stylesheet = stylesheet; |
22 |
} |
|
23 |
|
|
24 | 0 |
public Document filter(Document originalDoc) { |
25 |
|
|
26 | 0 |
Document doc = new Document(); |
27 | 0 |
doc.setDocType( (DocType)originalDoc.getDocType().clone() ); |
28 |
|
|
29 | 0 |
Map m = new HashMap(); |
30 | 0 |
m.put("href", this.stylesheet); |
31 | 0 |
m.put("type", "text/xsl"); |
32 | 0 |
doc.addContent( new ProcessingInstruction("xml-stylesheet", m) ); |
33 |
|
|
34 | 0 |
doc.setRootElement( originalDoc.detachRootElement() ); |
35 | 0 |
return doc; |
36 |
} |
|
37 |
|
|
38 |
} |
|
39 |
|
|