You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Paul Winder <pw...@arbortext.com> on 2000/11/15 18:09:30 UTC

connecting transformations with SAX events

Never mind, I figured it out:  From the source for
XSLTEngineImpl.java::StartDocument(), I see that m_flistener, which is
set by calling setDocumentHandler(), will be used to create an
XSLTResultTarget if the output stream is not set.

This works fine.

Paul

Paul Winder writes:
 > Hi All,
 > 
 > I am trying to set up a Xalan transformation that accepts SAX events
 > for xml input and emits SAX events for use by the next process.  I
 > have figured out how to handle the SAX input, and I see by the
 > examples how to do the SAX output, but I haven't been able to figure
 > out how to do both at the same time.
 > 
 > The PureSax example is supposed to demonstrate this, but as near as I
 > can tell the output is to a stream (System.out) rather than SAX events.
 > 
 > In fact, a comment in the documentation for
 > XSLTProcessor::setOutputStream() makes me wonder if this is even
 > possible:
 > 
 >    "Set the output stream.  Required when the XSLTProcessor is being
 >     used as a SAX DocumentHandler."
 > 
 > Does this mean the only output available when using SAX events as
 > input is an output stream?
 > 
 > As I understand it, to use SAX input, you must attach a compiled
 > stylesheet to the processor and set the processor's output stream, 
 > and then you specify the processor as the DocumentHandler for a parser.  
 > 
 > It appears that the StartDocument event initiates the transformation;
 > no explicit call to the process() method is required.  In fact, I
 > can't figure out what I might use for the xml input if I want to explicitly
 > call process(), and there is no version of process() that doesn't
 > require an xml input argument.
 > 
 > To specify SAX output, you specify an XSLTResultTarget with the next
 > process as the DocumentHandler, and then call the process() method
 > with this target.  I can't figure out a way to specify the result
 > target without explicitly calling process().
 > 
 > It seems that what is required is an XSLTProcessor method which sets a
 > target without having to explicitly call process().  With this set,
 > and the processor assigned as the DocumentHandler for a parser, I
 > would be able to accept SAX events as input and output SAX events to
 > an arbitrary next process.
 > 
 > Another possiblity would be a process() method that doesn't require an
 > xml input argument, but this doesn't seem quite as natural, since the
 > transformation is really driven by the SAX events.
 > 
 > Am I misunderstanding or missing something?
 > 
 > Paul Winder
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
 > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
 > 
 >