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/07/01 02:57:51 UTC

RE: Serializing Stylesheet with Parameters

Hello David,

Thank you for your reply.

Yes, of course stylesheet is immutable and parameters are set to an instance
of xslt processor not to stylesheet itself.
An instance of xslt processor with parameters set plus immutable stylesheet
together is enough to produce stylesheet XML. It is a matter of merging
immutable stylesheet data and parameter values from the processor.

As you can see from this code:
      
processor.setStylesheet(style);                 //set style for processor
instance
processor.setStylesheetParam("name1", "val1");  //set parameters for
processor instance
processor.serializeStyle(out);                  //ask processor to serialize
current style with parameters

it is the processor who is responsible for serializing stylesheet with
parameters not stylesheet itself.

I am using Xalan for Java

Alex



-----Original Message-----
From: David_N_Bertoni@lotus.com [mailto:David_N_Bertoni@lotus.com]
Sent: Friday, June 30, 2000 10:46 AM
To: xalan-dev@xml.apache.org
Subject: Re: Serializing Stylesheet with Parameters



Hi Alex,

I'm not positive with regards to Xalan-J, but in Xalan C++, stylesheets do
not carry such information since they are implemented so that they can be
shared amonst multiple threads.  As such, they do not carry any mutable
state information in them, which parameters values are.

Dave



 

                    "Roytman,

                    Alex"                 To:
"'xalan-dev@xml.apache.org'" <xa...@xml.apache.org>

                    <roytmana@peac        cc:     (bcc: David N
Bertoni/CAM/Lotus)                                              
                    etech.com>            Subject:     Serializing
Stylesheet with Parameters                                   
 

                    06/29/2000

                    05:53 PM

                    Please respond

                    to xalan-dev

 

 




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);