[xquery-talk] namespace questions
Marc Van Cappellen
Marc.Van.Cappellen at datadirect.com
Mon May 8 04:41:35 PDT 2006
I would expect this to result in
<foo>
<sam:bar xmlns:sam="http://www.aaa.aaa/a"/>
<huhu:ele xmlns:huhu="http://www.aaa.aaa/b">text</huhu:ele>
</foo>
You might want to check with the implementer of the XQuery engine you're using?
Marc
> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On Behalf
> Of Uwe Küssner
> Sent: Monday, May 08, 2006 9:25 AM
> To: talk at xquery.com
> Subject: [xquery-talk] namespace questions
>
> Hello,
>
> I have difficulties in using namespaces in xquery.
> To create an xml-document like this:
>
> <foo xmlns:sam="http://www.aaa.aaa/a" xmlns:huhu="http://www.aaa.aaa/b"
> >
> <sam:bar/>
> <huhu:ele>text</huhu:ele>
> </foo>
>
> I use the follwing xquery:
>
> declare namespace sam="http://www.aaa.aaa/a";
> declare namespace huhu="http://www.aaa.aaa/b";
> let $extern := <a namespace="huhu"/>
> return
> <foo>
> <sam:bar/>
> {element {concat($extern/@namespace,":","ele")} {"text"}}
> </foo>
>
> which generates:
>
> <foo>
> <sam:bar/>
> <huhu:ele>text</huhu:ele>
> </foo>
>
> Questions:
> 1. What is necessary to create the missing namespace declarations
> xmlns:sam="http://www.aaa.aaa/a" in the foo element ?
> 2. If the second line (declare namespace huhu=http://www.aaa.aaa/b"; is
> missing ) there is a runtime error. (Undeclared prefix in element
> name:huhu). If the prefix "huhu" of the namespace is not known in advance,
> but only at run time, is it still possible to construct a node
> "<huhu:ele>" ?
>
> thank you for your help.
>
>
> Uwe Küssner
>
>
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20060508/1dbf2113/attachment.htm
More information about the talk
mailing list