declare namespace a = "http://pcs.portinfolink.nl/ecscodeco"; declare option ddtek:serialize 'indent=yes,omit-xml-declaration=no'; declare variable $input as document-node(element(*, xs:untyped)) external; declare function local:checkField( $lmnt as element()*, $fieldType as xs:string) { if($fieldType = 'N') then if(not($lmnt instance of xs:decimal)) then error(xs:QName('Error'), concat('this [', $lmnt ,'] is not instance of decimal')) else $lmnt/text() else '' }; { for $GROUP_5 in $input/EDIFACT/CODECO/GROUP_5 return for $MEA in $GROUP_5/MEA where $MEA/MEA02/MEA0201/text() = 'G' return { local:checkField($MEA/MEA03/MEA0302,'N') } } (: Stylus Studio meta-information - (c) 2004-2008. Progress Software Corporation. All rights reserved. :)