Re: [bdbxml] order with metadata

John Snelson <[email protected]> Fri, 05 Aug 2005 11:46:41 +0100
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
sarigiannis xaralampos wrote:
> I try
> 
> for $i in 
> collection('LD.dbxml')//imsld:learning-design/imsld:title/text() order 
> by xs:string($i[dbxml:metadata('md:author')]) ascending  return $i
> 
> ---- for taking the titles of my files ordered alphabically by authors name

The correct syntax would be

for $i in collection('LD.dbxml')//imsld:learning-design/imsld:title 
order by dbxml:metadata('md:author', $i) ascending return string($i)

> for $i in collection('LD.dbxml')//imsld:learning-design/ 
> imsld:title/text()  order by xs:dateTime($i[dbxml:metadata('md:date')]) 
> ascending  return $i
> 
>   --for taking the titles  from the newest to the oldest

Similarly here, the correct syntax is

for $i in collection('LD.dbxml')//imsld:learning-design/imsld:title 
order by dbxml:metadata('md:date', $i) ascending return string($i)

I suggest that the "md:date" metadata is set with the correct type, ie:

xmlDoc.setMetaData("http://metadata","date",new 
XmlValue(XmlValue.DATE_TIME, theDate.toString()));

I hope that helps,

John

-- 
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com

Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml


------------------------------------------
To remove yourself from this list, send an
email to [email protected]