On Thu, 01 Oct 2009 07:03:05 -0700, Tony Mariella <[email protected]>
wrote:
I have a query in Marklogic that returns results.
The query works fine. But I need to format the results so that I can out
them into a table.
...
How can I format the output correctly ?
Here you go. The boundary-space setting and the text constructors
are to keep the pretty-printing. If you don't care about that you can
just leave them off.
declare boundary-space preserve;
let $x :=
<results>
<name>Test</name>
<date>01-Oct-2009</date>
<interface>
<id>ID 1</id>
<address>2345</address>
</interface>
<interface>
<id>ID 2</id>
<address>3456</address>
</interface>
<interface>
<id>ID 3</id>
<address>6789</address>
</interface>
<interface>
<id>ID 4</id>
<address>7890</address>
</interface>
</results>
let $name := $x/name
let $date := $x/date
return
<item>{
for $res in $x/interface return (
text {"
"},
<if>{
text {"
"},$name,
text {"
"},$date,
$res/node()
}</if>
)
}
</item>
//Mary
[email protected]
Principal Engineer
Mark Logic Corporation
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general