Try this one.

 let $in-xml :=
<in-xml>
   <a></a>
   <b/>
   <c></c>
   <d><X>aaa</X></d>
   <e></e>
   <f></f>
   <g></g>
</in-xml>

return
 if (fn:data($in-xml) != '') then
  "not empty"
 else
   "empty"

Regards,
Arvind Kr.

On Mon, Apr 18, 2016 at 3:45 PM, Eckey, Florian <[email protected]>
wrote:

> Are you looking for this?
> if(string-join($in-xml//*/string())="") then 'all empty' else 'not empty‘
>
> Maybe you can trim the string, if you say a space is empty too.
>
> --
> Florian Eckey
> adesso AG
> Software Engineer
> Stockholmer Allee 20
> 44269 Dortmund
>
> T +49 231 7000-2193
> F +49 231 7000-1000
> M +49 152 38097418
> E [email protected]
> www.adesso.deblog.adesso.de
>
>
> Von: <[email protected]> im Auftrag von "Kapoor,
> Pragya" <[email protected]>
> Antworten an: MarkLogic Developer Discussion <
> [email protected]>
> Datum: Montag, 18. April 2016 um 12:07
> An: MarkLogic Developer Discussion <[email protected]>
> Betreff: [MarkLogic Dev General] Xquery : Empty Content
>
>
> Hi,
>
>
> I have an xml :
>
>
>     let $in-xml :=
> <in-xml>
>    <a></a>
>    <b/>
>    <c></c>
>    <d><X></X></d>
>    <e></e>
>    <f></f>
>    <g></g>
> </in-xml>
>
>
> Now, how can I check if the content of all the elements and there child
> elements in $in-xml are empty(no content)?
>
>
> if(content is empty) then "do this" else "do this"
>
>
> 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."
>
> -------------------------------------------------------
>      >>> business. people. technology. <<<
> -------------------------------------------------------
>
> adesso AG mit Sitz in Dortmund
> Vorstand: Michael Kenfenheuer (Vors.), Christoph Junge, Andreas Prenneis
> Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn
> Amtsgericht Dortmund HRB 20663
>
>
> <https://www.aaajobs.de/de/atmosphaere/adesso_ist_deutschlands_bester_arbeitgeber.html?utm_source=Signatur&utm_medium=Banner%20E-Mail&utm_campaign=GPTW>
>
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to