xml - Evaluating if an attribute value is parseable to a xs:int -
background:
i trying perform query (using xquery 3.0) on attribute value (attrname) might either xs:string or xs:int, lets call $a.
if $a able parsed xs:int want compare against xs:int variable $v (<, <=, =, etc.). otherwise, if xs:string want perform different comparison.
xml example
<root> <element attrname="1">this xs:int</element> <element attrname="a">this xs:string</element> </root> pseudo-code
if $a xs:int else if $a xs:string else my issue:
i not able find proper way of evaluating if $a xs:int before performing operation.
you can use if ($a castable xs:int) expression1 else expression2.
Comments
Post a Comment