Hello again,
background -------------- I am look at the following file in the bizdoc2 example: data-access/exist/list-documents.xpl requirement --------------- To display a summary table of reports stored in an eXist database. In addition to the document-id element, I would like to display values stored in other elements of the XML file. The XML file has many elements and for the purpose of efficiency, I do not want to return the top-level node, but instead only select those nodes with values that I need to display. question ---------- Please does anyone know how to select multiple elements in various places of the xml document hierarchy, using the xmldb-query processor together with eXist's implementation of Xquery/Xpath? I imagine FLWOR is required to achieve this, however, the examples of FLWOR that I've found return XML *in* a for statement, ie multiple times. I understand with the xmldb-query processor, that it is a requirement to only use the return statement once. thank you again for any advice Tanya extract from list-documents.xpl -------------------------------------- <!-- Return the ids of all the documents --> <p:processor name="oxf:xmldb-query"> <p:input name="datasource" href="datasource.xml"/> <p:input name="query"> <xdb:query collection="/db/orbeon/bizdoc-example" create-collection="true"> xquery version "1.0"; <result> <!-- this needs to be retrieved from the database --> <report> <document-id>abcd</document-id> <org_type>abcd</org_type> </report> <report> <document-id>abcdef</document-id> <org_type>abcdef</org_type> </report> </result> </xdb:query> </p:input> <p:output name="data" ref="document-list"/> </p:processor> example xml file to query ------------------------------ <document-info> <document-id>123</document-id> <document> <org> <org_type>abc</org_type> </org> </document> </document-info> -- 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 |
Administrator
|
Hi Tanya,
Try something like this: <xdb:query collection="/db/orbeon/bizdoc-example" create-collection="true"> xquery version "1.0"; <result> <your-name-for-root-element> { query 1 } { query 2 } </your-name-for-root-element> </result> </xdb:query> Alex On 10/12/05, Tanya Gray <[hidden email]> wrote: > Hello again, > > background > -------------- > I am look at the following file in the bizdoc2 example: > data-access/exist/list-documents.xpl > > requirement > --------------- > To display a summary table of reports stored in an eXist database. In addition to the document-id element, I would like to display values stored in other elements of the XML file. > > The XML file has many elements and for the purpose of efficiency, I do not want to return the top-level node, but instead only select those nodes with values that I need to display. > > question > ---------- > Please does anyone know how to select multiple elements in various places of the xml document hierarchy, using the xmldb-query processor together with eXist's implementation of Xquery/Xpath? > > I imagine FLWOR is required to achieve this, however, the examples of FLWOR that I've found return XML *in* a for statement, ie multiple times. I understand with the xmldb-query processor, that it is a requirement to only use the return statement once. > > > thank you again for any advice > Tanya > > extract from list-documents.xpl > -------------------------------------- > > <!-- Return the ids of all the documents --> > <p:processor name="oxf:xmldb-query"> > <p:input name="datasource" href="datasource.xml"/> > <p:input name="query"> > <xdb:query collection="/db/orbeon/bizdoc-example" create-collection="true"> > xquery version "1.0"; > > <result> > <!-- this needs to be retrieved from the database --> > <report> > <document-id>abcd</document-id> > <org_type>abcd</org_type> > </report> > <report> > <document-id>abcdef</document-id> > <org_type>abcdef</org_type> > </report> > > > </result> > > </xdb:query> > </p:input> > <p:output name="data" ref="document-list"/> > </p:processor> > > > example xml file to query > ------------------------------ > > <document-info> > <document-id>123</document-id> > <document> > <org> > <org_type>abc</org_type> > </org> > </document> > </document-info> > > > > > > > > > > > > -- > 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 > > > -- 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 |
In reply to this post by Tanya Gray (Oxford)
Hello Tanya,
you should get what you want by only using xquery. A possible solution is to use custom functions. You can add various functions to your xquery statement an call them from your 'root' flowr statement. On the exist homepage are several examples for custom functions (http://demo.exist-db.org/xquery/xquery.xq see Java Binding complex). The spec on www.w3.org is big, but not bad - for deeper information ;) Best regards - Claus => -----Ursprüngliche Nachricht----- => Von: Tanya Gray [mailto:[hidden email]] => Gesendet: Mittwoch, 12. Oktober 2005 15:10 => An: [hidden email] => Betreff: [ops-users] Xquery, XPath, eXist, and oxf:xmldb-query => => Hello again, => => background => -------------- => I am look at the following file in the bizdoc2 example: => data-access/exist/list-documents.xpl => => requirement => --------------- => To display a summary table of reports stored in an eXist database. In => addition to the document-id element, I would like to display values => stored in other elements of the XML file. => => The XML file has many elements and for the purpose of efficiency, I do => not want to return the top-level node, but instead only select those => nodes with values that I need to display. => => question => ---------- => Please does anyone know how to select multiple elements in various places => of the xml document hierarchy, using the xmldb-query processor together => with eXist's implementation of Xquery/Xpath? => => I imagine FLWOR is required to achieve this, however, the examples of => FLWOR that I've found return XML *in* a for statement, ie multiple times. => I understand with the xmldb-query processor, that it is a requirement to => only use the return statement once. => => => thank you again for any advice => Tanya => => extract from list-documents.xpl => -------------------------------------- => => <!-- Return the ids of all the documents --> => <p:processor name="oxf:xmldb-query"> => <p:input name="datasource" href="datasource.xml"/> => <p:input name="query"> => <xdb:query collection="/db/orbeon/bizdoc-example" create- => collection="true"> => xquery version "1.0"; => => <result> => <!-- this needs to be retrieved from the database --> => <report> => <document-id>abcd</document-id> => <org_type>abcd</org_type> => </report> => <report> => <document-id>abcdef</document-id> => <org_type>abcdef</org_type> => </report> => => => </result> => => </xdb:query> => </p:input> => <p:output name="data" ref="document-list"/> => </p:processor> => => => example xml file to query => ------------------------------ => => <document-info> => <document-id>123</document-id> => <document> => <org> => <org_type>abc</org_type> => </org> => </document> => </document-info> => => => => => => => -- 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 |
In reply to this post by Tanya Gray (Oxford)
Hello
I'am a neebie by using XML. And a have the same Problem like you. Have you allready a xquery solution for listing additional elements sutch as last-name in the summy-view. Pleas post a code snipet of your query-file, THX Oliver Lienhard |
Administrator
|
itxlieni (sent by Nabble.com) wrote:
> Hello > > I'am a neebie by using XML. > And a have the same Problem like you. > > Have you allready a xquery solution for listing additional elements > sutch as last-name in the summy-view. > > Pleas post a code snipet of your query-file, Have a look at that file for a start: examples/bizdoc/data-access/exist/list-documents.xpl Then try to play with the XQuery query. There are introductions to XQuery out there, have a look at them. Here are a few that I found with Google: http://www.perfectxml.com/articles/xml/xquery.asp http://www.w3schools.com/xquery/default.asp http://www.devx.com/xml/article/8046 -Erik -- 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 |
Free forum by Nabble | Edit this page |