Hello Roy,
I don't understand your question. Could you please elaborate?
Wouter
2009/8/5 Roy Walter
Thanks Wouter, very helpful. This works fine in my application:
<p>{xs:string(exactly-one($res/../@speakername))}: {$res}</p>
Another quick question if I may: how should I encode an entity as in the following example so that it works in the context of a query:
<h4>Keynote — {$res/../preceding-sibling::heading[1]/text()}</h4>
-- Roy
Wouter Alink wrote:
Hello Roy,
One of the things about MonetDB/XQuery that it does static typing.
So the compiler tries to figure out the cardinality of "$res/../@speakername" and cannot know whether it happens 0 or more times, and will therefore not be able to detect whether there is exactly one speakername attribute matching this query.
Because xs:string will need exactly 1 argument, you need to either give a hint that there will be exactly one attribute, or otherwise pass each speakername attribute to the function.
So either: <p>{xs:string(exactly-one($res/../@speakername))}: {$res}</p> or: <p>{for $i in $res/../@speakername return xs:string($i)}: {$res}</p>
should work. If not, please give us some insight in the error which was returned.
Hope this helps, Wouter
2009/8/5 Roy Walter
: The following XQuery fragment will add the speakername attribute as an attribute of the <p> tag:
<p>{$res/../@speakername}: {$res}</p>
becomes:
<p speakername="Roy Walter">Some text...</p>
What I want is:
<p>Roy Walter: Some text...</p>
How does MonetDB/XQuery handle this? I tried:
<p>{xs:string($res/../@speakername)}: {$res}</p>
but it errors.
-- Roy
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.44/2283 - Release Date: 08/05/09 05:57:00