You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by ajay bhadauria <ab...@yahoo.com> on 2015/02/18 22:12:22 UTC

Xalan transform Stylesheet

Hello, We have around 800 xslt files and we are trying to compile all stylesheets and retain them for later usage through a service running, so we cannot afford to compile stylesheet when we need because of performance. Q1 To retain compiled stylesheets , do I need to create 800 transformers and retain all the transformers or create one transformer and then call compileStylesheet() 800 times and retain stylesheets in my memory ? Q2 If the answer of question no 1 is to create one transformer and 800 stylesheets , do I need to create new transformer to call transform() function and pass stylesheet which I saved in the memory or should I use the existing transformer that I mention in Q 1 taken in the account, this transformer will own 800 stylesheets.  
Note:   "Not to compile the same stylesheet over and over if we have to re-use many times."  What is the best way of achieving this ? RegardsAjay 

Re: Xalan transform Stylesheet

Posted by ajay bhadauria <ab...@yahoo.com>.
Thanks for reply ! We have transform object created local on the function stack and then we are using one of the transform() signatures that takes stylesheet as an argument. My question is    does this (local) transform object owns the stylesheet or not ? I guess that when the local transform object going out of scope,  does that make stylesheet unusable or not ?   But I have to say that this is not tranform object which was used to compile the stylesheet with compleStylesheet() function. My objective is to keep the same stylesheet aound for future transformation within the same process. Please advise   RegardsAjay
       From: "shathawa@e-z.net" <sh...@e-z.net>
 To: ajay bhadauria <ab...@yahoo.com> 
Cc: XALAN-C <xa...@xml.apache.org> 
 Sent: Wednesday, February 25, 2015 1:21 AM
 Subject: Re: Xalan transform Stylesheet
   
> Hello, We have around 800 xslt files and we are trying to compile all
> stylesheets and retain them for later usage through a service running, so
> we cannot afford to compile stylesheet when we need because of
> performance. Q1 To retain compiled stylesheets , do I need to create 800
> transformers and retain all the transformers or create one transformer and
> then call compileStylesheet() 800 times and retain stylesheets in my
> memory ? Q2 If the answer of question no 1 is to create one transformer
> and 800 stylesheets , do I need to create new transformer to call
> transform() function and pass stylesheet which I saved in the memory or
> should I use the existing transformer that I mention in Q 1 taken in the
> account, this transformer will own 800 stylesheets.  
> Note:   "Not to compile the same stylesheet over and over if we have to
> re-use many times."  What is the best way of achieving this
> ? RegardsAjay 


Ajay,

It is possible to use a single instance of the Xalan Transformer to
compile multiple XSLT stylesheets and make them available for
repeated use against incoming XML documents.  Note that when you terminate
the Xalan Transformer, any parsed documents and compiled XSLT transforms
will become unusable.

I've been looking at how to capture compiled XSLT transforms into storage
outside of the virtual process address space.  Since you have a large number
of XSLT transforms, I hope that virtual address space won't be an issue.

Steven J. Hathaway



  

Re: Xalan transform Stylesheet

Posted by sh...@e-z.net.
> Hello, We have around 800 xslt files and we are trying to compile all
> stylesheets and retain them for later usage through a service running, so
> we cannot afford to compile stylesheet when we need because of
> performance. Q1 To retain compiled stylesheets , do I need to create 800
> transformers and retain all the transformers or create one transformer and
> then call compileStylesheet() 800 times and retain stylesheets in my
> memory ? Q2 If the answer of question no 1 is to create one transformer
> and 800 stylesheets , do I need to create new transformer to call
> transform() function and pass stylesheet which I saved in the memory or
> should I use the existing transformer that I mention in Q 1 taken in the
> account, this transformer will own 800 stylesheets.  
> Note:   "Not to compile the same stylesheet over and over if we have to
> re-use many times."  What is the best way of achieving this
> ? RegardsAjay 
Ajay,

It is possible to use a single instance of the Xalan Transformer to
compile multiple XSLT stylesheets and make them available for
repeated use against incoming XML documents.  Note that when you terminate
the Xalan Transformer, any parsed documents and compiled XSLT transforms
will become unusable.

I've been looking at how to capture compiled XSLT transforms into storage
outside of the virtual process address space.  Since you have a large number
of XSLT transforms, I hope that virtual address space won't be an issue.

Steven J. Hathaway