[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Applying XSLT to SAX Reader

Subject: RE: Applying XSLT to SAX Reader
From: "Paul Brown" <prb@xxxxxxxxxxxxx>
Date: Mon, 7 Oct 2002 20:18:10 -0400
sax sxs
> I am having a problem trying to transform output from a SAX 
> reader.  Looking at the XALAN FAQ, I believe the way I am
> supposed to do this is to use a "pipe", or "chain" method.

It depends on your approach.  Personally, I don't like the JAXP method for obtaining an XMLFilter because it precludes the setting of parameters on the Transformer.  (The right way to do that, btw, IMHO, would be to map SAX properties of the form http://java.sun.com/jaxp-1.1/[qname] to the Transformer properties, but I digress...)

Another way to hand an XMLReader (or XMLFilter) to an XSLT processor using TrAX is to wrap it up in a SAXSource:

	// Foo implements XMLReader
	XMLReader xr = new Foo();
	InputSource is = new InputSource(blahblah);
	SAXSource sxs = new SAXSource(xr,is);

(Get a new Transformer here...)

Since it appears that you want serialized output, I'd suggest just using a StreamResult instead of a serializer:

	StreamResult str = new StreamResult(System.out);
	t.transform(sxs,str);

As for your specific code, I don't see anything obviously wrong.  (Maybe I'm missing the obvious...)  Does your XMLFilter implementation pass-on namespace and other SAX property settings to the driving XMLReader?  (Xalan can be a little picky about which way it receives namespace events.)

	-- Paul

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.