Re: [xsl] [saxon - Help] SystemID always empty String

Subject: Re: [xsl] [saxon - Help] SystemID always empty String
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Mon, 18 Feb 2008 13:47:51 +0100 (CET)
Johannes Neubauer wrote:

  Hi

> source = new StreamSource(new
ByteArrayInputStream(out.toByteArray()));
> Templates secondTemplates = saxFactory.newTemplates(source);

  So if I am right, you are generating a stylesheet in the first
transform, and you want to compile this generated stylesheet.  In
general, passing by byte buffers is not a good idea.  It involves
serializing and deserializing for nothing.  Usually piping SAX events
is better.

  JAXP has TemplatesHandler that compiles SAX events representing a
stylesheet.  From the top of my head, the idea is as following:

    // you need a SAX factory
    SAXTransformerFactory factory = ...;
    // this is a ContentHandler
    TemplatesHandler compiler = factory.newTemplatesHandler();
    // the transform
    Transformer trans = ...;
    trans.transform(..., new SAXResult(compiler));
    // get the compiled stylesheet generated by the transform
    Templates generated = compiler.getTemplates();

  Regards,

--drkm























      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

Current Thread