[xsl] XSL, comments and whitespace

Subject: [xsl] XSL, comments and whitespace
From: "Jean-Luc Mathieu" <jean-luc.mathieu@xxxxxxxxxxxxx>
Date: Mon, 20 Sep 2004 14:58:18 +0200
Hi !
 
I'm trying to use the SAXResult way to get results from a Transformer, and i
have some troubles with comments. I'm using Xalan 2.6.0.
 
I've set up a Transformer, 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, 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 results
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 not called too. Can anybody help me to
understand ?

Thanks a lot !
Jean-Luc

Current Thread