1
|
package eu.dnetlib.miscutils.functional.xml;
|
2
|
|
3
|
import java.util.Map;
|
4
|
import javax.xml.transform.Source;
|
5
|
import javax.xml.transform.TransformerFactory;
|
6
|
|
7
|
import org.dom4j.Document;
|
8
|
import org.dom4j.io.DocumentSource;
|
9
|
import org.springframework.core.io.Resource;
|
10
|
|
11
|
/**
|
12
|
* Applies a stylesheet to a XML DOM4j and returns an XML string.
|
13
|
*
|
14
|
* @author marko
|
15
|
*
|
16
|
*/
|
17
|
public class ApplyXsltDom4j extends AbstractApplyXslt<Document> {
|
18
|
|
19
|
public ApplyXsltDom4j(Resource xslt, final TransformerFactory transformerFactory) {
|
20
|
super(xslt, transformerFactory);
|
21
|
}
|
22
|
|
23
|
public ApplyXsltDom4j(Source xslt, String name, final TransformerFactory transformerFactory) {
|
24
|
super(xslt, name, transformerFactory);
|
25
|
}
|
26
|
|
27
|
public ApplyXsltDom4j(Source xslt, final TransformerFactory transformerFactory) {
|
28
|
super(xslt, transformerFactory);
|
29
|
}
|
30
|
|
31
|
public ApplyXsltDom4j(String xslt, String name, final TransformerFactory transformerFactory) {
|
32
|
super(xslt, name, transformerFactory);
|
33
|
}
|
34
|
|
35
|
public ApplyXsltDom4j(String xslt, final TransformerFactory transformerFactory) {
|
36
|
super(xslt, transformerFactory);
|
37
|
}
|
38
|
|
39
|
public ApplyXsltDom4j(Resource xslt, Map<String, String> parameters, final TransformerFactory transformerFactory) {
|
40
|
super(xslt, parameters, transformerFactory);
|
41
|
}
|
42
|
|
43
|
public ApplyXsltDom4j(Source xslt, String name, Map<String, String> parameters, final TransformerFactory transformerFactory) {
|
44
|
super(xslt, name, parameters, transformerFactory);
|
45
|
}
|
46
|
|
47
|
public ApplyXsltDom4j(String xslt, String name, Map<String, String> parameters, final TransformerFactory transformerFactory) {
|
48
|
super(xslt, name, parameters, transformerFactory);
|
49
|
}
|
50
|
|
51
|
@Override
|
52
|
public Source toStream(Document input) {
|
53
|
return new DocumentSource(input);
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
public String toString(Document input) {
|
58
|
return input.asXML();
|
59
|
}
|
60
|
|
61
|
}
|