
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Folks, here's the example. Cheers, Michel - -- Michel <dot> Drescher <at> uk <dot> fujitsu <dot> com Fujitsu Laboratories of Europe +44 20 8606 4834 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFIZpUk0lMZTNKw4QRAhCVAKCvVAMQQlbPbAQT6Rbh3TFjOZ2zQwCgqOZ7 lOFLThj9uYHgjYe7ZgubuGs= =CkQ3 -----END PGP SIGNATURE----- declare function local:filterByProcessorArchitecture( $proc as element(), $resources as element()+ ) as element()+ { if ( count($proc/Architecture) > 0 ) then for $resource in $resources where data($proc/Architecture) = data($resource//Architecture) return $resource else $resources }; declare function local:filterByOSType( $os as element(), $resources as element()+ ) as element()+ { if ( count($os/OSType) > 0 ) then for $resource in $resources where data($os/OSType) = data($resource//OSType) return $resource else $resources }; let $job := doc('./job_1.xml') (: load job 1 :) let $jreq := $job//Capabilities (:take the Capabilities :) let $prov := doc('./provisions.xml') (: load the hosts :) let $resources := $prov//Resource let $result := local:filterByProcessorArchitecture($jreq/Processor, $resources ) let $result2 := local:filterByOSType( $jreq/OS, $result ) return $result2
participants (1)
-
Michel Drescher