RE: Generating RDF-style URIs from a namespace

> I'm wondering if it can be done using a namespace declaration 

Probably not.  The RHS of the "declare namespace" must be a string
literal.  See [1] Section 4.11 Namespace Declaration:

> [10] NamespaceDecl ::= "declare" "namespace" NCName "=" StringLiteral

This means that the NamespaceDecl cannot contain function calls or
string concatentation.  The value assigned to the namespace must in fact
be known at static analysis time and cannot be generated dynamically in
XQuery 1.0.

/paulc

[1] http://www.w3.org/TR/xquery/#id-namespace-decls

This means that you cannot
Paul Cotton, Microsoft Canada 
17 Eleanor Drive, Nepean, Ontario K2E 6A3 
Tel: (613) 225-5445 Fax: (425) 936-7329 
mailto:pcotton@microsoft.com

  

> -----Original Message-----
> From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf
Of
> Howard Katz
> Sent: September 7, 2004 5:25 PM
> To: www-ql@w3.org
> Subject: Generating RDF-style URIs from a namespace
> 
> 
> Is there a simple way of taking a namespace declaration such as
> 
>        declare namespace foo="http://foo/";
> 
> and a list of local names, such as
> 
>      ( bar, baz, ... )
> 
> and generating a list of the corresponding URIs, a la RDF, such as
> 
>   http://foo/bar
>   http://foo/baz
>   ...
> 
> ?
> 
> I can see a way of doing this without explicit namespaces, using
simple
> string concatenation and an xs:anyURI constructor:
> 
>     let $namespace := concat( "http://foo/", ":" )
>     return
>          xs:anyURI( concat( $namespace, "bar" ))
> 
> but I'm wondering if it can be done using a namespace declaration,
since
> that somehow seems more in keeping with the intent. (I can see a
rather
> convoluted way of doing it using a computed element constructor and
> fn:namespace-uri(). I'm wondering tho if there's a more direct way of
> doing
> it without constructing an element first.)
> 
> Howard
> 

Received on Wednesday, 8 September 2004 00:38:50 UTC