Hi, Use xs:string($title) instead of $title/text(), it's more robust.
But this should not be the problem here. Is it possible there a namespace problem? Either the title element is in a namespace in the source document, or this snippet of code is within a HTML element declaring the HTML namespace as the default namespace. Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ On 8 February 2016 at 11:30, ? wrote: > Hi Subramani, > > > > > > Change your code into following . > > > > for $doc at $index in $docs[1 to 20] > > return > > <p> > > <span> > > { > > let $title:=$doc//title > > return concat($index," ",$title/text()) > > } > > </span> > > </p> > > > > > > > > From: [email protected] > [mailto:[email protected]] On Behalf Of Subramani > Shanmugaraju 03 > Sent: Monday, February 08, 2016 3:52 PM > To: [email protected] > Subject: [MarkLogic Dev General] Displaying result in html page: Mark Logic > - reg > > > > Hi All, > > > > I created two html pages – one is to perform a search and another one is to > display the result. > > > > I am getting search words from user in first html page and passing it to the > next page where I am using cts query to perform search in the database. > > > > In the second html page (testclient-results.xqy), I am using the below code > to display index number followed by a space and then followed by document > title. > > > > for $doc at $index in $docs[1 to 20] > > return > > <p> > > <span> > > { > > let $title:=$doc//title > > return concat($index," ",$title[1]) > > } > > </span> > > </p> > > > > But I am not able to display the document title using the above code. When I > am using return concat($index," ",$doc), I am getting whole document in the > result page. > > > > Am I missing something here? Please guide me. > > > > Thanks, > > Subramani > > This e-mail and any files transmitted with it are for the sole use of the > intended recipient(s) and may contain confidential and privileged > information. If you are not the intended recipient(s), please reply to the > sender and destroy all copies of the original message. Any unauthorized > review, use, disclosure, dissemination, forwarding, printing or copying of > this email, and/or any action taken in reliance on the contents of this > e-mail is strictly prohibited and may be unlawful. Where permitted by > applicable law, this e-mail and other e-mail communications sent to and from > Cognizant e-mail addresses may be monitored. > > _______________________________________________ > 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
