Few more examples:

 if ($DocRecord[fn:not(.[Hidden])])
                then
                 ()
               else
                    $DocRecord


if ($NumOfGroups = 1)
        then
          $DocRecords[fn:not(.[Hidden])]
        else ()


________________________________
From: [email protected] 
<[email protected]> on behalf of Kapoor, Pragya 
<[email protected]>
Sent: Wednesday, January 27, 2016 11:38 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] If xml element exists



Hi,


I need to check the below conditions at multiple places, if there are other 
more performant way to achieve these:


if ( fn:doc("/misc/SavedTextSearches.xml")/TextSearches/User[Name = $User] )
  then
    "YES"
  else
    "NO"


if ( fn:doc("/misc/SavedTextSearches.xml")/TextSearches )
  then
    ( )
  else 'p'

Thanks
Pragya


"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to