Subject:Re: Xquery ques. How to check for empty attributes Author:Minollo I. Date:26 Apr 2004 04:10 PM
One way to do that is:
<Loans>
{
for $Loan in /Loans/Loan
return
if($Loan/@LoanId and string-length($Loan/@LoanId)>0) then
<Loan Int="{$Loan/@InterestRate}" Id="{$Loan/@LoanId}"/>
else
<Loan Int="{$Loan/@InterestRate}"/>
}
</Loans>
...which will work fine in Stylus 173i and its mapper.
A much cleaner solution would probably be:
<Loans>
{
for $Loan in /Loans/Loan
return
<Loan Int="{$Loan/@InterestRate}">
{
if($Loan/@LoanId and string-length($Loan/@LoanId)>0) then
(attribute Id {$Loan/@LoanId})
else ()
}
</Loan>
}
</Loans>
...this will work fine in BL173i if you manually edit/run it, but it won't
work in XQuery mapper; we are working to address this issue.