Rahul - I am not completely sure on your question however could you try
below code and see if this helps,

let $x :=
<head xmlns="http://www.w3.org/1999/xhtml";>
    <script type="text/javascript"></script>
    <title></title>
</head>
return $x//text()[fn:normalize-space(.) ne '']



On Thu, Apr 9, 2015 at 1:05 PM, Asitmohan Nautiyal <[email protected]>
wrote:

>  Hi Rahul,
>
>
>
> Please refer below link for your clarification written by David log back
> ago :
>
>
>
> http://blog.davidcassel.net/2011/06/text-fnstring-and-fndata/
>
>
>
>
>
> Regards,
>
> Asit Nautiyal
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Rahul Gupta
> *Sent:* 09 April 2015 12:41
> *To:* [email protected]
> *Subject:* [MarkLogic Dev General] text() Vs String() Vs data()
>
>
>
> I have come across a problem. I want to check here whether the given xml
> contains any kind of text. I don’t want any output if any of the children
> doesn’t have any text. Like in the example given, it should not give me
> anything.
>
> let $x :=
>
> <head xmlns="http://www.w3.org/1999/xhtml";>
>
>     <script type="text/javascript"></script>
>
>     <title></title>
>
> </head>
>
> (1) $x/text() will yield nothing. But if I change Hi David, then also it
> is returning nothing since text() works on the self-node. That’s fine.
>
> (2) $x/string() will yield something but dont know what? I was expecting
> it should not give me anything in the example mentioned. Can you please
> help?
>
> (3) $x/data gives “XDMP-NONMIXEDCOMPLEXCONT: Node has complex type with
> non-mixed complex content.” since the head node is under some namespace
> {WHY??}. Removing the namespace solves this error but behaving same like
> string.
>
>
>
> Thanks & Regards,
>
> Rahul
>
>
>
> ::DISCLAIMER::
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> E-mail transmission is not guaranteed to be secure or error-free as
> information could be intercepted, corrupted,
> lost, destroyed, arrive late or incomplete, or may contain viruses in
> transmission. The e mail and its contents
> (with or without referred errors) shall therefore not attach any liability
> on the originator or HCL or its affiliates.
> Views or opinions, if any, presented in this email are solely those of the
> author and may not necessarily reflect the
> views or opinions of HCL or its affiliates. Any form of reproduction,
> dissemination, copying, disclosure, modification,
> distribution and / or publication of this message without the prior
> written consent of authorized representative of
> HCL is strictly prohibited. If you have received this email in error
> please delete it and notify the sender immediately.
> Before opening any email and/or attachments, please check them for viruses
> and other defects.
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> _______________________________________________
> 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