|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Recursion problemJens-Martin Groenne dev at nullsec.netFri Sep 7 11:54:34 PDT 2007
I have a problem with the following code.
When I call this function it actually makes n calls to the functions
getCustomer and getAddress, where n is the number of customerIds and
addressIds in the Criteria.
Can anyone point out to me what I have done wrong?
Here is the code:
declare function tns:getCustomer($Criteria as element(ns30:Criteria)) as
element(ns28:Customer)*{
let $CustCustomers := ns32:getCustomer(
<ns33:CustCriteria>
{
for $customerId in
fn:distinct-values($Criteria/ns30:customerId)
return
<ns33:custId>{fn:data($customerId)}</ns33:custId>
}
</ns33:CustCriteria>
)
let $AddAddresses := ns7:getAddress(
<ns8:AddressGetCriteria>
{
for $addressId in
fn:distinct-values($Criteria/ns30:addressId)
return
<ns8:farId>{fn:data($addressId)}</ns8:farId>
}
</ns8:AddressGetCriteria>
)
for $searchCustomer in $Criteria
return
for $resultCustomer in $CustCustomers/ns28:Customer
where $searchCustomer/ns30:customerId =
$resultCustomer/ns28:customerId
return
<ns28:Customer>
{
for $Person in $resultCustomer/ns28:Person
return $Person
}
{
for $Organization in $resultCustomer/ns28:Organization
return $Organization
}
{
for $resultAddress in $AddAddresses
where $resultAddress/ns29:addressId =
$searchCustomer/ns30:addressId
return
$resultAddress
}
</ns28:Customer>
};
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






