[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

XQuery 3.0 and maps in Saxon

Michael Kay mike at saxonica.com
Sat Jan 28 10:52:04 PST 2012


  XQuery 3.0 and maps in Saxon
On 28/01/2012 16:56, Jakub Maly wrote:
> (At first, I apologize to the members of XSL list, from which I was referred here, for getting the same message twice).
> Hello,
> I would like to experiment with map features in Saxon (http://www.saxonica.com/documentation/expressions/xpath30maps.xml), but I am unable to get past query compilation. Maybe I am missing some parameter or I use a wrong namespace, but I just can't find the right answer.
I was rather hoping that the W3C spec would be out before the Saxon 
implementation, but it got held up because people in the XQuery WG 
didn't want it in XQuery 3.0. The net result is that there's a shortage 
of documentation.

The page at http://www.saxonica.com/documentation/extensions/map.xml 
wrongly gives the namespace as "http://ns.saxonica.com/map". In fact, in 
the over-optimistic belief that the spec was about to be approved by 
W3C, I moved the functions into the namespace 
"http://www.w3.org/2005/xpath-functions/map".
> This is my query code:
>
> xquery version "3.0";
> (: i have also tried http://www.w3.org/2005/xpath-functions/map, no difference :)
> import module namespace map = "http://ns.saxonica.com/map";
> map:get(map { 1 := 'aaa'}, 1)
>
For vendor-defined extension functions in Saxon, you don't need an 
import module, but you do need to declare the namespace. So it should be

xquery version "3.0";
declare namespace map := "http://www.w3.org/2005/xpath-functions/map";
map:get(map { 1 := 'aaa'}, 1)

Michael Kay
Saxonica


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.