On 10/01/2011 11:50, Shashikant-Sadashiv Jadhav wrote:

Hi Michel,
Thanks for the reply.

I have gone through specifications and mail archives and found that.
<xsl:variable name="te" select="test"/>
variable $te is created out of the context of "test" {before <xsl:for-each select="test">}
In case of xalan(xslt 1.0) $te refers to first occurrence/iteration by default.
however in SAXON (xslt2.0) i have to specify iteration number.
<xsl:value-of select="support:getATFormatText($t[1]/references/reference[type='1']/value)" />


Yes, there's a difference between XSLT 1.0 and XSLT 2.0 in the behaviour of <xsl:value-of>. (An XSLT 2.0 processor will behave like XSLT 1.0 if you specify <xsl:stylesheet version="1.0">. But I would recommend changing it as you have done - assuming that's the correct code).

1) I have some old code which calls java methods which are void. {using xsl:variable}
<xsl:variable name="clearFTX" select="support:clearFTXList()"/>
In SAXON this is not allowed. (the call to void method is ignored if the respective variable is not used anywhere else.)
In XALAN it worked fine.
Solution i found is to use xsl:value-of instead of xsl:variable:
<xsl:value-of select="support:clearFTXList()"/>
2) Non static methods in java class are need to be accessed by instance variable only.
for e.g: <xsl:variable name="newInst" select="support:new()"/>
<xsl:value-of select="support:setMsgCount($newInst,'1')"/>
I have one java class which has some methods with complex logic. [which can be reused across the XSLT].
XALAN supports for these method calls with or without instance variable. {no difference in static or non static methods.}
3) Strict Type cast is required for variables passed to java methods.
In XALAN, variable types are String by default. and it is double in SAXON.

Is there any guideline available on difference in SAXON and XALAN implementation differences.

Extension functions generally aren't portable between different XSLT processors - each processor has its own conventions. I'm not aware of anyone having done a cross-comparison between Xalan and Saxon in this area, or a guide to the conversion task.

Some of the differences are due to the fact that XSLT 2.0 has a richer type system and stronger type checking than XSLT 1.0, and this is reflected in the rules for mapping between XDM types and Java types when calling extension functions.

With Saxon a much more rigorous way to handle extension functions since 9.2 is by using the "integrated extension function" mechanism in which the type signature is made explicit, and there are no implicit type conversions between XDM values and Java values.

Michael Kay
Saxonica