You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Roytman, Alex" <ro...@peacetech.com> on 2000/06/29 23:53:18 UTC

Serializing Stylesheet with Parameters

Hello,

Is it possible to serialize prepared stylesheet back to XML stream with all
parameters set by processor.setStylesheetParam()?

Reason why I want to do it is that when I apply stylesheet on my web server
I normally cache prepared styles as StylesheetRoot objects and set
parameters to xsltprocessor before using it with
processor.setStylesheetParam 
If I want to build system where client has choice whether to apply XSLT on
server side and get html back or get XML and XSLT and process it in browser
I need to put actual values for all parameters in the stylesheet and stream
it to the client. 
I could cache stylesheet DOM Document and modify it before sending to the
client but I do not like the idea of poking in stylesheet data besides in
multithreaded environment I would need to serialize access to stylesheet DOM
(or do something to protect DOM data) 
I could be even more sophisticated and cache stylesheet xml as character
data and run it through SAX parser, intercept SAX events and modify
parameter values before sending it to an xml serializer. This will eliminate
need for synchronization but still ...

Since XSLTProcessor need to parse style anyway and knows how to set
parameters it would be nice to do something like this:

      processor.setStylesheet(style);
      processor.setStylesheetParam("name1", "value1");
      processor.setStylesheetParam("name2", "value2");
      processor.serializeStyle(out);