|
declare namespace AVRO = "urn:oaklandsw:rep:avro";
|
|
declare namespace com_oaklandsw_transform_runtime_RuntimeSupport = "java:com.oaklandsw.transform.runtime.RuntimeSupport";
|
|
declare namespace com_oaklandsw_transform_rep_db_RuntimeSupportDatabase = "java:com.oaklandsw.transform.rep.db.RuntimeSupportDatabase";
|
|
|
|
|
|
(: CG context elem out: out$/root/ORecord in: null loop: $out_AVRO_root_AVRO_ORecord inScope?: true :)
|
|
declare function local:out_AVRO_root_AVRO_ORecord($top,$out_AVRO_root,$out_AVRO_root_i)
|
|
{
|
|
for (: fixed :) $out_AVRO_root_AVRO_ORecord at $out_AVRO_root_AVRO_ORecord_i in (1 to 1)
|
|
return (
|
|
(
|
|
(: element out$/root/ORecord :) element AVRO:ORecord {
|
|
(: optLeaf out$/root/ORecord/ID :) let $opt := (
|
|
(: value out$/root/ORecord/ID :)
|
|
let $unconvertedValue := (
|
|
(: missingCheck :) if (fn:count($out_AVRO_root/AVRO:CUSTOMER-ID[1]) = 0) then ('_789odtMissing') else (
|
|
(: nullCheck :) if ($out_AVRO_root/AVRO:CUSTOMER-ID[1]/@xsi:nil['true']) then ('_osdt987Null') else ($out_AVRO_root/AVRO:CUSTOMER-ID[1]/text()) (: missingCheck :)) (: nullCheck :) ) return if ((if (fn:count($unconvertedValue) = 1) then $unconvertedValue else $unconvertedValue[1]) cast as xs:string? = '_osdt987Null') then () else text { $unconvertedValue }
|
|
)
|
|
(: optLeaf cond out$/root/ORecord/ID :) return if ($opt[last()] cast as xs:string? = '_789odtMissing') then () else if (fn:string-length(fn:string-join($opt[last()],'')) > 0) then
|
|
(: element out$/root/ORecord/ID :) element AVRO:ID { $opt
|
|
(: element end out$/root/ORecord/ID :) }
|
|
else () (: optLeaf cond end out$/root/ORecord/ID :) ,
|
|
(: optLeaf out$/root/ORecord/name :) let $opt := (
|
|
(: value out$/root/ORecord/name :)
|
|
let $unconvertedValue := (
|
|
(: missingCheck :) if (fn:count($out_AVRO_root/AVRO:PERSONAL-DATA[1]/AVRO:CUSTOMER-NAME[1]) = 0) then ('_789odtMissing') else (
|
|
(: nullCheck :) if ($out_AVRO_root/AVRO:PERSONAL-DATA[1]/AVRO:CUSTOMER-NAME[1]/@xsi:nil['true']) then ('_osdt987Null') else ($out_AVRO_root/AVRO:PERSONAL-DATA[1]/AVRO:CUSTOMER-NAME[1]/text()) (: missingCheck :)) (: nullCheck :) ) return if ((if (fn:count($unconvertedValue) = 1) then $unconvertedValue else $unconvertedValue[1]) cast as xs:string? = '_osdt987Null') then () else text { $unconvertedValue }
|
|
)
|
|
(: optLeaf cond out$/root/ORecord/name :) return if ($opt[last()] cast as xs:string? = '_789odtMissing') then () else if (fn:string-length(fn:string-join($opt[last()],'')) > 0) then
|
|
(: element out$/root/ORecord/name :) element AVRO:name { $opt
|
|
(: element end out$/root/ORecord/name :) }
|
|
else () (: optLeaf cond end out$/root/ORecord/name :) ,
|
|
(: optLeaf out$/root/ORecord/address :) let $opt := (
|
|
(: value out$/root/ORecord/address :)
|
|
let $unconvertedValue := (
|
|
(: missingCheck :) if (fn:count($out_AVRO_root/AVRO:PERSONAL-DATA[1]/AVRO:CUSTOMER-ADDRESS[1]) = 0) then ('_789odtMissing') else (
|
|
(: nullCheck :) if ($out_AVRO_root/AVRO:PERSONAL-DATA[1]/AVRO:CUSTOMER-ADDRESS[1]/@xsi:nil['true']) then ('_osdt987Null') else ($out_AVRO_root/AVRO:PERSONAL-DATA[1]/AVRO:CUSTOMER-ADDRESS[1]/text()) (: missingCheck :)) (: nullCheck :) ) return if ((if (fn:count($unconvertedValue) = 1) then $unconvertedValue else $unconvertedValue[1]) cast as xs:string? = '_osdt987Null') then () else text { $unconvertedValue }
|
|
)
|
|
(: optLeaf cond out$/root/ORecord/address :) return if ($opt[last()] cast as xs:string? = '_789odtMissing') then () else if (fn:string-length(fn:string-join($opt[last()],'')) > 0) then
|
|
(: element out$/root/ORecord/address :) element AVRO:address { $opt
|
|
(: element end out$/root/ORecord/address :) }
|
|
else () (: optLeaf cond end out$/root/ORecord/address :) ,
|
|
(: optLeaf out$/root/ORecord/transaction_number :) let $opt := (
|
|
(: value out$/root/ORecord/transaction_number :)
|
|
let $unconvertedValue :=
|
|
( let $castVar := ( (
|
|
(: missingCheck :) if (fn:count($out_AVRO_root/AVRO:TRANSACTIONS[1]/AVRO:TRANSACTION-NBR[1]) = 0) then ('_789odtMissing') else (
|
|
(: nullCheck :) if ($out_AVRO_root/AVRO:TRANSACTIONS[1]/AVRO:TRANSACTION-NBR[1]/@xsi:nil['true']) then ('') else ($out_AVRO_root/AVRO:TRANSACTIONS[1]/AVRO:TRANSACTION-NBR[1]/text()) (: missingCheck :)) (: nullCheck :) ) )
|
|
return $castVar cast as xs:string?)
|
|
return if ((if (fn:count($unconvertedValue) = 1) then $unconvertedValue else $unconvertedValue[1]) cast as xs:string? = '_osdt987Null') then () else text { $unconvertedValue }
|
|
)
|
|
(: optLeaf cond out$/root/ORecord/transaction_number :) return if ($opt[last()] cast as xs:string? = '_789odtMissing') then () else if (fn:string-length(fn:string-join($opt[last()],'')) > 0) then
|
|
(: element out$/root/ORecord/transaction_number :) element AVRO:transaction_number { $opt
|
|
(: element end out$/root/ORecord/transaction_number :) }
|
|
else () (: optLeaf cond end out$/root/ORecord/transaction_number :)
|
|
(: element end out$/root/ORecord :) }))
|
|
};
|
|
|
|
|
|
(: CG context elem out: out$/root in: in$/Record loop: $out_AVRO_root inScope?: true :)
|
|
declare function local:out_AVRO_root($top)
|
|
{
|
|
(: seq in$/Record :)
|
|
for $out_AVRO_root at $out_AVRO_root_i in let $inVar := $top/AVRO:Record return $inVar
|
|
return (: for :) (
|
|
(: element out$/root :) element AVRO:root { (), local:out_AVRO_root_AVRO_ORecord($top,$out_AVRO_root,$out_AVRO_root_i)
|
|
|
|
(: element end out$/root :) }
|
|
(: seq end in$/Record :) )
|
|
};
|
|
|
|
(: OUTPUT - Start :)
|
|
local:out_AVRO_root(/)
|
|
(: OUTPUT - End :)
|