1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.millscript.millscript.render;
23
24 import org.millscript.commons.vfs.VFile;
25 import org.millscript.millscript.conf.Configuration;
26 import org.millscript.millscript.datatypes.XmlComment;
27
28 import java.io.IOException;
29
30 /**
31 * This class implements MillScripts XSLT renderer. It renders to the XSLT 1.0
32 * specification, but may not always render valid XSLT 1.0.
33 * <p>
34 * The main issue with writing valid XSLT documents is exactly the same as with
35 * XML documents, so please read the documentation for the XML10Renderer class.
36 * </p>
37 * <p>
38 * The difference between an XML renderer and an XSLT renderer is that XML
39 * comments are rendered differently. For XSLT, an XML comment is rendered as
40 * and XSLT <xsl:comment> tag. The means that an XML comment rendered
41 * as XSLT via MillScript will be preserved through the XSLT transformation.
42 * </p>
43 */
44 public final class XSLTRenderer extends XML10Renderer {
45
46 /**
47 * Constructs a new XSLT renderer, to render to the specified virtual file
48 * using the given confguration.
49 *
50 * @param conf the configuration to get rendering parameters from
51 * @param file the virtual output file
52 */
53 public XSLTRenderer( final Configuration conf, final VFile file ) {
54 super( conf, file );
55 }
56
57 /**
58 * @see org.millscript.millscript.render.Renderer#renderXMLComment(org.millscript.millscript.datatypes.XmlComment)
59 */
60 @Override
61 public void renderXMLComment( final XmlComment c ) throws IOException {
62
63
64
65
66
67
68 this.appendNoEscape( "<xsl:comment>" );
69 this.append( c.getText() );
70 this.appendNoEscape( "</xsl:comment>" );
71 }
72
73 }