I using xquery... specifically modifying the World's Leader xquery application,
the index.xqy file. Here is the same code:
I get no value for @count
let $emp := local:getEmployees()
for $employees in $emp/search:facet/search:facet-value
let $fullname := $employees/text()
let $entries := $employees/@count
let $urlBuild := fn:concat("fullName=", $fullname, "&", "workDate=",
"10-1-2015")
return (
<tr>
<td colspan="10"><hr/></td>
</tr>,
<tr>
<td><b><a
href="http://localhost:8077/bycountry.xqy?{$urlBuild}">{$fullname}</a></b></td>
<td>2015-08-04</td>
<td>2015-08-10</td>
<td><b>{$entries}</b></td>
<td>{local:getTotalHours($fullname)}</td>
<td>{local:getAverageHours($fullname)}</td>
<td>{local:getMaxHours($fullname)}</td>
</tr>,
<tr>
<td colspan="10" class="summary">$description...</td>
</tr> )
}
</table
From: [email protected]
[mailto:[email protected]] On Behalf Of David Lee
Sent: Tuesday, December 8, 2015 8:03 PM
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] simple xQuery Web Application
>> The following code works in the Query Console but does not work in my xQuery
>> application.
What is your application? (What library/program etc)
The results shown look correct for the first return
You are returning a sequence of sequences which will flatten to a single long
sequence.
Some XQuery APIs' dont handle sequence results ( or do not using the most basic
interface).
-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]<mailto:[email protected]>
Phone: +1 812-482-5224
Cell: +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Javier Lizarraga
Sent: Tuesday, December 08, 2015 8:06 PM
To: MarkLogic Developer Discussion
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] simple xQuery Web Application
Hello David,
Related question...
I am having issues accessing an element attribute in search:facet...
The following code works in the Query Console but does not work in my xQuery
application.
let $emp := search:search("(Bachala OR Chakka OR Kompelly OR Lasseter)",
$options)
for $employees in $emp/search:facet/search:facet-value
let $fullname := $employees/text()
let $entries := $employees/@count
return ($fullname, $entries, $emp)
==>
Vishnu Bell
47
<search:response snippet-format="empty-snippet" total="91" start="1"
page-length="100" xmlns:search="http://marklogic.com/appservices/search">
<search:facet name="FULL_NAME" type="xs:string">
<search:facet-value name="Vishnu Bell" count="47">
Vishnu Bell
</search:facet-value>
<search:facet-value name="Bala Bell" count="36">
Bala Bell
</search:facet-value>
<search:facet-value name="Stephen Bell" count="8">
Stephen Bell
</search:facet-value>
</search:facet>
<search:qtext>
(Bachala OR Chakka OR Kompelly OR Lasseter)
</search:qtext>
</search:response>
Advice would be greatly appreciated.
Javier
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of David Lee
Sent: Thursday, December 3, 2015 11:51 AM
To: MarkLogic Developer Discussion
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] simple xQuery Web Application
Thanks that works. So, the * is saying any namespace.
Yes, (as of XPath 2.0)
/element == element in no namepace
/*:element == element in any namepace
Very useful for quick 'one off's when you dont want to bother with the
neamespace decl,
but its a bad habbit to get into for production code -- you can end up
selecting elements in unexpected places
that you didnt intend.
-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]<mailto:[email protected]>
Phone: +1 812-482-5224
Cell: +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general