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

Re: XT Question

Subject: Re: XT Question
From: Henk Fictorie <fictorie@xxxxxxxxx>
Date: Mon, 21 Jun 1999 12:27:42 +0200
Re: XT Question
This is how I do it (with XT):

   public static String transformFile(String pData,
			              File pStylesheetFile)
        throws IOException, SAXParseException, SAXException
    {
        ByteArrayOutputStream lOutput = new ByteArrayOutputStream();
        Parser lParser = createParser();
        if (lParser == null)
        {
            System.exit(1);
        }
        XSLProcessor lXSLProcessor = new XSLProcessorImpl(lParser);
        ResultTypeHandlerImpl lResultTypeHandler = new
ResultTypeHandlerImpl(lXSLProcessor);
        lXSLProcessor.setResultTypeHandler(lResultTypeHandler);
        
        lResultTypeHandler.setOutputStream(lOutput);
        lXSLProcessor.setStylesheet(fileInputSource(pStylesheetFile));
        lXSLProcessor.parse        (stringInputSource(pData));
        return lOutput.toString();
    }

    static public InputSource stringInputSource(String str)
    {
      return new InputSource(new StringReader(str));
    }




James Clark wrote:
> 
> The XSLProcessor interface (implemented by XSLProcessorImpl) derives
> from org.xml.sax.Parser, so you can do this in exactly the same way as
> you would normally with SAX (see CharacterStreamDemo in the SAX dist).
> 
> Nigel Byrnes wrote:
> >
> > Hi XSL-ers
> >
> > I would like to use XT for transforming xml into a formatting markup
> > language. The xml content which I have in mind is not stored as a file
> > but is represented as a Java String. So for speed reasons, it'd be cool
> > to pass the xml document as a String.
> >
> > Having studied the code to com.jclark.xsl.sax.Driver where I think any
> > modifications should be made, I am not too sure about what is the best
> > approach to take. I have tried creating my own transformFile() method
> > replacing the "File inputFile," argument with "String xmlContent" but to
> > no avail.
> >
> > Any advice will be appreciated
> >
> > Thanks
> >
> > Nigel
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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.