On 18/03/2011 17:05, Merrilees, David wrote:

Thanks Michael

 

Looking at some examples on the web, It looks like the Unwrap method returns an instance of net.sf.saxon.om.ValueRepresentation, instead of net.sf.saxon.dotnet.DotNetObjectValue, and doesn’t have a GetObject method.


Unwrap will return whatever value has been wrapped, which in this case will be a DotNetObjectValue - you can cast the result and then call getObject() - note the lower-case "g" because this is a Java method that's being called.


I’m also confused about how you would declare the argumentType for an object passed from XSL to Saxon. Which XdmItemType would this use?


I think you probably have to use the most generic ItemType, that is XdmAnyItemType.Instance.

Michael Kay
Saxonica


 

Thanks

 

David



Hi

 

Is it possible to pass an object to an integrated extension function, which has been passed as a parameter using XdmAtomicValue.WrapExternalObject? Looking at the Saxon documentation, this doesn't seem possible as the types which integrated extensions can accept seem limited.

 

Thanks

 

David

 

Just in case anyone else is confused (I spent a minute or two scratching
my head), we're talking about the .NET API here.

I think you can use an XdmAtomicValue that was constructed using

XdmAtomicValue.WrapExternalObject

in the same way as any other XdmAtomicValue. Presumably the issue is,
within the body of your ExtensionFunctionCall, how do you get the
external object back from the IXdmEnumerator that's supplied to the call?

It's a little clumsy, but I think it can be done.

First you call MoveNext() and Current() on the IXdmEnumerator, and cast
the result to XdmAtomicValue. Then the Unwrap method (inherited from
XdmValue) returns an instance of net.sf.saxon.dotnet.DotNetObjectValue.
(To refer to this, you'll need to add a reference to the underlying
Saxon DLL). This extends net.sf.saxon.value.ObjectValue, which has a
method getObject, which should return you the object you started with.

I'll add a tweak so XdmAtomicValue.Value does the right thing.

Michael Kay
Saxonica

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help

 

 



This is a confidential email. Tesco may monitor and record all emails. The views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8 9SL
VAT Registration Number: GB 220 4302 31
------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help