xsl-list
[Top] [All Lists]

Re: [xsl] calling Java non static methods from XSLT @Mike Kay

2016-06-05 22:33:40
As far as I've understood the issue after the more extensive description,
the object in question doesn't hold any state and the method call is just a
calculation based on the XML data. There's no reason that this method
should not be static. Also, there's no reason to avoid the "singleton"
pattern if all the caveats you find in the literature either don't apply or
are observed.

With more than 1,000,000,000,000 nodes to deal with, any shortcut should be
taken. Even if it may be heresy to say so on an XSL list, I'd also
benchmark alternatives not using XSLT if the transformation is simple
and/or not likely to change.

-W




On 6 June 2016 at 03:42, Mailing Lists Mail daktapaal(_at_)gmail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

I am using Saxon.  I dont think it is an issue as such. The questions
are just my doubts that I thought someone will clarify.
I am kind of tending to conclude, in the absence of answers from this
group that, If a compiled XSLT is called N number of times and if the
XSLt instantiates a java object , then N objects will be created.
Thanks all.
Dr. Tapaal

On Sun, Jun 5, 2016 at 2:43 PM, Michael Kay mike(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
As Dimitre says, the question is very processor-specific. I don't think
you have told us which XSLT processor you are using, but from your
description my guess was Xalan, in which case I'm afraid I can't help you.

If it's a Saxon issue, then it's best raised on a Saxon help forum at
saxonica.plan.io.

Michael Kay
Saxonica

On 5 Jun 2016, at 17:08, Mailing Lists Mail 
<daktapaal(_at_)gmail(_dot_)com>
wrote:

Dr.Kay
Can you shed some light on this please.
I have the following questions
1. Is Compiling the XSLT is relevant to this issue of the Object
creation ? Just because we are precompiling the XSLTs doesnt mean
that the XSLT will create the object once and keep it for all the
transformations? Or is it true? My assumption was, the Java Objects
are created at run time so it does not matter if the XSLTs are
compiled or not..
2. If my assumption is wrong, then would like to know what the
Compiling of XSLT works.
3. Is it possible for the Java to create the object once and pass it
to the XSLT as a parameter?
3. is there any benefits of actually using a static method instead of
instance methods, within XSLT?
Dr. Tapaal


On Sat, Jun 4, 2016 at 9:55 PM, Dimitre Novatchev 
dnovatchev(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
On Sat, Jun 4, 2016 at 6:45 PM, Mailing Lists Mail 
daktapaal(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Dimitre, your suggestion makes me feel that an object can be passed
into the XSLT and then I can do object.method() within the XSLT.. is
that possible?



Dr. Tapaal,

The answers to your questions could be different, depending on which
XSLT processor you are using.

So, if creating an object instance and passing it to the
transformation as parameter (and reusing the same object by passing it
to the next transformation) is not possible, I believe this would be a
limitation of the XSLT processor you are using.

Look up the documentation of your XSLT processor.

In case this is Saxon, then there isn't a better person than Dr.
Michael Kay to provide a precise answer.

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant
intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.




--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>