This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Applying XSLT to SAX Reader


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.  I think I have
a code setup properly to handle this, but the XSL stylesheet
is not being applied to my parsed XML, I just get the parsed XML out of my
SAX reader events
displayed back to the screen.  This is driving me crazy!
I've spent 3 days trying to feed this parsed XML into a transformation
process, but NO LUCK!!


Here is the code I have written so far, if needed, I will post the code for
the xmlParse filter:

Note:  xmlParse class to extends XMLFilterImpl and handles my SAX events.
Also, in my serializer OutputProperties method, I have tried setting it to
'html', 'xml', and
'out', and the output is the same everytime not matter what.

Thanks for your help.

////////////////////////

    TransformerFactory tFactory = TransformerFactory.newInstance();

    if (tFactory.getFeature(SAXSource.FEATURE) &&
                 tFactory.getFeature(SAXResult.FEATURE))
    {

      XMLReader reader = XMLReaderFactory.createXMLReader();

      SAXTransformerFactory saxTFactory = ((SAXTransformerFactory)
tFactory);

      XMLFilter xmlFilter1 = new xmlParse();
      xmlFilter1.setParent(reader);

      XMLFilter xmlFilter2 =
               saxTFactory.newXMLFilter(new
StreamSource("http://localhost/taymac.nsf/dynitmact.xsl";));

      xmlFilter2.setParent(xmlFilter1);

      Serializer serializer = SerializerFactory.getSerializer

(OutputProperties.getDefaultMethodProperties("xml"));

      serializer.setOutputStream(System.out);

      xmlFilter2.setContentHandler(serializer.asContentHandler());

      xmlFilter2.parse(new
InputSource("d:\\notes\\data\\domino\\cgi-bin\\itmact.xml"));

    }

//////////////////////

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]