Hi !
I'm trying to use the SAXResult way to get results from a Transformer, and i
have some troubles with comments.
I've set up a TransformerHandler, using SAX events as source, and processing
results into a SAXResult (MyHandler implements at least ContentHandler and
LexicalHandler) :
// Simplified code ; checking of next cast is done before
SAXTransformerFactory factory =
((SAXTransformerFactory)TransformerFactory.newInstance());
TransformerHandler transform;
try {
transform = factory.newTransformerHandler(new
StreamSource("mysheet.xsl"));
}
catch (TransformerConfigurationException problem) {
problem.printStackTrace();
}
MyHandler out = new MyHandler();
SAXResult result = new SAXResult(out);
result.setLexicalHandler(out);
transform.setResult(result);
In mysheet.xsl, i process input events in several templates, and in a template,
i use the <xsl:comment> tag to generate in the output XML comments. All the
processing is working well : the SAX events i get in MyHandler class are the
expected result events, except for the comments. The comment(...) method,
implemented from LexicalHandler, is never called. Is anybody knowns where i am
wrong ?
In the same way, i wanted to get notified of ignorable whitespaces in the
result ; this doen't work too, since the ignorableWhitespace(...) method
implemented from ContenHandler is never called. I have configured Can anybody
help me to understand ? An XSL directive is required in my XSL sheet ?
Thanks a lot !
Jean-Luc