Reputation: 173
I have a case of evaluation like :
$asset eq 100 and $asset/name() eq 'p0:current_asset'
which should return true()
, variable $asset
need to be resolved as primitive and node value in same evaluation, I'm using XPathVariableResolver
interface to resolve variable when evaluation is running.
Returning TinyElementImpl
when resolving variable with
public Object resolveVariable(QName variableName)
Doesn't solve the problem, I'm using JAXP implementation of SAXON-HE.
Is it possible to do that ?
Upvotes: 0
Views: 121
Reputation: 163342
We (Saxonica) haven't documented very clearly exactly what kinds of Object
our implementation accepts as the result of the JAXP resolveVariable()
method, and I'm in the process of fixing that. Returning any NodeInfo
(including, therefore, an instance of TinyElementImpl
) should work fine.
If you're using Saxon-HE, then it's not schema-aware, so the typed value of an element will always be untypedAtomic
, therefore comparison with an integer isn't going to work. The simplest fix, though some readers might find it confusing, is to change the condition to +$asset eq 100
- the unary plus operator forces a type conversion.
I wouldn't write $asset/name() eq 'p0:current_asset'
either, because it's dependent on the namespace prefix. Better is to write $asset[self::p0:current-asset]
.
Upvotes: 0