[xquery-talk] Local schemas and selecting paths

Michael Kay mhk at mhk.me.uk
Mon Sep 27 10:10:32 PDT 2004


It shouldn't matter what form the namespace URI takes, so long as it is the
same in the query and the source document. You haven't shown us the source
document, so it's hard to tell where you've gone wrong.
 
Namespace URIs are not normally treated as relative URIs: they are compared
character-by-character. The W3C made a decision deprecating use of relative
URIs as namespace URIs because some vendors wanted to interpret them
relatively to the base URI, but that deprecation came after the publication
of XML Namespaces 1.0, which is explicit (a) that relative URIs are legal as
namespaces, and (b) that they are compared character-by-character.
 
Your namespace URI appears to be a reference to an XML Schema. Some people
advocate that practice, but in my view it's confusing. The namespace and the
schema are different things and should have different URIs. Namespace URIs
are never dereferenced to find a resource on the web, they are just abstract
identifiers.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On Behalf Of
Anthony Ikeda
Sent: 27 September 2004 08:52
To: talk at xquery.com
Subject: [xquery-talk] Local schemas and selecting paths



I'm new to XQuery and trying to get the hang of it and so far so good.

 

One question I have is selecting XPaths using a locally declared namespace.
For example I have the following XQuery:

 

declare namespace a = "myNamespace.xsd"

 

<result>

            {

for $val in /a:trains/a:types

return $val/text()

}

</result>

 

Both the xquery document and the schema exist in the same folder side by
side.

 

Typically I've declared namespaces using URIs rather than locally but find
that I do not get a result from the above code (The same goes when I use the
file:// protocol in the namespace declaration).

 

If I use the fully qualified path (I think that's what it's called) like so:

 

<result>

            {

for $val in /*[name="trains"]/*[name="types"]

return $val/text()

}

</result>

 

Then there is no problem.

 

I've tried running the above xqueries using the Stylus Studio built in
engine and the Saxon query engine (v7) also in Stylus Studio.

 

Does anyone know where I'm going wrong?

 

Regards,

Anthony

 

Business Analyst

Copyright Agency Limited

 


**********************************************************
This electronic mail message and any attachments are confidential. If you
are not the intended recipient please do not use the information, advise us
immediately and destroy this message. Opinions and information in this
message are those of the sender and not necessarily those of CAL. Unless
expressly permitted by the sender, you may not copy, disclose or use the
contents in any way.

If this e-mail contains a marketing message and you do not want to receive
such messages from CAL in the future please e-mail info at copyright.com.au
including remove in the subject line of the reply message.
**********************************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20040927/891a9842/attachment-0001.htm


More information about the talk mailing list