|
RE: [saxon] Filtering Saxon-Output
From: Michael Kay <michael.kay@nt...> - 2002-10-29 19:12
|
I think this can be done quite easily using the JAXP Identity Transformer. Call TransformerHandler th = SAXTransformerFactory.getInstance().getTransformerHandler(); th.setResult(new com.icl.saxon.output.HTMLEmitter()) The TransformerHandler is a SAX2 ContentHandler so you can plug it in directly as the output of your XMLFilter. Saxon's Emitter interface implements the JAXP Result interface so any Emitter can be used as a Result of a transformation. Actually, you'll have to give the HTMLEmitter a Writer or OutputStream to write to, so the above is a bit oversimplified, but the idea should work. It might be possible to do it without any reference to Saxon classes by an appropriate call of setOutputProperties(), but I can't quite figure it out at the moment. Saxon's HTML indentation is done by a separate class called the HTMLIndenter, this is another filter which you might want to add to the pipeline. Michael Kay Software AG home: Michael.H.Kay@... work: Michael.Kay@... > -----Original Message----- > From: saxon-help-admin@... > [mailto:saxon-help-admin@...] On Behalf Of > Nestel, Frank IZ/HZA-IC4 > Sent: 29 October 2002 16:26 > To: 'saxon-help@...' > Cc: 'frank@...' > Subject: [saxon] Filtering Saxon-Output > > > > This is a question I could probably figure myself, but I > guess Mike is knowing the answer and I try to safe time. > > Assume you have XSLT genererated output und need to > postprocess it. Yes one could use JAXP and an XMLFilter to do > the conversion. The problem is I need it as fast as possible, > and the XMLFilter will actually look that way, that it will > really filter certain SAX events. > > The resulting XML is actually a somewhat large HTML and I > really appreciate > the HTML renderer of Saxon. Is there an easy way to do something like > > XML ----via XSLT (probably SAXON)---> XML encoded HTML > ---XMLFilter---> HTML > > but not doing it like > > XML ----via XSLT (probably SAXON)---> XML encoded HTML > ---XMLFilter---> XML ---trival XSLT--> HTML > > for example does something I do not immediately find in > org.sf.saxon.output implement > a XMLReader or a ContentHandler or whereever I can feed my > filtered stuff > into and then writes me correct HTML to a Stream? > > Thank you for any help, > Frank Nestel > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > saxon-help mailing list > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/s> axon-help > |
| Thread | Author | Date |
|---|---|---|
| RE: [saxon] Filtering Saxon-Output | Michael Kay <michael.kay@nt...> |