Bonjour à tous,
Je suis débutant en xquery et je voudrais faire une petite fonction qui retourne le contenu d'un noeud si il existe ou "-" si il existe pas et si il est vide.
j'obtiens toujours l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 declare function local:check_field($expr as xs:string){ if( data($expr) != "" )then data($expr) else "-" }; <InsideColor>{local:check_field($x//InsideColor)}</InsideColor>
exerr:ERROR XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: local:check_field($expr as xs:string) item()*. Expected cardinality: exactly one, got 0. [at line 127, column 50, source: String]
In function:
local:check_field(xs:string) [127:31:String]
Quelqu'un peut-il m'aider?
Merci beaucoup!
Très bonne journée et meilleures salutations.
Partager