If you just want to get the elements below BOOKS:

    /xh:BOOKS/element()

or, for all nodes

    /xh:BOOKS/node()

/ch

On Tue, May 12, 2015 at 7:12 PM, Mark Shanks <[email protected]> wrote:
> Hi, I want to run an xquery that deletes elements that are empty, e.g.,
> <tag></tag>
>
> The following code works for a specific element:
>
> declare namespace xh="http://marklogic/";;
> for $t in (/xh:BOOKS)/xh:TITLES
> return if ($t='')
> then
>   xdmp:node-delete($t)
> else
>   ()
>
> However, how can I modify it to delete all elements in BOOKS, not just
> TITLES? I tried obvious solutions like for $t in (/xh:BOOKS) and this did
> not hit any of the elements.
>
> Thanks,
>
> Mark
>
> _______________________________________________
> 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