Patch #1421

miscellaneous improvements to

Added by Anonymous over 18 years ago. Updated over 9 years ago.

Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:


SourceForge user: gschadow

Michael, please consider the attached patch to It does a number of improvements.

  1. The rendition of retrurned java nulls to empty

sequences (as discussed earlier.)

  1. Adding a debug clause in which the actual calling of a

method is announced (with the -TJ flag.) BTW: would be

nice if the TraceListener would handle these XPath

expression-level tracings too.

  1. Nesting exceptions thrown from extension functions

inside the XPathException. Previously the

XPathExceptions came without a trace as to what went

wrong inside the extension funcitons!

  1. Add support for member fields to be accessed. This is

the bulk of the patch and described in detail below.

Problem: Often a class' methods use static final fields as

enumeration values to act as modifiers to a method call.

Even though these are typically int or other values that

could be submitted without reference to the static final

field, it is unsafe to do so because these values may

change with changing (versions of) the class


Solution: This solution treats member fields as functions

with no arguments. For example, if class oracle.sql.CLOB

has the static final int DURATION_SESSION, then this

value can be accessed through:

<xsl:sequence xmlns:clob="java:oracle.sql.CLOB"


I implemented this solution in analogy to the Method

handling, and it works for both static and instance fields

as one would expect (using an argument with the object

whose field is being accessed.)

Clearly this doesn't allow assignments to fields, but such

assignments are exceedingly unneccessary since most

objects (except for some odd java.awt struct-like

objects) will have proper mutator methods.

Alternatives: As an alternative, I would have liked to

implement such static field references as variables, e.g.,

the above example would look like this:

<xsl:sequence xmlns:clob="java:oracle.sql.CLOB"


however, I still don't quite understand how variables are

implemented in saxon and this wouldn't work for instance

fields anyway. In order to allow setting instance fields

one could imagine a pair of functions getf(object,string)

and setf(object,string,object), but setting instance

fields is not so important.

I'd appreciate if you could accept these patches in


thank you,


FunctionProxy.diff (9.56 KB) FunctionProxy.diff Anonymous, 2003-06-20 05:23


#1 Updated by Anonymous over 18 years ago

SourceForge user: mhkay

Logged In: YES


Thanks, I've applied these changes.

I don't think I would want to attempt to bind variables this

way. The XSLT spec requires all variables to be explicitly

declared, unlike functions.

Extension functions with side-effects (including setters)

are going to become increasingly troublesome as the order of

execution in a stylesheet becomes less predictable...

Michael Kay

#2 Updated by Anonymous almost 17 years ago

SourceForge user: gschadow

Logged In: YES


Thanks for integrating this into your code.

Please register to edit this issue

Also available in: Atom PDF