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]

Castor -> XSLT


Can someone please tell me how one
would go about piping the output of castor
to an XSLT processor (specifically Xalan)?

I have been trying many ways do this in
the last day but to no avail.  Here is my
latest attempt.

   public void run() throws Exception {

        Iterator iter =
CoreCentral.instance().getContactSet().iterator();

        // create XSLT Engine
        // Have the XSLTProcessorFactory obtain a interface to a
        // new XSLTProcessor object.
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

        // create and set the stylesheet to be used
        StylesheetRoot stylesheet =
                    processor.processStylesheet("contacts-html.xsl");
        processor.setStylesheet(stylesheet);

        // create and set the document handler for the XSLT Engine
        org.xml.sax.DocumentHandler dh =
                    sylesheet.getSAXSerializer(System.out);
        processor.setDocumentHandler(dh);

        // Create a File to marshal to
        // create a Castor marshaller and send the output to the XSLT
Engine
        Marshaller marshaller = new Marshaller(processor);
        marshaller.setMarshalAsDocument(true);

        while (iter.hasNext()) {
            Object o = iter.next();

            // Marshal the contact object
            try{
                marshaller.marshal(o);
            }
            catch(MarshalException e){
                e.printStackTrace();
            }
            catch(ValidationException e){
                e.printStackTrace();
            }

        }
    }


--
Jason L. Russ
Software Consultant
Korson-McGregor, A Software Technology Company
(Formerly known as Software Architects)



 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]