namespace in XQuery

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

namespace in XQuery

Pascal Heus
Dear All:
In the XQuery below, I declare a specific namespace but whenever I try to use it in the query itself, I get the following error from OPS: "No namespace defined for prefix ddi"
I'm using ops-3.0.beta3.200509020313 with eXist-snapshot-20051026. The query runs fine in the eXist sandbox, only difference in that the "for" statement does not need to be surrounded by {}. The query also runs under OPS if I use the *: instead of ddi: but then I can't specify a where clause and it I loose the namespace restriction. Any suggestion would be appreciated.
many thanks
Pascal

    <p:processor name="oxf:xmldb-query">
        <p:input name="datasource" href="datasource.xml"/>
        <p:input name="query">
            <xdb:query collection="/db/surveys">
                <xquery>
                    xquery version "1.0";
                    declare namespace ddi="http://www.icpsr.umich.edu/DDI";
                    {for $s in /ddi:codeBook return
                        <results>
                            <title>{$s/ddi:stdyDscr//ddi:titl}</title>
                        </results>
                    }
                </xquery>

            </xdb:query>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: namespace in XQuery

Alessandro  Vernet
Administrator
Hi Pascal,

You are saying that the "for" needs to be surrounded by {} when you
run the query using the xmldb-query processor, but that it does not
work in this case? What are you getting if you omit the {} using the
xmldb-query processor? What are you getting when you run the query
with the {} in the eXist sandbox?

Alex

On 11/12/05, Pascal Heus <[hidden email]> wrote:

>  Dear All:
>  In the XQuery below, I declare a specific namespace but whenever I try to
> use it in the query itself, I get the following error from OPS: "No
> namespace defined for prefix ddi"
>  I'm using ops-3.0.beta3.200509020313 with eXist-snapshot-20051026. The
> query runs fine in the eXist sandbox, only difference in that the "for"
> statement does not need to be surrounded by {}. The query also runs under
> OPS if I use the *: instead of ddi: but then I can't specify a where clause
> and it I loose the namespace restriction. Any suggestion would be
> appreciated.
>  many thanks
>  Pascal
>
>      <p:processor name="oxf:xmldb-query">
>          <p:input name="datasource" href="datasource.xml"/>
>          <p:input name="query">
>              <xdb:query collection="/db/surveys">
>                  <xquery>
>                      xquery version "1.0";
>                      declare namespace
> ddi="http://www.icpsr.umich.edu/DDI";
>                      {for $s in /ddi:codeBook return
>                          <results>
>                              <title>{$s/ddi:stdyDscr//ddi:titl}</title>
>                          </results>
>                      }
>                  </xquery>
>              </xdb:query>
>          </p:input>
>          <p:output name="data" ref="data"/>
>      </p:processor>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet