declare namespace xs=‘XML Schema’
let $listKeys := distinct-values(
for $b in input()/oDocument [
/oDocument/@type=‘Element’
and /oDocument/@parent = ‘C13ECC62C52B8000’]
/attributes/attribute
where $b/@key=‘C13ED8481ECA0000’ and $b/text() != 123
return $b/@oDocKey
)
return $listKeys
This example works
/*-------------------------------------------------------------------
And here this returns a error
declare namespace xs=‘XML Schema’
let $listKeys := distinct-values(
for $b in input()/oDocument [
/oDocument/@type=‘Element’
and /oDocument/@parent = ‘C13ECC62C52B8000’]
/attributes/attribute
where $b/@key=‘C13ED8481ECA0000’ and xs:int($b/text()) != 123
return $b/@oDocKey
)
return $listKeys
Conversion error for comparison
The source type is: anySimpleType, the target type is: double.
/*------------------------------------------------------------------ In what a problem?
declare namespace xs='http://www.w3.org/2001/XMLSchema'
let $listKeys := (
for $b in input()/oDocument [
/oDocument/@type='Element'
and /oDocument/@parent = 'C13ECC62C52B8000']
/attributes/attribute
where $b/@key='C13ED8481ECA0000' and xs:int($b/text()) != 123
return $b/@oDocKey
)
return $listKeys
And on sharing of function distinct-values(); and xs:int() gives out a mistake
declare namespace xs='http://www.w3.org/2001/XMLSchema'
let $oDocs := (
for $b in input()/oDocument[
/oDocument/@type='Елемент' and
/oDocument/@parent='C13ECC62C52B8000'
]/attributes/attribute
where ($b/@key='C13ED8481ECA0000' and $b/text()!= '123')
return $b/@oDocKey) [position() >= 0 and position() <= 10]
return ($oDocs)
OR
declare namespace xs='http://www.w3.org/2001/XMLSchema'
let $oDocs := (
for $b in input()/oDocument[
/oDocument/@type='Елемент' and
/oDocument/@parent='C13ECC62C52B8000'
]/attributes/attribute
where ($b/@key='C13ED8481ECA0000' and xs:int($b/text())!= 123)
return $b/@oDocKey) [position() >= 0 and position() <= 10]
return ($oDocs)