From lists at fgeorges.org Wed Mar 4 15:49:05 2009 From: lists at fgeorges.org (Florent Georges) Date: Wed Mar 4 07:49:18 2009 Subject: [xquery-talk] local:* functions in library modules Message-ID: <456272.43431.qm@web23003.mail.ird.yahoo.com> Hi, If I understand correctly the definition of module declaration , in particular the error err:XQST0048, we are not allowed to define a local:* function in a library module. Please tell me I am wrong! I can't find something telling the opposite in the REC, but I can't believe this is the intent. Regards, -- Florent Georges http://www.fgeorges.org/ From john.snelson at oracle.com Wed Mar 4 16:16:42 2009 From: john.snelson at oracle.com (John Snelson) Date: Wed Mar 4 08:17:09 2009 Subject: [xquery-talk] local:* functions in library modules In-Reply-To: <456272.43431.qm@web23003.mail.ird.yahoo.com> References: <456272.43431.qm@web23003.mail.ird.yahoo.com> Message-ID: <49AEA96A.5020009@oracle.com> Hi Florent, That's correct - functions in a module must be in the module's namespace. The good news is that XQuery 1.1 will have private functions - that aren't exported from modules. John Florent Georges wrote: > Hi, > > If I understand correctly the definition of module declaration > , in particular > the error err:XQST0048, we are not allowed to define a local:* > function in a library module. > > Please tell me I am wrong! I can't find something telling the > opposite in the REC, but I can't believe this is the intent. > > Regards, > -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From lists at fgeorges.org Wed Mar 4 16:50:24 2009 From: lists at fgeorges.org (Florent Georges) Date: Wed Mar 4 08:50:37 2009 Subject: [xquery-talk] local:* functions in library modules In-Reply-To: <49AEA96A.5020009@oracle.com> Message-ID: <361608.55314.qm@web23006.mail.ird.yahoo.com> John Snelson wrote: > That's correct - functions in a module must be in the > module's namespace. The good news is that XQuery 1.1 > will have private functions - that aren't exported from > modules. Thanks, John. But I am a bit surprised, I always thought that was the purpose of local:* functions. How does XQuery 1.1 define those module-private functions? Regards, -- Florent Georges http://www.fgeorges.org/ From john.snelson at oracle.com Wed Mar 4 17:21:27 2009 From: john.snelson at oracle.com (John Snelson) Date: Wed Mar 4 09:21:50 2009 Subject: [xquery-talk] local:* functions in library modules In-Reply-To: <361608.55314.qm@web23006.mail.ird.yahoo.com> References: <361608.55314.qm@web23006.mail.ird.yahoo.com> Message-ID: <49AEB897.6010703@oracle.com> Florent Georges wrote: > John Snelson wrote: > >> That's correct - functions in a module must be in the >> module's namespace. The good news is that XQuery 1.1 >> will have private functions - that aren't exported from >> modules. > > Thanks, John. But I am a bit surprised, I always thought that was the purpose of local:* functions. How does XQuery 1.1 define those module-private functions? I think it's going to be "declare private function". The "local" namespace was only ever a convenient namespace to put functions in if you didn't care what the namespace was. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From lists at fgeorges.org Wed Mar 4 17:25:18 2009 From: lists at fgeorges.org (Florent Georges) Date: Wed Mar 4 09:25:31 2009 Subject: [xquery-talk] local:* functions in library modules In-Reply-To: <49AEB897.6010703@oracle.com> Message-ID: <161813.49385.qm@web23005.mail.ird.yahoo.com> John Snelson wrote: > I think it's going to be "declare private > function". The "local" namespace was only > ever a convenient namespace to put functions in if you > didn't care what the namespace was. At least I learned some fundamental stuff today... :-$ Thanks for the explanation! Regards, -- Florent Georges http://www.fgeorges.org/ From gkholman at CraneSoftwrights.com Fri Mar 6 17:42:36 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Fri Mar 6 14:46:21 2009 Subject: [xquery-talk] [Announce] Hands-on XSLT, XQuery and XPath training - June - California (XQuery Talk) Message-ID: <7.0.1.0.2.20090306174146.027b7de8@CraneSoftwrights.com> June 1 - 10, 2009 - Los Angeles/Anaheim, California Five days of XSLT 2.0/1.0, XQuery 1.0 and XPath 2.0/1.0, covering every element, every attribute, every keyword and every function. Taught in parallel, students can do the same exercises in either XQuery, XSLT or both. Three days of XSL-FO 1.1/1.0, covering every formatting object. Links to syllabi, instructor information, venue information and registration: http://www.CraneSoftwrights.com/q/ If these do not suit you, we offer on-site private deliveries. . . . . . . . . . . . . Ken cc: XML-Dev, XQuery-Talk, XSL List, Yahoo XSL-FO, Antenna House list, RenderX list, XML-Doc, XML-L -- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/m/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/m/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From michalmas at gmail.com Sun Mar 8 13:43:50 2009 From: michalmas at gmail.com (Michalmas) Date: Sun Mar 8 04:43:56 2009 Subject: [xquery-talk] last possible child's attribute Message-ID: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> Hello guys, What i need to get in xquery is the last possible child's attribute. Let's say i have following XML: and i want to get the last child of 'a' node. So, in this case, it would be node 'ccc'. Then, i want to get lc attribute - in this example, 123. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/999d5f51/attachment.htm From andrew.j.welch at gmail.com Sun Mar 8 12:51:19 2009 From: andrew.j.welch at gmail.com (Andrew Welch) Date: Sun Mar 8 04:51:23 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> Message-ID: <74a894af0903080551p1301dd3coff045e968cb34bec@mail.gmail.com> > What i need to get in xquery is the last possible child's attribute. > > Let's say i have following XML: > > > ? > ???? > ???? > ? > ? > ? > ? > ???? > ???? > ? > > > and i want to get the last child of 'a' node. So, in this case, it would be > node 'ccc'. Then, i want to get lc attribute - in this example, 123. /descendant::*[last()]/@lc -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ From michalmas at gmail.com Sun Mar 8 14:06:23 2009 From: michalmas at gmail.com (Michalmas) Date: Sun Mar 8 05:06:27 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <74a894af0903080551p1301dd3coff045e968cb34bec@mail.gmail.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <74a894af0903080551p1301dd3coff045e968cb34bec@mail.gmail.com> Message-ID: <701515240903080606v5f5df388o89287b75a6ca84a3@mail.gmail.com> didn't work, returns no results. quite strange it is that even /descendant::* doesn't display anything. Also, i forgot to add that not every node must have lc attribute. Thanks! On Sun, Mar 8, 2009 at 1:51 PM, Andrew Welch wrote: > > What i need to get in xquery is the last possible child's attribute. > > > > Let's say i have following XML: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > and i want to get the last child of 'a' node. So, in this case, it would > be > > node 'ccc'. Then, i want to get lc attribute - in this example, 123. > > > /descendant::*[last()]/@lc > > > -- > Andrew Welch > http://andrewjwelch.com > Kernow: http://kernowforsaxon.sf.net/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/faf175e1/attachment.htm From christian.gruen at gmail.com Sun Mar 8 14:16:58 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Sun Mar 8 05:17:03 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <701515240903080606v5f5df388o89287b75a6ca84a3@mail.gmail.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <74a894af0903080551p1301dd3coff045e968cb34bec@mail.gmail.com> <701515240903080606v5f5df388o89287b75a6ca84a3@mail.gmail.com> Message-ID: > Also, i forgot to add that not every node must have lc attribute. Try this: /descendant::*[@lc][last()]/@lc Christian http://basex.org From michalmas at gmail.com Sun Mar 8 14:23:50 2009 From: michalmas at gmail.com (Michalmas) Date: Sun Mar 8 05:23:54 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <74a894af0903080551p1301dd3coff045e968cb34bec@mail.gmail.com> <701515240903080606v5f5df388o89287b75a6ca84a3@mail.gmail.com> Message-ID: <701515240903080623m5d2e4d2ejb6c2bf150ec3cf66@mail.gmail.com> Hi Christian, Yes, it did the trick. However, i can do only /descendant::*[@start][last()]. If i try to get value of @lc, then i get error: "A document node may not have an attrribute node" (i use Xml Spy 2009) Any ideas how to get that value? On Sun, Mar 8, 2009 at 2:16 PM, Christian Gr?n wrote: > > Also, i forgot to add that not every node must have lc attribute. > > Try this: /descendant::*[@lc][last()]/@lc > > Christian > http://basex.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/d781ec38/attachment.htm From gkholman at CraneSoftwrights.com Sun Mar 8 09:32:11 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 8 05:34:03 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> Message-ID: <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> At 2009-03-08 13:43 +0100, Michalmas wrote: >What i need to get in xquery is the last possible child's attribute. It looks to me like you need the last possible descendant's attribute, not child. >Let's say i have following XML: > > > > > > > > > > > > > > >and i want to get the last child of 'a' node. So, in this case, it >would be node 'ccc'. Then, i want to get lc attribute - in this example, 123. Two ways you could express it, based on how easy you think each will be maintained by someone reading your code: To be explicit, you want the attribute of the last descendant of the element: a/descendant::*[last()]/@lc To be concise, you want the last attribute descending from the element: (a//@lc)[last()] The code below shows both of those working ... and I doubt there would be any difference in execution time ... choose whichever one "reads" better from a maintenance perspective. I believe maintenance of transforms is as important as performance ... let the processor worry about the optimization of the performance. BTW, I'm assuming you know the attribute's name. There is no such concept as "last specified attribute" for a given element, because attributes along the attribute axis are in an arbitrary order, they are not in specified order. I find many students assume that just because they specified attributes in a particular order they are going to find them in that order when they walk the attribute axis. XML says that attributes are unordered. In the data model, they have an order, you just don't know what that order is. So you can reliably walk over an attribute axis multiple times in one transformation and get the attributes in the same order each time during that transformation, but they won't necessarily be in that order the next time or with another processor. I hope this helps. . . . . . . . . . . Ken t:\ftemp>type michalmas.xml t:\ftemp>type michalmas.xq string( a/descendant::*[last()]/@lc ), string( (a//@lc)[last()] ) t:\ftemp>xquery michalmas.xml michalmas.xq 123 123 t:\ftemp> -- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From michalmas at gmail.com Sun Mar 8 14:45:34 2009 From: michalmas at gmail.com (Michalmas) Date: Sun Mar 8 05:45:39 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> Message-ID: <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> Hi, It still gives me the same error: XQuery Serialization Error! > A document node may not have an attribute node or a namespace node as a > child > @Ken: Yes, i meant last possible node that has a value for given attribute. On Sun, Mar 8, 2009 at 2:32 PM, G. Ken Holman wrote: > At 2009-03-08 13:43 +0100, Michalmas wrote: > >> What i need to get in xquery is the last possible child's attribute. >> > > It looks to me like you need the last possible descendant's attribute, not > child. > > Let's say i have following XML: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> and i want to get the last child of 'a' node. So, in this case, it would >> be node 'ccc'. Then, i want to get lc attribute - in this example, 123. >> > > Two ways you could express it, based on how easy you think each will be > maintained by someone reading your code: > > To be explicit, you want the attribute of the last descendant of the > element: > > a/descendant::*[last()]/@lc > > To be concise, you want the last attribute descending from the element: > > (a//@lc)[last()] > > The code below shows both of those working ... and I doubt there would be > any difference in execution time ... choose whichever one "reads" better > from a maintenance perspective. > > I believe maintenance of transforms is as important as performance ... let > the processor worry about the optimization of the performance. > > BTW, I'm assuming you know the attribute's name. There is no such concept > as "last specified attribute" for a given element, because attributes along > the attribute axis are in an arbitrary order, they are not in specified > order. I find many students assume that just because they specified > attributes in a particular order they are going to find them in that order > when they walk the attribute axis. XML says that attributes are unordered. > In the data model, they have an order, you just don't know what that order > is. So you can reliably walk over an attribute axis multiple times in one > transformation and get the attributes in the same order each time during > that transformation, but they won't necessarily be in that order the next > time or with another processor. > > I hope this helps. > > . . . . . . . . . . Ken > > t:\ftemp>type michalmas.xml > > > > > > > > > > > > > > t:\ftemp>type michalmas.xq > string( a/descendant::*[last()]/@lc ), > string( (a//@lc)[last()] ) > t:\ftemp>xquery michalmas.xml michalmas.xq > 123 123 > t:\ftemp> > > -- > XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz > XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 > Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > G. Ken Holman mailto:gkholman@CraneSoftwrights.com > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc > Legal business disclaimers: http://www.CraneSoftwrights.com/legal > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/186b77e9/attachment-0001.htm From christian.gruen at gmail.com Sun Mar 8 14:53:18 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Sun Mar 8 05:53:22 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> Message-ID: Hi Michalmas, this one might help: string(/descendant::@lc[last()]) Christian On Sun, Mar 8, 2009 at 2:45 PM, Michalmas wrote: > Hi, > > It still gives me the same error: > >> XQuery Serialization Error! >> A document node may not have an attribute node or a namespace node as a >> child > > @Ken: > Yes, i meant last possible node that has a value for given attribute. > > On Sun, Mar 8, 2009 at 2:32 PM, G. Ken Holman > wrote: >> >> At 2009-03-08 13:43 +0100, Michalmas wrote: >>> >>> What i need to get in xquery is the last possible child's attribute. >> >> It looks to me like you need the last possible descendant's attribute, not >> child. >> >>> Let's say i have following XML: >>> >>> >>> ? >>> ? ? >>> ? ? >>> ? >>> ? >>> ? >>> ? >>> ? ? >>> ? ? >>> ? >>> >>> >>> and i want to get the last child of 'a' node. So, in this case, it would >>> be node 'ccc'. Then, i want to get lc attribute - in this example, 123. >> >> Two ways you could express it, based on how easy you think each will be >> maintained by someone reading your code: >> >> To be explicit, you want the attribute of the last descendant of the >> element: >> >> ?a/descendant::*[last()]/@lc >> >> To be concise, you want the last attribute descending from the element: >> >> ?(a//@lc)[last()] >> >> The code below shows both of those working ... and I doubt there would be >> any difference in execution time ... choose whichever one "reads" better >> from a maintenance perspective. >> >> I believe maintenance of transforms is as important as performance ... let >> the processor worry about the optimization of the performance. >> >> BTW, I'm assuming you know the attribute's name. ?There is no such concept >> as "last specified attribute" for a given element, because attributes along >> the attribute axis are in an arbitrary order, they are not in specified >> order. ?I find many students assume that just because they specified >> attributes in a particular order they are going to find them in that order >> when they walk the attribute axis. ?XML says that attributes are unordered. >> ?In the data model, they have an order, you just don't know what that order >> is. ?So you can reliably walk over an attribute axis multiple times in one >> transformation and get the attributes in the same order each time during >> that transformation, but they won't necessarily be in that order the next >> time or with another processor. >> >> I hope this helps. >> >> . . . . . . . . . . Ken >> >> t:\ftemp>type michalmas.xml >> >> ? >> ? ? >> ? ? >> ? >> ? >> ? >> ? >> ? ? >> ? ? >> ? >> >> >> t:\ftemp>type michalmas.xq >> string( a/descendant::*[last()]/@lc ), >> string( (a//@lc)[last()] ) >> t:\ftemp>xquery michalmas.xml michalmas.xq >> 123 123 >> t:\ftemp> >> >> -- >> XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz >> XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 >> Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video >> Video lesson: ? ?http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 >> Video overview: ?http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 >> G. Ken Holman ? ? ? ? ? ? ? ? mailto:gkholman@CraneSoftwrights.com >> Crane Softwrights Ltd. ? ? ? ? ?http://www.CraneSoftwrights.com/q/ >> Male Cancer Awareness Nov'07 ?http://www.CraneSoftwrights.com/q/bc >> Legal business disclaimers: ?http://www.CraneSoftwrights.com/legal >> >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk > > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -- ___________________________ Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen From christian.gruen at gmail.com Sun Mar 8 14:56:56 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Sun Mar 8 05:56:59 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> Message-ID: sorry - of course I meant: string( /descendant::*[@lc][last()]/@lc)) From gkholman at CraneSoftwrights.com Sun Mar 8 09:57:50 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 8 05:57:58 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com > References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> Message-ID: <7.0.1.0.2.20090308095540.02501258@wheresmymailserver.com> At 2009-03-08 14:45 +0100, Michalmas wrote: >It still gives me the same error: > >XQuery Serialization Error! >A document node may not have an attribute node or a namespace node as a child Yes, because attribute nodes can only be attached to an element. You are putting out a document and you are trying to add just the attribute. I posted code that was working, and you'll see that I used the string() function in order to add a string to the document node, not the attribute itself. >On Sun, Mar 8, 2009 at 2:32 PM, G. Ken Holman ><gkholman@cranesoftwrights.com> wrote: >t:\ftemp>type michalmas.xml > > > > > > > > > > > > > > >t:\ftemp>type michalmas.xq >string( a/descendant::*[last()]/@lc ), >string( (a//@lc)[last()] ) >t:\ftemp>xquery michalmas.xml michalmas.xq >123 123 >t:\ftemp> Notice above how I'm adding the values of the attributes, not the attributes themselves to the result. I hope this helps. . . . . . . . Ken -- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From jens.teubner at inf.ethz.ch Sun Mar 8 14:58:21 2009 From: jens.teubner at inf.ethz.ch (Jens Teubner) Date: Sun Mar 8 05:58:26 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> Message-ID: <20090308135820.GA6864@ikdesk25.inf.ethz.ch> Most XQuery processors won't serialize attributes as top-level items in a query result (how should a standalone attribute be serialized?). Try to wrap your expression into an element constructor: element result { } Jens On Sun, Mar 08, 2009 at 02:45:34PM +0100, Michalmas wrote: > Hi, > > It still gives me the same error: > > XQuery Serialization Error! > > A document node may not have an attribute node or a namespace node as a > > child > > > > @Ken: > Yes, i meant last possible node that has a value for given attribute. > > On Sun, Mar 8, 2009 at 2:32 PM, G. Ken Holman > wrote: > > > At 2009-03-08 13:43 +0100, Michalmas wrote: > > > >> What i need to get in xquery is the last possible child's attribute. > >> > > > > It looks to me like you need the last possible descendant's attribute, not > > child. > > > > Let's say i have following XML: > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> and i want to get the last child of 'a' node. So, in this case, it would > >> be node 'ccc'. Then, i want to get lc attribute - in this example, 123. > >> > > > > Two ways you could express it, based on how easy you think each will be > > maintained by someone reading your code: > > > > To be explicit, you want the attribute of the last descendant of the > > element: > > > > a/descendant::*[last()]/@lc > > > > To be concise, you want the last attribute descending from the element: > > > > (a//@lc)[last()] > > > > The code below shows both of those working ... and I doubt there would be > > any difference in execution time ... choose whichever one "reads" better > > from a maintenance perspective. > > > > I believe maintenance of transforms is as important as performance ... let > > the processor worry about the optimization of the performance. > > > > BTW, I'm assuming you know the attribute's name. There is no such concept > > as "last specified attribute" for a given element, because attributes along > > the attribute axis are in an arbitrary order, they are not in specified > > order. I find many students assume that just because they specified > > attributes in a particular order they are going to find them in that order > > when they walk the attribute axis. XML says that attributes are unordered. > > In the data model, they have an order, you just don't know what that order > > is. So you can reliably walk over an attribute axis multiple times in one > > transformation and get the attributes in the same order each time during > > that transformation, but they won't necessarily be in that order the next > > time or with another processor. > > > > I hope this helps. > > > > . . . . . . . . . . Ken > > > > t:\ftemp>type michalmas.xml > > > > > > > > > > > > > > > > > > > > > > > > > > > > t:\ftemp>type michalmas.xq > > string( a/descendant::*[last()]/@lc ), > > string( (a//@lc)[last()] ) > > t:\ftemp>xquery michalmas.xml michalmas.xq > > 123 123 > > t:\ftemp> > > > > -- > > XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz > > XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 > > Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video > > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > > G. Ken Holman mailto:gkholman@CraneSoftwrights.com > > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ > > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc > > Legal business disclaimers: http://www.CraneSoftwrights.com/legal > > > > _______________________________________________ > > talk@x-query.com > > http://x-query.com/mailman/listinfo/talk > > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk -- Jens Teubner ETH Zurich, Systems Group Haldeneggsteig 4 / IFW B 48.3 8092 Zurich, Switzerland Software is like sex: It's better when it's free -- Linus B. Torvalds From michalmas at gmail.com Sun Mar 8 15:02:03 2009 From: michalmas at gmail.com (Michalmas) Date: Sun Mar 8 06:02:07 2009 Subject: [xquery-talk] last possible child's attribute In-Reply-To: <7.0.1.0.2.20090308095540.02501258@wheresmymailserver.com> References: <701515240903080543l351655oebd2f23545bb5517@mail.gmail.com> <7.0.1.0.2.20090308092501.025b5a58@wheresmymailserver.com> <701515240903080645s11de8ffw86cc8efeb5d85e47@mail.gmail.com> <7.0.1.0.2.20090308095540.02501258@wheresmymailserver.com> Message-ID: <701515240903080702r72bfc0fdj121cd0eb27b5fbb6@mail.gmail.com> @Christian, Ken Yes, the solution works perfect @Jens Also, works good. My confusion was that the attribute can't be find not that it can't be displayed. Thank you! On Sun, Mar 8, 2009 at 2:57 PM, G. Ken Holman wrote: > At 2009-03-08 14:45 +0100, Michalmas wrote: > >> It still gives me the same error: >> >> XQuery Serialization Error! >> A document node may not have an attribute node or a namespace node as a >> child >> > > Yes, because attribute nodes can only be attached to an element. > > You are putting out a document and you are trying to add just the > attribute. > > I posted code that was working, and you'll see that I used the string() > function in order to add a string to the document node, not the attribute > itself. > > On Sun, Mar 8, 2009 at 2:32 PM, G. Ken Holman <> gkholman@cranesoftwrights.com>gkholman@cranesoftwrights.com> wrote: >> t:\ftemp>type michalmas.xml >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> t:\ftemp>type michalmas.xq >> string( a/descendant::*[last()]/@lc ), >> string( (a//@lc)[last()] ) >> t:\ftemp>xquery michalmas.xml michalmas.xq >> 123 123 >> t:\ftemp> >> > > Notice above how I'm adding the values of the attributes, not the > attributes themselves to the result. > > I hope this helps. > > . . . . . . . Ken > > -- > XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz > XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 > Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > G. Ken Holman mailto:gkholman@CraneSoftwrights.com > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc > Legal business disclaimers: http://www.CraneSoftwrights.com/legal > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/fed9d17d/attachment.htm From michalmas at gmail.com Sun Mar 8 21:29:12 2009 From: michalmas at gmail.com (Michalmas) Date: Sun Mar 8 12:29:17 2009 Subject: [xquery-talk] xquery: iteration simulation Message-ID: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> Hello guys, Can you help me with the following problem: I have some XML. Now, i need to query it. But what i need to do, is to make queries of the form: count(mainNode//someStr) count(mainNode//someStr/someStr) (...) count(mainNode//someStr/someStr/someStr/someStr/someStr/someStr/someStr/someStr) The deep level of the last query may be even around 50 (so, 50 queries). Such set of queries will be repeated for about 100 keywords (like someStr). In total, that gives about 500 queries to create. Is is posible to write iteration in XQuery for that. Or pass it as a function? Thanks, M. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/394942fd/attachment.htm From gkholman at CraneSoftwrights.com Sun Mar 8 17:16:21 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 8 13:17:06 2009 Subject: [xquery-talk] xquery: iteration simulation In-Reply-To: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.co m> References: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> Message-ID: <7.0.1.0.2.20090308171108.02664928@wheresmymailserver.com> At 2009-03-08 21:29 +0100, Michalmas wrote: >Hello guys, > >Can you help me with the following problem: > >I have some XML. It would help volunteers if you could post a contrived example of the nature of the structures. Not all 50 levels, but still, some examples. >Now, i need to query it. But what i need to do, is to make queries >of the form: > >count(mainNode//someStr) >count(mainNode//someStr/someStr) >(...) >count(mainNode//someStr/someStr/someStr/someStr/someStr/someStr/someStr/someStr) How are you expressing the "someStr" name? Is it fixed? Is it variable? You will probably not use "//" as you have above, but it may have a role in the solution. >The deep level of the last query may be even around 50 (so, 50 queries). So you want one of every depth? Is it always the same element name that is parent/child? >Such set of queries will be repeated for about 100 keywords (like >someStr). In total, that gives about 500 queries to create. Ummmmm ... I make that 5000 queries. Or 100 queries that each give 50 results. >Is is posible to write iteration in XQuery for that. Or pass it as a function? Probably with two passes where the first pass creates the query for the second pass to execute. But it would help to have some representative data and an example result for that data. . . . . . . . . . Ken -- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From gkholman at CraneSoftwrights.com Sun Mar 8 17:57:10 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 8 13:57:31 2009 Subject: [xquery-talk] xquery: iteration simulation In-Reply-To: <7.0.1.0.2.20090308171108.02664928@wheresmymailserver.com> References: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> <7.0.1.0.2.20090308171108.02664928@wheresmymailserver.com> Message-ID: <7.0.1.0.2.20090308174642.0263e058@wheresmymailserver.com> At 2009-03-08 17:16 -0400, I wrote: >It would help volunteers if you could post a contrived example of >the nature of the structures. Not all 50 levels, but still, some examples. >... >>Now, i need to query it. But what i need to do, is to make queries >>of the form: >> >>count(mainNode//someStr) >>count(mainNode//someStr/someStr) >>(...) >>count(mainNode//someStr/someStr/someStr/someStr/someStr/someStr/someStr/someStr) Below is a query that gives those results taken from a very different angle. It won't be fast because of the ancestor counting at every level, and the use of distinct-values() requires me to work with strings. It might improve with a recursive call that tracks depth and passes it ... but you didn't say that performance would be an issue. >How are you expressing the "someStr" name? Is it fixed? Is it variable? I made an assumption that there is an XML file listing the keywords. >>The deep level of the last query may be even around 50 (so, 50 queries). The solution below works at all depths, but I didn't know what criteria you had for counting the ancestors ... I assumed you are only counting ancestors of the same name. And I'm ignoring changes in namespace prefixes, relying on the full name for distinction. >>Is is posible to write iteration in XQuery for that. Or pass it as >>a function? The example below is only one query, not a chain as I first thought. I hope this helps you create the kind of result that you need. . . . . . . . . Ken t:\ftemp>type michal-data.xml t:\ftemp>type michal-keywords.xml someStr anotherStr t:\ftemp>call xquery michal-data.xml michal.xq Element named "anotherStr" at depth 1 occurred 1 times. Element named "anotherStr" at depth 2 occurred 2 times. Element named "anotherStr" at depth 3 occurred 3 times. Element named "anotherStr" at depth 4 occurred 1 times. Element named "someStr" at depth 1 occurred 2 times. Element named "someStr" at depth 2 occurred 2 times. Element named "someStr" at depth 3 occurred 2 times. Element named "someStr" at depth 4 occurred 1 times. t:\ftemp>type michal.xq declare namespace saxon = "http://saxon.sf.net/"; declare option saxon:output "method=text"; let $depths as element(depth)+ := for $each in //* return { count($each/ancestor-or-self::*[name(.)=name($each)]), name($each) } return string-join( for $each in distinct-values( $depths ), $name in doc('michal-keywords.xml')/*/keyword where $name = substring-after($each,' ') order by substring-after($each,' '), xs:integer( substring-before($each,' ') ) return ( concat( 'Element named "',substring-after($each,' '), '" at depth ',substring-before($each,' '), ' occurred ',string(count($depths[.=$each])), ' times.') ), ' ' ) t:\ftemp>rem Done! -- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From gkholman at CraneSoftwrights.com Sun Mar 8 18:15:28 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 8 14:15:52 2009 Subject: [xquery-talk] xquery: iteration simulation In-Reply-To: <7.0.1.0.2.20090308174642.0263e058@wheresmymailserver.com> References: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> <7.0.1.0.2.20090308171108.02664928@wheresmymailserver.com> <7.0.1.0.2.20090308174642.0263e058@wheresmymailserver.com> Message-ID: <7.0.1.0.2.20090308180919.025b3ea0@wheresmymailserver.com> At 2009-03-08 17:57 -0400, I wrote: >Below is a query that gives those results taken from a very >different angle. It won't be fast because of the ancestor counting >at every level, and the use of distinct-values() requires me to work >with strings. It might improve with a recursive call that tracks >depth and passes it ... but you didn't say that performance would be an issue. After filing this I realized I was counting everything and filtering the results, rather than only counting what needed to be counted. So the code below should execute faster than the earlier post. I hope this helps. . . . . . . . . . . Ken t:\ftemp>type michal-data.xml t:\ftemp>type michal-keywords.xml someStr anotherStr t:\ftemp>call xquery michal-data.xml michal.xq Element named "anotherStr" at depth 1 occurred 1 times. Element named "anotherStr" at depth 2 occurred 2 times. Element named "anotherStr" at depth 3 occurred 3 times. Element named "anotherStr" at depth 4 occurred 1 times. Element named "someStr" at depth 1 occurred 2 times. Element named "someStr" at depth 2 occurred 2 times. Element named "someStr" at depth 3 occurred 2 times. Element named "someStr" at depth 4 occurred 1 times. t:\ftemp>type michal.xq declare namespace saxon = "http://saxon.sf.net/"; declare option saxon:output "method=text"; let $names as xs:string+ := doc('michal-keywords.xml')/*/keyword/string(.) let $depths as element(depth)+ := for $each in //* where name($each) = $names return { count($each/ancestor-or-self::*[name(.)=name($each)]), name($each) } return string-join( for $each in distinct-values( $depths ) order by substring-after($each,' '), xs:integer( substring-before($each,' ') ) return ( concat( 'Element named "',substring-after($each,' '), '" at depth ',substring-before($each,' '), ' occurred ',string(count($depths[.=$each])), ' times.') ), ' ' ) t:\ftemp>rem Done! -- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From mike at saxonica.com Sun Mar 8 23:29:15 2009 From: mike at saxonica.com (Michael Kay) Date: Sun Mar 8 15:29:27 2009 Subject: [xquery-talk] xquery: iteration simulation In-Reply-To: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> References: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> Message-ID: Is "someStr" the same element name throughout? If so, it looks like this: declare function local:depth($e as element(*)) as xs:integer { count($e/ancestor::*[node-name(.)=node-name($e)] }; declare function local:histogram($root as element(mainNode), $name as xs:QName) as element(count)* for $d in distinct-values(mainNode//*[node-name()=$s]/local:depth(.)) return I will be out of the office starting 03/09/2009 and will not return until 03/16/2009. Hi, I will be on vacation from 3/9 till 3/13. Back to work on 3/16. During this time Angela is my delegate. Her contact information is: Angela D Munafo/AMER/TRS/AEXP; angela.d.munafo@aexp.com; 817-563-5849. American Express made the following annotations on Mon Mar 09 2009 15:01:06 ------------------------------------------------------------------------------ "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." American Express a ajouté le commentaire suivant le Mon Mar 09 2009 15:01:06 Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur, veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces jointes. Merci. ****************************************************************************** ------------------------------------------------------------------------------- From michalmas at gmail.com Tue Mar 10 08:46:18 2009 From: michalmas at gmail.com (Michalmas) Date: Mon Mar 9 23:46:56 2009 Subject: [xquery-talk] XQuery - good and fast tool Message-ID: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> Hello guys, I am looking for good XQuery tool. But there are some requirements: XML file may exceed the size of 5-8 GB. The tools i am using now, like Saxon or Altova XML Spy, can't really handle such file. I have hound database engine MonetDB, for fast xqueries on big data sets. But it seems to be still in developing phase (and a lot of things are missing, like connectors). Do you have any suggestions? Thanks, Michal -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090310/28e2cc88/attachment.htm From olivier at xmlmind.com Tue Mar 10 09:03:07 2009 From: olivier at xmlmind.com (Olivier Ishacian) Date: Tue Mar 10 00:03:51 2009 Subject: [xquery-talk] [ANN] Qizx 3.0-beta released Message-ID: <49B61EBB.9050802@xmlmind.com> Qizx 3.0-beta released Qizx Free Engine can be downloaded from http://www.xmlmind.com/qizx/download.shtml Qizx/open can be downloaded from http://www.xmlmind.com/qizx/qizxopen.shtml Qizx customers, please upgrade using this form: http://www.xmlmind.com/store/download.php (The above form is usually accessed through http://www.xmlmind.com/qizx/upgrade.html.) --------------------------------------------- Qizx is an embeddable, high-speed, native XML indexing and query engine written in Java(TM), with the querying and processing capabilities of a fully fledged XML Query implementation. Main new features in version 3.0 beta: * Nearly complete support of XQuery Full-Text, a new W3C Recommendation for integrated full-text search in XQuery. * Miscellaneous optimizations of query execution. Please visit http://www.xmlmind.com/qizx/changes.html for more information. Because of deep changes in the implementation, this version is considered of beta quality. The former version 2.2 will stay available. We encourage our users to give us feed-back about Qizx 3.0. Qizx is available in several editions: * The commercial product has 3 liberal licenses both for corporate application development, and for royalty-free distributable products. * The Free Engine edition is a fully functional version of Qizx which can be used for developing or in production. It is limited in database size (one gigabyte of XML approximately). * Qizx/open is an open-source version of the XML Query interpreter of Qizx. Qizx/open has been available since 2003 and is recognized as one of the most advanced and fastest XML Query implementations. Please visit http://www.xmlmind.com/qizx/ for more information about Qizx. -- Qizx Information List qizx-announce@xmlmind.com http://www.xmlmind.com/mailman/listinfo/qizx-announce From gandhi.mukul at gmail.com Tue Mar 10 13:43:04 2009 From: gandhi.mukul at gmail.com (Mukul Gandhi) Date: Tue Mar 10 00:13:40 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> Message-ID: <7870f82e0903100113u1a0d448an79ffeea503b25e17@mail.gmail.com> On Tue, Mar 10, 2009 at 1:16 PM, Michalmas wrote: > But there are some requirements: XML file > may exceed the size of 5-8 GB. just curious, what kind of application needs such huge XML files? I would prefer storing data in a relational/XML hybrid database. -- Regards, Mukul Gandhi From michalmas at gmail.com Tue Mar 10 09:16:44 2009 From: michalmas at gmail.com (Michalmas) Date: Tue Mar 10 00:17:20 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <7870f82e0903100113u1a0d448an79ffeea503b25e17@mail.gmail.com> References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> <7870f82e0903100113u1a0d448an79ffeea503b25e17@mail.gmail.com> Message-ID: <701515240903100116h625bd5b6k7aa62a02d30ca9c1@mail.gmail.com> It is now just part of my research (can't tell more now). I need to find good world when: - i have a big data set - i want to use xquery in simple way One extreme is to have many small XML files, but then some queries that need to access all of them would be quite complex. On the other side there is one big XML. Now i analyze both solutions. Thanks, M. On Tue, Mar 10, 2009 at 9:13 AM, Mukul Gandhi wrote: > On Tue, Mar 10, 2009 at 1:16 PM, Michalmas wrote: > > But there are some requirements: XML file > > may exceed the size of 5-8 GB. > > just curious, what kind of application needs such huge XML files? I > would prefer storing data in a relational/XML hybrid database. > > > -- > Regards, > Mukul Gandhi > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090310/864aee6d/attachment.htm From Geert.Josten at daidalos.nl Tue Mar 10 09:49:20 2009 From: Geert.Josten at daidalos.nl (Geert Josten) Date: Tue Mar 10 00:50:03 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <701515240903100116h625bd5b6k7aa62a02d30ca9c1@mail.gmail.com> Message-ID: <0260356C6DFE754BA6FA48E659A1433823F2C802D7@Helios.olympus.borgus.nl> Hi Michal, I know of two commercial products: - X-Hive/DB - MarkLogic Server I am not sure if the first can handle such large amounts of data, but the latter definitely can. Handling many documents with one query is not difficult either. Using doc() or collection() will give quick access to large numbers of documents. MarkLogic Server can utilize indexes to make it perform even with such large amounts of data. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Michalmas > Sent: dinsdag 10 maart 2009 9:17 > To: Mukul Gandhi > Cc: talk@x-query.com > Subject: Re: [xquery-talk] XQuery - good and fast tool > > It is now just part of my research (can't tell more now). > > I need to find good world when: > - i have a big data set > - i want to use xquery in simple way > > One extreme is to have many small XML files, but then some > queries that need to access all of them would be quite > complex. On the other side there is one big XML. > Now i analyze both solutions. > > Thanks, > M. > > > On Tue, Mar 10, 2009 at 9:13 AM, Mukul Gandhi > wrote: > > > On Tue, Mar 10, 2009 at 1:16 PM, Michalmas > wrote: > > But there are some requirements: XML file > > may exceed the size of 5-8 GB. > > > just curious, what kind of application needs such huge > XML files? I > would prefer storing data in a relational/XML hybrid database. > > > -- > Regards, > Mukul Gandhi > > > > From mike at saxonica.com Tue Mar 10 09:13:08 2009 From: mike at saxonica.com (Michael Kay) Date: Tue Mar 10 01:13:54 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> Message-ID: There are two ways of handling XML that is too large to fit in memory: * with an XML database * with a streaming processor Which you use depends on the overall workload. For example, if you are filtering a data feed and discarding most of the incoming data, then a streaming processor is clearly the right approach. Saxon-SA will execute a subset of XQuery in streaming mode (meaning that you don't need to have the whole source document in memory.) Michael Kay http://www.saxonica.com/ _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Michalmas Sent: 10 March 2009 07:46 To: talk@x-query.com Subject: [xquery-talk] XQuery - good and fast tool Hello guys, I am looking for good XQuery tool. But there are some requirements: XML file may exceed the size of 5-8 GB. The tools i am using now, like Saxon or Altova XML Spy, can't really handle such file. I have hound database engine MonetDB, for fast xqueries on big data sets. But it seems to be still in developing phase (and a lot of things are missing, like connectors). Do you have any suggestions? Thanks, Michal -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090310/aa0a0f96/attachment.htm From michalmas at gmail.com Tue Mar 10 10:15:43 2009 From: michalmas at gmail.com (Michalmas) Date: Tue Mar 10 01:16:20 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> Message-ID: <701515240903100215q63cdf58dh96fcd50324d0fd5c@mail.gmail.com> Thanks guys, I will check the most promising solutions. I will inform you about results of my investigations. Best, Michal On Tue, Mar 10, 2009 at 10:13 AM, Michael Kay wrote: > There are two ways of handling XML that is too large to fit in memory: > > * with an XML database > > * with a streaming processor > > Which you use depends on the overall workload. For example, if you are > filtering a data feed and discarding most of the incoming data, then a > streaming processor is clearly the right approach. > > Saxon-SA will execute a subset of XQuery in streaming mode (meaning that > you don't need to have the whole source document in memory.) > > Michael Kay > http://www.saxonica.com/ > > ------------------------------ > *From:* talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] *On > Behalf Of *Michalmas > *Sent:* 10 March 2009 07:46 > *To:* talk@x-query.com > *Subject:* [xquery-talk] XQuery - good and fast tool > > Hello guys, > > I am looking for good XQuery tool. But there are some requirements: XML > file may exceed the size of 5-8 GB. > The tools i am using now, like Saxon or Altova XML Spy, can't really handle > such file. > > I have hound database engine MonetDB, for fast xqueries on big data sets. > But it seems to be still in developing phase (and a lot of things are > missing, like connectors). > > Do you have any suggestions? > > > Thanks, > Michal > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090310/be374881/attachment-0001.htm From Tony.Graham at MenteithConsulting.com Tue Mar 10 09:35:23 2009 From: Tony.Graham at MenteithConsulting.com (Tony Graham) Date: Tue Mar 10 01:35:53 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <0260356C6DFE754BA6FA48E659A1433823F2C802D7@Helios.olympus.borgus.nl> (Geert Josten's message of "Tue, 10 Mar 2009 09:49:20 +0100") References: <0260356C6DFE754BA6FA48E659A1433823F2C802D7@Helios.olympus.borgus.nl> Message-ID: <87d4cp90v8.fsf@MenteithConsulting.com> On Tue, Mar 10 2009 08:49:20 +0000, Geert.Josten@daidalos.nl wrote: > I know of two commercial products: > > - X-Hive/DB > - MarkLogic Server A free option is Berkeley DB XML [1], though so far I've only used it on up to 60,000 small documents so I can't say how it would do on your big documents. Regards, Tony Graham Tony.Graham@MenteithConsulting.com Director W3C XSL FO SG Invited Expert Menteith Consulting Ltd XML, XSL and XSLT consulting, programming and training Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland Registered in Ireland - No. 428599 http://www.menteithconsulting.com -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- xmlroff XSL Formatter http://xmlroff.org xslide Emacs mode http://www.menteith.com/wiki/xslide Unicode: A Primer urn:isbn:0-7645-4625-2 [1] http://www.oracle.com/technology/documentation/berkeley-db/xml/intro_xml/index.html From andrew.j.welch at gmail.com Tue Mar 10 10:00:12 2009 From: andrew.j.welch at gmail.com (Andrew Welch) Date: Tue Mar 10 02:00:51 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> Message-ID: <74a894af0903100300n50a49ebev27fc0a9fc11df87d@mail.gmail.com> 2009/3/10 Michael Kay : > There are two ways of handling XML that is too large to fit in memory: > > * with an XML database > > * with a streaming processor a potential 3rd is: * split it into multiple smaller files, then use collection() and saxon:discard-document (...but how you split it might be an issue :) only really applies if you have control over the generation of the file in the first place, and can generate many files instead of 1 big one) -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ From james.fuller.2007 at gmail.com Tue Mar 10 11:43:19 2009 From: james.fuller.2007 at gmail.com (James Fuller) Date: Tue Mar 10 02:43:54 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <701515240903100215q63cdf58dh96fcd50324d0fd5c@mail.gmail.com> References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> <701515240903100215q63cdf58dh96fcd50324d0fd5c@mail.gmail.com> Message-ID: Hello, I would be interested in stuffing this into eXist as a test ... I have a few optimizations I do with large XML files which means splitting into a few chunks but I would need to see the XML to see if it was doable. sounds like what u are working on is a confidential so email me offlist if interested ... but with XML Prague coming up my time is limited for the next week or so to respond fully. cheers, Jim Fuller On Tue, Mar 10, 2009 at 10:15 AM, Michalmas wrote: > Thanks guys, > > I will check the most promising solutions. > > I will inform you about results of my investigations. > > Best, > Michal > > On Tue, Mar 10, 2009 at 10:13 AM, Michael Kay wrote: >> >> There are two ways of handling XML that is too large to fit in memory: >> >> * with an XML database >> >> * with a streaming processor >> >> Which you use depends on the overall workload. For example, if you are >> filtering a data feed and discarding most of the incoming data, then a >> streaming processor is clearly the right approach. >> >> Saxon-SA will execute a subset of XQuery in streaming mode (meaning that >> you don't need to have the whole source document in memory.) >> >> Michael Kay >> http://www.saxonica.com/ >> >> ________________________________ >> From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf >> Of Michalmas >> Sent: 10 March 2009 07:46 >> To: talk@x-query.com >> Subject: [xquery-talk] XQuery - good and fast tool >> >> Hello guys, >> >> I am looking for good XQuery tool. But there are some requirements: XML >> file may exceed the size of 5-8 GB. >> The tools i am using now, like Saxon or Altova XML Spy, can't really >> handle such file. >> >> I have hound database engine MonetDB, for fast xqueries on big data sets. >> But it seems to be still in developing phase (and a lot of things are >> missing, like connectors). >> >> Do you have any suggestions? >> >> >> Thanks, >> Michal > > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From lgfausak at gmail.com Tue Mar 10 07:20:55 2009 From: lgfausak at gmail.com (Greg Fausak) Date: Tue Mar 10 04:21:30 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> <701515240903100215q63cdf58dh96fcd50324d0fd5c@mail.gmail.com> Message-ID: <8c7b802f0903100520t5c5b3429j9766ae2f73c27add@mail.gmail.com> I've had good luck with BDB XML. It performs better given many smaller files rather than one giant file. The performance problems I have had are from updates. If you aren't doing that BDB XML may just work for that big file. -g On Tue, Mar 10, 2009 at 5:43 AM, James Fuller wrote: > Hello, > > I would be interested in stuffing this into eXist as a test ... I have > a few optimizations I do with large XML files which means splitting > into a few chunks but I would need to see the XML to see if it was > doable. > > sounds like what u are working on is a confidential so email me > offlist if interested ... but with XML Prague coming up my time is > limited for the next week or so to respond fully. > > cheers, Jim Fuller > > On Tue, Mar 10, 2009 at 10:15 AM, Michalmas wrote: >> Thanks guys, >> >> I will check the most promising solutions. >> >> I will inform you about results of my investigations. >> >> Best, >> Michal >> >> On Tue, Mar 10, 2009 at 10:13 AM, Michael Kay wrote: >>> >>> There are two ways of handling XML that is too large to fit in memory: >>> >>> * with an XML database >>> >>> * with a streaming processor >>> >>> Which you use depends on the overall workload. For example, if you are >>> filtering a data feed and discarding most of the incoming data, then a >>> streaming processor is clearly the right approach. >>> >>> Saxon-SA will execute a subset of XQuery in streaming mode (meaning that >>> you don't need to have the whole source document in memory.) >>> >>> Michael Kay >>> http://www.saxonica.com/ >>> >>> ________________________________ >>> From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf >>> Of Michalmas >>> Sent: 10 March 2009 07:46 >>> To: talk@x-query.com >>> Subject: [xquery-talk] XQuery - good and fast tool >>> >>> Hello guys, >>> >>> I am looking for good XQuery tool. But there are some requirements: XML >>> file may exceed the size of 5-8 GB. >>> The tools i am using now, like Saxon or Altova XML Spy, can't really >>> handle such file. >>> >>> I have hound database engine MonetDB, for fast xqueries on big data sets. >>> But it seems to be still in developing phase (and a lot of things are >>> missing, like connectors). >>> >>> Do you have any suggestions? >>> >>> >>> Thanks, >>> Michal >> >> >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -- Greg Fausak greg@thursday.com From christian.gruen at gmail.com Tue Mar 10 13:25:22 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Tue Mar 10 04:25:58 2009 Subject: [xquery-talk] XQuery - good and fast tool In-Reply-To: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> References: <701515240903100046l17cef02cg18c277e01dcec8a5@mail.gmail.com> Message-ID: Michal, Feel free to give BaseX a try; many of our users have XML documents in the range of gigabytes (the largest database we built ourselves was 70 GB). Apart from that, I know that MonetDB & Sedna (open source) and X-Hive & Qizx/db (commercial) can handle doc. larger than 1 GB. Christian On Tue, Mar 10, 2009 at 8:46 AM, Michalmas wrote: > Hello guys, > > I am looking for good XQuery tool. But there are some requirements: XML file > may exceed the size of 5-8 GB. > The tools i am using now, like Saxon or Altova XML Spy, can't really handle > such file. > > I have hound database engine MonetDB, for fast xqueries on big data sets. > But it seems to be still in developing phase (and a lot of things are > missing, like connectors). > > Do you have any suggestions? > > > Thanks, > Michal > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > ___________________________ Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen From michalmas at gmail.com Tue Mar 10 22:40:29 2009 From: michalmas at gmail.com (Michalmas) Date: Tue Mar 10 13:40:34 2009 Subject: [xquery-talk] recurrency Message-ID: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> Hello guys, I was trying to achieve recurrency in my code. However, it seemed to be quite hard as there is no 'global' view of variable. So fat, i developed simple replcement for that. But i believe it can be done much simpler. The XML looks like: name1 name2 name3 The path to name3 can be given as name1/name2/name3, but slao as name1/name3. I wrote functions for going depper and deeper in the definition. Can it be simplified? declare function local:getNodeDefinitionOne($sys as item(), $node1 as item())as item()* { let $processed := replace(data($node1), ' \(.*\)' , '') let $res := testXML/$sys//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionTwo($sys as item(), $node1 as item(), $node2 as item())as item()* { let $processed := replace(data($node2), ' \(.*\)' , '') let $fir := local:getNodeDefinitionOne($sys, $node1) let $res := $fir//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionThree($sys as item(), $node1 as item(), $node2 as item(), $node3 as item())as item()* { let $processed := replace(data($node3), ' \(.*\)' , '') let $fir := local:getNodeDefinitionTwo($sys, $node1, $node2) let $res := $fir//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionFour($sys as item(), $node1 as item(), $node2 as item(), $node3 as item(), $node4 as item() )as item()* { let $processed := replace(data($node4), ' \(.*\)' , '') let $fir := local:getNodeDefinitionThree($sys, $node1, $node2, $node3) let $res := $fir//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionFive($sys as item(), $node1 as item(), $node2 as item(), $node3 as item(), $node4 as item(), $node5 as item() )as item()* { let $processed := replace(data($node5), ' \(.*\)' , '') let $fir := local:getNodeDefinitionFour($sys, $node1, $node2, $node3, $node4) let $res := $fir//node-name[data(name) = $processed] return $res }; -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090310/18ff2a6a/attachment.htm From davidc at nag.co.uk Tue Mar 10 22:07:36 2009 From: davidc at nag.co.uk (David Carlisle) Date: Tue Mar 10 14:07:58 2009 Subject: [xquery-talk] recurrency In-Reply-To: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> (message from Michalmas on Tue, 10 Mar 2009 22:40:29 +0100) References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> Message-ID: <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> > I wrote functions for going depper and deeper in the definition. Can it be > simplified? probably, but what output do you want from the posted input? looking at your code let $processed := replace(data($node1), ' \(.*\)' , '') this appears to be substring-after($node1,' ') but none of your text nodes (other than indentation white space have a space? let $res := testXML/$sys//node-name[data(name) = $processed] is the same as let $res := $sys//node-name[data(name) = $processed] as if you use a node sequence on the right hand side of / the left hand side argumemt of / isn't used at all, all that happens is that the nodes on the right hand side are sorted into document order and duplicates removed. testXML/$sys is $sys/. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ From michalmas at gmail.com Tue Mar 10 23:48:57 2009 From: michalmas at gmail.com (Michalmas) Date: Tue Mar 10 14:49:10 2009 Subject: [xquery-talk] recurrency In-Reply-To: <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> <701515240903101518q678f3b3bo5b54dc07a43a10b0@mail.gmail.com> <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> Message-ID: <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> Of course, i meant recursion. Sorry :-) The thing is that later in XML there can be referance to that fields: name1 name3 'sdsdsd' So, as you see, the full path doesn't need to go through all nodes. Also, there can be part to cut as string, but just ignore that now (i forgot to remove replace function from previous example). And for that i need to replace several calls with longer parameter list with one in recursive mode. My tries ended in failure as i couldn't store the current state (script nature of XQuery). Thanks, Michal On Tue, Mar 10, 2009 at 11:26 PM, David Carlisle wrote: > > > The replace is only to clean the data. In real examples, it can be > called > > like: name1/name2 'asdas'/name3 'saadsf'. > > > but you haven't said what output you want, > > > The mail thing is that recurrency. > > not sure what you mean by recurrency in this context, do you mean > recursion? Your posted code doesn't use recursive functions, probably it > should use a single recursive function rather than multiple functions > with longer and longer argument lists, but I can't guess what they are > intended to do, so I can't suggest a replacement without more information. > > Is the input your posted xml and a string of the form "name1/name2" ? > if so, what is the desired output. > > Please respond on list so others have a chance to answer. > > David > > ________________________________________________________________________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ________________________________________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090310/9b6dc964/attachment.htm From davidc at nag.co.uk Tue Mar 10 23:42:03 2009 From: davidc at nag.co.uk (David Carlisle) Date: Tue Mar 10 15:42:29 2009 Subject: [xquery-talk] recurrency In-Reply-To: <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> (message from Michalmas on Tue, 10 Mar 2009 23:48:57 +0100) References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> <701515240903101518q678f3b3bo5b54dc07a43a10b0@mail.gmail.com> <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> Message-ID: <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> > The thing is that later in XML there can be referance to that fields: > sorry I really can not guess what you mean here, and I doubt anyone else on the list will be able to guess. Can you not post, to the list, a complete (but small) example of the input and say what result the query is supposed to produce, then probably someone would supply some xquery code. given your testXML node input in your original mail and the node in the last mail, what is supposed to be returned? perhaps ypu want the element name3 or perhaps the element name3 or perhaps you want something else entirely. I can't guess what you intend. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ From vyacheslav.sedov at gmail.com Wed Mar 11 03:10:21 2009 From: vyacheslav.sedov at gmail.com (Vyacheslav Sedov) Date: Tue Mar 10 16:10:26 2009 Subject: [xquery-talk] recurrency In-Reply-To: <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> <701515240903101518q678f3b3bo5b54dc07a43a10b0@mail.gmail.com> <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> Message-ID: <7ab7cbac0903101710o742eef7cqfeae75a49ce28e57@mail.gmail.com> now i know why so many developers hate XML, i can bet that they use string builder to generate it :( 10 years for XML and i worry that we need to wait rest 30 years On Wed, Mar 11, 2009 at 2:42 AM, David Carlisle wrote: > > >> The thing is that later in XML there can be referance to that fields: >> > > sorry I really can not guess what you mean here, and I doubt anyone else > on the list will be able to guess. > Can you not post, to the list, a complete (but small) example of the > input and say what result the query is supposed to produce, then > probably someone would supply some xquery code. > > > given your testXML node input in your original mail and > the node in the last mail, > what is supposed to be returned? perhaps ypu want the element > ?name3 > or perhaps the element > ? > ? name3 > > or perhaps you want something else entirely. I can't guess what you > intend. > > David > > > ________________________________________________________________________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ________________________________________________________________________ > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From int19h at gmail.com Tue Mar 10 17:13:48 2009 From: int19h at gmail.com (Pavel Minaev) Date: Tue Mar 10 16:13:51 2009 Subject: [xquery-talk] How much laziness is permitted? Message-ID: Re-reading the XQuery spec again, I'm trying to understand the full implications of section 2.3.4 "Errors and Optimization". If I understand it correctly, it at least allows implementation to be fully lazy with respect to sequence, in that they can be implemented as lazy non-cached sequence generators - i.e. akin to Microsoft's LINQ "deferred evaluation", where you can chain and nest query expressions as much as you like, but the whole thing will only start evaluating when you actually try to use the resulting sequence (and only to the extent that you use it), and any errors are similarly only reported at that latter point. However, I would like to confirm that I am indeed correct there. Another related question is on how this interacts with try-catch in XQuery 1.1. I've read the corresponding note in the draft in section 3.12, but I'm not sure I fully understand what it means. Consider this code: (* module 1 *) declare function m1:gen() { for $x in 1 to 10000 return if ($x lt 10000) then $x else error() } (* module 2 *) declare function m2:trygen() { try { m1:gen() } catch * { () } }; (* query *) m2:trygen()[1], let $xs := m2:trygen() for $x in $xs return $x * $x Now if the full laziness is still allowed, a legitimate implementation can either return 1 when lazy, or () when not. However, I can't wrap my head about the second expression. If gen() is implemented lazily and returns a generator, then the error will only be triggered on the next line while running it. On the other hand, the spec seems to require that the error should be caught by the catch block in trygen(), since syntactically it appears in gen() when called by trygen(). But how can trygen() do this without either doing eager evaluation, or relying on some form of re-invokable continuations (to backtrack to the proper point of error on exception, and return the correct result? I am particularly interested in how to handle this in presence of true separate compilation for modules (i.e. when compiling trygen(), we don't know how it will be used, and when compiling the query, we don't know that trygen() has a try-catch expression inside). From mike at saxonica.com Wed Mar 11 00:39:04 2009 From: mike at saxonica.com (Michael Kay) Date: Tue Mar 10 16:39:18 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: References: Message-ID: Yes, section 2.3.4 is intended to allow implementations to do as much lazy evaluation as they like. There is still some debate about edge cases. As for the interaction with try/catch, the WG is still debating these issues (the spec is far from finished). I think it's likely that the spec will allow implementations a lot of freedom, at the cost of some loss of predictable/interoperable behaviour - that's the way the XQuery WG has tended to go in the past when such questions arise. The rule that a processor doesn't have to do extra work solely in order to look for errors will remain, despite the fact that the errors might be caught at an outer layer. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Pavel Minaev > Sent: 11 March 2009 00:14 > To: talk@x-query.com > Subject: [xquery-talk] How much laziness is permitted? > > Re-reading the XQuery spec again, I'm trying to understand > the full implications of section 2.3.4 "Errors and > Optimization". If I understand it correctly, it at least > allows implementation to be fully lazy with respect to > sequence, in that they can be implemented as lazy non-cached > sequence generators - i.e. akin to Microsoft's LINQ "deferred > evaluation", where you can chain and nest query expressions > as much as you like, but the whole thing will only start > evaluating when you actually try to use the resulting > sequence (and only to the extent that you use it), and any > errors are similarly only reported at that latter point. > However, I would like to confirm that I am indeed correct there. > > Another related question is on how this interacts with > try-catch in XQuery 1.1. I've read the corresponding note in > the draft in section 3.12, but I'm not sure I fully > understand what it means. Consider this > code: > > (* module 1 *) > declare function m1:gen() { > for $x in 1 to 10000 return if ($x lt 10000) then $x > else error() > } > > (* module 2 *) > declare function m2:trygen() { > try { m1:gen() } catch * { () } > }; > > (* query *) > m2:trygen()[1], > > let $xs := m2:trygen() > for $x in $xs return $x * $x > > > Now if the full laziness is still allowed, a legitimate > implementation can either return 1 when lazy, or () when not. > However, I can't wrap my head about the second expression. If > gen() is implemented lazily and returns a generator, then the > error will only be triggered on the next line while running > it. On the other hand, the spec seems to require that the > error should be caught by the catch block in trygen(), since > syntactically it appears in gen() when called by trygen(). > But how can trygen() do this without either doing eager > evaluation, or relying on some form of re-invokable > continuations (to backtrack to the proper point of error on > exception, and return the correct result? > > I am particularly interested in how to handle this in > presence of true separate compilation for modules (i.e. when > compiling trygen(), we don't know how it will be used, and > when compiling the query, we don't know that trygen() has a > try-catch expression inside). > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From liam at w3.org Tue Mar 10 21:02:34 2009 From: liam at w3.org (Liam Quin) Date: Tue Mar 10 17:02:38 2009 Subject: [xquery-talk] XQuery static typing feature at risk Message-ID: <20090311010234.GJ26120@w3.org> Static typing fans, The XPath and XQuery Formal Semantics document, and the pessimistic static typing feature shared by XPath 2, XSLT 2 and XQuery, is at risk of being dropped, or at least no longer being normative. This is mostly because we don't have resources to do the work. (there's also a question of to what extent the type system should be optimistic or poessimistic, but since we don't really have resources to keep it up to date, it's about to be gone-imistic). I'm posting because if you are reading this, maybe you are someone who has time and ability to help us out. If so, please cantact me. Thanks! Liam -- Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/ http://www.holoweb.net/~liam/ * http://www.fromoldbooks.org/ From michalmas at gmail.com Wed Mar 11 09:12:02 2009 From: michalmas at gmail.com (Michalmas) Date: Wed Mar 11 00:12:09 2009 Subject: [xquery-talk] recurrency In-Reply-To: <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> <701515240903101518q678f3b3bo5b54dc07a43a10b0@mail.gmail.com> <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> Message-ID: <701515240903110112p7cebd95dwd4391cf059cf1106@mail.gmail.com> Hello, Yes, indeed, i missed that. So, to make it complete: name1 t11 name2 t22 t33 name3 Now, later in the same XML, it may be: name1 name3 'sdsdsd' And what i query for is the addInfo. When i see what-the-name--of-var-is node, i want to use the ref values (this case name1/name3), and find the type of last variable (name3 is used as last one - so it is final variable - and i want its type - what is t33). It may also happen that i see: name1 and then i want to get t11. The function i am not showing is simply iterating through all nodes searching for somewhere-it-is-used. Then, base on count of ref elements, one of the function for getting types is called. And the queries i use: declare function local:getNodeDefinitionOne($sys as item(), $node1 as item())as item()* { let $processed := replace(data($node1), ' \(.*\)' , '') let $res := testXML/$sys//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionTwo($sys as item(), $node1 as item(), $node2 as item())as item()* { let $processed := replace(data($node2), ' \(.*\)' , '') let $fir := local:getNodeDefinitionOne($sys, $node1) let $res := $fir//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionThree($sys as item(), $node1 as item(), $node2 as item(), $node3 as item())as item()* { let $processed := replace(data($node3), ' \(.*\)' , '') let $fir := local:getNodeDefinitionTwo($sys, $node1, $node2) let $res := $fir//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionFour($sys as item(), $node1 as item(), $node2 as item(), $node3 as item(), $node4 as item() )as item()* { let $processed := replace(data($node4), ' \(.*\)' , '') let $fir := local:getNodeDefinitionThree($sys, $node1, $node2, $node3) let $res := $fir//node-name[data(name) = $processed] return $res }; declare function local:getNodeDefinitionFive($sys as item(), $node1 as item(), $node2 as item(), $node3 as item(), $node4 as item(), $node5 as item() )as item()* { let $processed := replace(data($node5), ' \(.*\)' , '') let $fir := local:getNodeDefinitionFour($sys, $node1, $node2, $node3, $node4) let $res := $fir//node-name[data(name) = $processed] return $res }; Thanks! On Wed, Mar 11, 2009 at 12:42 AM, David Carlisle wrote: > > > > The thing is that later in XML there can be referance to that fields: > > > > sorry I really can not guess what you mean here, and I doubt anyone else > on the list will be able to guess. > Can you not post, to the list, a complete (but small) example of the > input and say what result the query is supposed to produce, then > probably someone would supply some xquery code. > > > given your testXML node input in your original mail and > the node in the last mail, > what is supposed to be returned? perhaps ypu want the element > name3 > or perhaps the element > > name3 > > or perhaps you want something else entirely. I can't guess what you > intend. > > David > > > ________________________________________________________________________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ________________________________________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090311/662c4ac1/attachment.htm From davidc at nag.co.uk Wed Mar 11 09:33:16 2009 From: davidc at nag.co.uk (David Carlisle) Date: Wed Mar 11 01:33:26 2009 Subject: [xquery-talk] recurrency In-Reply-To: <701515240903110112p7cebd95dwd4391cf059cf1106@mail.gmail.com> (message from Michalmas on Wed, 11 Mar 2009 09:12:02 +0100) References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> <701515240903101518q678f3b3bo5b54dc07a43a10b0@mail.gmail.com> <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> <701515240903110112p7cebd95dwd4391cf059cf1106@mail.gmail.com> Message-ID: <200903110933.n2B9XGqP019152@edinburgh.nag.co.uk> Your posted input wan't well formed, if I make it so: name1 t11 name2 t22 t33 name3 name1 name3 'sdsdsd' name1 Then I think this returns what you want for the two references. declare function local:ref ($node as node(), $s as xs:string*) { if (empty($s)) then $node/addInfo else local:ref($node/descendant::node-name[name=$s[1]][1],$s[position()!=1]) }; for $v in /x/somewhere-it-is-used/what-the-name--of-var-is let $s := $v/ref/replace(.,' .*$','') return {local:ref(/,$s)} as demonstrated by saxon if the above are saved in ref.xml and ref.xq respectively. $ saxon9q -s:ref.xml ref.xq t33 t11 ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ From james.fuller.2007 at gmail.com Wed Mar 11 10:34:31 2009 From: james.fuller.2007 at gmail.com (James Fuller) Date: Wed Mar 11 01:34:34 2009 Subject: [xquery-talk] [ANN] XML Prague 2009 March 21-22 - last chance to register Message-ID: Gold Sponsor: Syntea Software Group a.s. If you are planning to come to XML Prague 2009 we urge you to please register now as we will be closing online registration on March 18th. * Registration - http://www.xmlprague.cz/register.html ---------------------------------------- News ---------------------------------------- * Poster sessions announced here http://www.xmlprague.cz/posters.html * We will be using Twitter (xmlprague) during the conference, so attendees bring your Twitter ID's * We are now sister conference to Balisage http://www.balisage.net/ August 11 -- 14, 2009, Montr?al, Canada ---------------------------------------- Speakers ---------------------------------------- Here is the list of confirmed speakers: * Robin Berjon, Robineko * George Cristian Bina, oXygenXML * Alex Brown * Florent Georges, fgeorges.org * Tony Graham, Menteith Consulting Limited * G. Ken Holman, Crane Softwrights Ltd. * Mark Howe, Xcruciate * Michael Kay, Saxonica * Murata Makoto * P. N?levka * A. Nordstr?m * Jeni Tennison, Jeni Tennison Consulting * V. Toman, EMC * Vaclav Trojan, Syntea software group a.s. * Priscilla Walmsley, Datypic * Norman Walsh, MarkLogic The schedule is comprised of two days of expert talks along with workshops and lightening talks. The program can be found here http://www.xmlprague.cz/program.html ---------------------------------------- Location ---------------------------------------- The conference is held in Prague, Czech Republic. Lesser Town Campus of Charles University Malostransk? n?m?st? 25, Prague, Czech Republic ------------------------- Please email us at info@xmlprague.cz and we will try our best to answer any questions you may have about the conference or venue. We recommend using http://www.marys.cz to find accommodation. If you have already registered for the conference you will receive a final email from us on March 16th confirming your attendance to the conference. Look forward to seeing everyone there. cheers, Jim Fuller ps: don't forget that G. Ken Holman is putting on his five day pre-conference XSLT/XPath/XQuery tutorial, details here: http://www.cranesoftwrights.com/index.html#Crane200903CZ ------------------------- XML Prague March 21-22, 2009 http://www.xmlprague.cz Sponsored by Syntea software group a.s. (http://www.syntea.cz) and oXygen (http://www.oxygenxml.com) and fgeorges.org (http://www.fgeorges.org) and Xcruciate (http://www.xcruciate.co.uk) From john.snelson at oracle.com Wed Mar 11 11:00:04 2009 From: john.snelson at oracle.com (John Snelson) Date: Wed Mar 11 02:59:15 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: References: Message-ID: <49B799B4.4090400@oracle.com> Hi Pavel, Pavel Minaev wrote: > (* module 1 *) > declare function m1:gen() { > for $x in 1 to 10000 return if ($x lt 10000) then $x else error() > } > > (* module 2 *) > declare function m2:trygen() { > try { m1:gen() } catch * { () } > }; > > (* query *) > m2:trygen()[1], > > let $xs := m2:trygen() > for $x in $xs return $x * $x > > > Now if the full laziness is still allowed, a legitimate implementation > can either return 1 when lazy, or () when not. However, I can't wrap > my head about the second expression. If gen() is implemented lazily > and returns a generator, then the error will only be triggered on the > next line while running it. On the other hand, the spec seems to > require that the error should be caught by the catch block in > trygen(), since syntactically it appears in gen() when called by > trygen(). But how can trygen() do this without either doing eager > evaluation, or relying on some form of re-invokable continuations (to > backtrack to the proper point of error on exception, and return the > correct result? As it turns out, try/catch is actually a blocking operation on lazy evaluation. If a lazily evaluated expression inside a try/catch block returns (1, 2, 3) but then raises an error, the implementation effectively needs to "recall" the values (1, 2, 3) and instead return the value of the catch expression. Since most lazy implementations won't have the ability to "recall" values already returned, this means they can't return any values until expression evaluation has terminated - in other words, they need to evaluate eagerly. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From matthew at stickledown.com Wed Mar 11 11:26:54 2009 From: matthew at stickledown.com (Matthew Rawlings) Date: Wed Mar 11 03:25:57 2009 Subject: [xquery-talk] XQuery static typing feature at risk In-Reply-To: <20090311010234.GJ26120@w3.org> Message-ID: <275C0A3A62104249A0C5E9B7A817ADC7@ORAC> The XQuery Formal Semantics gives a very useful 'curly braces' notation for scribbling XML Schema on whiteboards or in text editors. I had been hoping the XSDL WG might even have adopted it. From mike at saxonica.com Wed Mar 11 17:08:25 2009 From: mike at saxonica.com (Michael Kay) Date: Wed Mar 11 09:08:40 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: <49B799B4.4090400@oracle.com> References: <49B799B4.4090400@oracle.com> Message-ID: > > Pavel Minaev wrote: > > (* module 1 *) > > declare function m1:gen() { > > for $x in 1 to 10000 return if ($x lt 10000) then $x else error() > > } > > > > (* module 2 *) > > declare function m2:trygen() { > > try { m1:gen() } catch * { () } > > }; > > > > John Snelson: As it turns out, try/catch is actually a blocking operation > on lazy evaluation. I think that's certainly true of a naive implementation (and it's largely true of Saxon's current implementation). However, I think some optimization rewrites are still legitimate: for example, given an expression such as (try{ E } catch * {F})[1] I think an implementation can legitimately rewrite this as try{ E[1] } catch * {F[1]} exploiting the knowledge that E[1] cannot throw an error unless E throws an error. Michael Kay http://www.saxonica.com/ From john.snelson at oracle.com Wed Mar 11 17:24:42 2009 From: john.snelson at oracle.com (John Snelson) Date: Wed Mar 11 09:24:56 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: References: <49B799B4.4090400@oracle.com> Message-ID: <49B7F3DA.6070602@oracle.com> Michael Kay wrote: >> Pavel Minaev wrote: >>> (* module 1 *) >>> declare function m1:gen() { >>> for $x in 1 to 10000 return if ($x lt 10000) then $x else error() >>> } >>> >>> (* module 2 *) >>> declare function m2:trygen() { >>> try { m1:gen() } catch * { () } >>> }; >>> >> John Snelson: As it turns out, try/catch is actually a blocking operation >> on lazy evaluation. > > I think that's certainly true of a naive implementation (and it's largely > true of Saxon's current implementation). However, I think some optimization > rewrites are still legitimate: for example, given an expression such as > > (try{ E } catch * {F})[1] > > I think an implementation can legitimately rewrite this as > > try{ E[1] } catch * {F[1]} > > exploiting the knowledge that E[1] cannot throw an error unless E throws an > error. Yes, that's true. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From lists at fgeorges.org Wed Mar 11 17:34:39 2009 From: lists at fgeorges.org (Florent Georges) Date: Wed Mar 11 09:34:44 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: <49B799B4.4090400@oracle.com> Message-ID: <989010.31447.qm@web23008.mail.ird.yahoo.com> John Snelson wrote: John, > As it turns out, try/catch is actually a blocking operation > on lazy evaluation. If a lazily evaluated expression inside > a try/catch block returns (1, 2, 3) but then raises an > error, the implementation effectively needs to > "recall" the values (1, 2, 3) and instead return > the value of the catch expression. Since most lazy > implementations won't have the ability to > "recall" values already returned, this means they > can't return any values until expression evaluation has > terminated - in other words, they need to evaluate eagerly. I have some difficulties understanding the problem. Could you provide me with a little sample or pseudo code showing such a situation? Regards, -- Florent Georges http://www.fgeorges.org/ From john.snelson at oracle.com Wed Mar 11 17:41:05 2009 From: john.snelson at oracle.com (John Snelson) Date: Wed Mar 11 09:41:31 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: <989010.31447.qm@web23008.mail.ird.yahoo.com> References: <989010.31447.qm@web23008.mail.ird.yahoo.com> Message-ID: <49B7F7B1.4050709@oracle.com> Florent Georges wrote: > John Snelson wrote: >> As it turns out, try/catch is actually a blocking operation >> on lazy evaluation. If a lazily evaluated expression inside >> a try/catch block returns (1, 2, 3) but then raises an >> error, the implementation effectively needs to >> "recall" the values (1, 2, 3) and instead return >> the value of the catch expression. Since most lazy >> implementations won't have the ability to >> "recall" values already returned, this means they >> can't return any values until expression evaluation has >> terminated - in other words, they need to evaluate eagerly. > > I have some difficulties understanding the problem. Could you provide me with a little sample or pseudo code showing such a situation? try { 1, 2, 3, error() } catch * { "doh!" } Typically, lazy evaluation will start returning items from expressions one by one as they are requested. So lets say I request an item from the expression above, and it gives me 1. I do this a couple more times and it gives me 2 and 3. Then the next time I request an item, the error() function raises an error - and the implementation says "Oh - wait a minute! Give me back those answers, I didn't mean them - I meant to return 'doh!'.". In short, if there's a possibility that the try expression could raise an error, the try/catch block must fully evaluate it to see if an error occurs before it can return any values. So lazy evaluation has been "blocked" by the try/catch, and the expression has in practice been evaluated eagerly. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From lists at fgeorges.org Wed Mar 11 17:59:22 2009 From: lists at fgeorges.org (Florent Georges) Date: Wed Mar 11 09:59:26 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: <49B7F7B1.4050709@oracle.com> Message-ID: <443906.10340.qm@web23002.mail.ird.yahoo.com> John Snelson wrote: > try { 1, 2, 3, error() } catch * { "doh!" } > Typically, lazy evaluation will start returning items from > expressions one by one as they are requested. So lets say I > request an item from the expression above, and it gives me > 1. I do this a couple more times and it gives me 2 and 3. > Then the next time I request an item, the error() function > raises an error - and the implementation says "Oh - > wait a minute! Give me back those answers, I didn't mean > them - I meant to return 'doh!'.". Thanks. But I still fail to see the exact problem. If you use the whole sequence, or its 4th item, then lazy evaluation is not concerned if I am right. And if you just use its 1st item (for instance) then an implementation is allowed to NOT report the error if it does not want to (if I am right.) Of course, this last rule could me more confusing in case of try/catch. Is it the issue or still I missed it? Regards, -- Florent Georges http://www.fgeorges.org/ From michalmas at gmail.com Wed Mar 11 22:51:19 2009 From: michalmas at gmail.com (Michalmas) Date: Wed Mar 11 13:51:23 2009 Subject: [xquery-talk] recurrency In-Reply-To: <200903110933.n2B9XGqP019152@edinburgh.nag.co.uk> References: <701515240903101440u19d9921ob541999d36eb40ca@mail.gmail.com> <200903102207.n2AM7ax8018912@edinburgh.nag.co.uk> <701515240903101518q678f3b3bo5b54dc07a43a10b0@mail.gmail.com> <200903102226.n2AMQeN8032285@edinburgh.nag.co.uk> <701515240903101548s11561429hf9d9784a0be48d2d@mail.gmail.com> <200903102342.n2ANg3SP014109@edinburgh.nag.co.uk> <701515240903110112p7cebd95dwd4391cf059cf1106@mail.gmail.com> <200903110933.n2B9XGqP019152@edinburgh.nag.co.uk> Message-ID: <701515240903111451o7c8e17c9u13e6f20e101af015@mail.gmail.com> Hello David, Thank you very much for help. Later i realized i tried to do it in loop (no recursion), and then the variable state was lost. About your solution - i had to use Altova XML Spy for that, and i had some problems. The definition of function: declare function local:ref ($node as node()***, $s as xs:string*) { required putting star, as we pass many nodes. I also simplified the example too much, so i had to change some more things. But it perfectly works! Thanks, Michal On Wed, Mar 11, 2009 at 10:33 AM, David Carlisle wrote: > > > Your posted input wan't well formed, if I make it so: > > > > > > > name1 > t11 > > name2 > t22 > > t33 > name3 > > > > > > > > > > > name1 > name3 'sdsdsd' > > > > > > name1 > > > > > > > > > Then I think this returns what you want for the two references. > > > > > declare function local:ref ($node as node(), $s as xs:string*) { > if (empty($s)) > then > $node/addInfo > else > local:ref($node/descendant::node-name[name=$s[1]][1],$s[position()!=1]) > }; > > for $v in /x/somewhere-it-is-used/what-the-name--of-var-is > let $s := $v/ref/replace(.,' .*$','') > return > > {local:ref(/,$s)} > > > > > as demonstrated by saxon if the above are saved in ref.xml and ref.xq > respectively. > > > > $ saxon9q -s:ref.xml ref.xq > > > t33 > > > t11 > > > ________________________________________________________________________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ________________________________________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090311/9ccb55f6/attachment.htm From mike at saxonica.com Wed Mar 11 22:36:54 2009 From: mike at saxonica.com (Michael Kay) Date: Wed Mar 11 14:37:12 2009 Subject: [xquery-talk] XQuery static typing feature at risk In-Reply-To: <275C0A3A62104249A0C5E9B7A817ADC7@ORAC> References: <20090311010234.GJ26120@w3.org> <275C0A3A62104249A0C5E9B7A817ADC7@ORAC> Message-ID: <26882B213FEB4D7D9FEE9894C555C191@Sealion> > The XQuery Formal Semantics gives a very useful 'curly > braces' notation for scribbling XML Schema on whiteboards or > in text editors. I had been hoping the XSDL WG might even > have adopted it. A concise syntax for XSD has been on the agenda for the WG, but the group is very short of resources and decided to put this on the back burner. Of course one reason this syntax is nice is that it only covers the 10% of XSD facilities that you use 90% of the time. If you try to define a concise syntax that doesn't subset the functionality, it gets a lot more difficult. Some of the things it leaves out are quite subtle - for example XSD allows you define a sequence, choice, or all group containing a single particle, whereas the FS concise syntax requires at least two particles. So you immediately start a debate about whether the concise syntax needs to be "complete": for some use cases it does, for others it doesn't. Michael Kay http://www.saxonica.com/ From john.snelson at oracle.com Thu Mar 12 10:11:38 2009 From: john.snelson at oracle.com (John Snelson) Date: Thu Mar 12 02:11:54 2009 Subject: [xquery-talk] How much laziness is permitted? In-Reply-To: <443906.10340.qm@web23002.mail.ird.yahoo.com> References: <443906.10340.qm@web23002.mail.ird.yahoo.com> Message-ID: <49B8DFDA.9070801@oracle.com> Florent Georges wrote: > John Snelson wrote: > >> try { 1, 2, 3, error() } catch * { "doh!" } > >> Typically, lazy evaluation will start returning items from >> expressions one by one as they are requested. So lets say I >> request an item from the expression above, and it gives me >> 1. I do this a couple more times and it gives me 2 and 3. >> Then the next time I request an item, the error() function >> raises an error - and the implementation says "Oh - >> wait a minute! Give me back those answers, I didn't mean >> them - I meant to return 'doh!'.". > > Thanks. But I still fail to see the exact problem. If you use the whole sequence, or its 4th item, then lazy evaluation is not concerned if I am right. And if you just use its 1st item (for instance) then an implementation is allowed to NOT report the error if it does not want to (if I am right.) If you only need three items from the expression above, then XQuery 1.1 says it's valid to return (1, 2, 3). However it's unusual for an XQuery implementation to ask an expression for 3 items - it more likely asks for the "next" item three times. In this latter case, given that in general the implementation won't know if an error will be raised or not, the implementation is forced into eager evaluation of the try expression. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From gajanansc at gmail.com Sun Mar 15 09:33:04 2009 From: gajanansc at gmail.com (Gajanan Chinchwadkar) Date: Sun Mar 15 08:33:58 2009 Subject: [xquery-talk] XML databases and image/video data Message-ID: <8981f12b0903150933h4843485at15682aaf9fc0439b@mail.gmail.com> Hi, Is anybody on this list aware of any commercial/academic XML databases (or XQuery extensions) meant specially for image, video and sound tracks etc.? Alternatively, any standardization effort for representing such information in general XML databases? Thanks, Gajanan From vyacheslav.sedov at gmail.com Sun Mar 15 19:46:32 2009 From: vyacheslav.sedov at gmail.com (Vyacheslav Sedov) Date: Sun Mar 15 08:47:27 2009 Subject: [xquery-talk] XML databases and image/video data In-Reply-To: <8981f12b0903150933h4843485at15682aaf9fc0439b@mail.gmail.com> References: <8981f12b0903150933h4843485at15682aaf9fc0439b@mail.gmail.com> Message-ID: <7ab7cbac0903150946x78d73489iabcdbd312392c92b@mail.gmail.com> you mean metadata extraction ability? On Sun, Mar 15, 2009 at 7:33 PM, Gajanan Chinchwadkar wrote: > Hi, > > Is anybody on this list aware of any commercial/academic XML databases > (or XQuery extensions) meant specially for image, video and sound > tracks etc.? Alternatively, any standardization effort for > representing such information in general XML databases? > > Thanks, > > Gajanan > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From gajanansc at gmail.com Sun Mar 15 10:20:04 2009 From: gajanansc at gmail.com (Gajanan Chinchwadkar) Date: Sun Mar 15 09:20:57 2009 Subject: [xquery-talk] XML databases and image/video data In-Reply-To: <7ab7cbac0903150946x78d73489iabcdbd312392c92b@mail.gmail.com> References: <8981f12b0903150933h4843485at15682aaf9fc0439b@mail.gmail.com> <7ab7cbac0903150946x78d73489iabcdbd312392c92b@mail.gmail.com> Message-ID: <8981f12b0903151020h14e7d927tb0f26f3b3e531b79@mail.gmail.com> If the meta-data is simply stored as XML files containing text-only data, then we can use XPath/XQuery to extract it. But I am looking for pointers to some work where: (i) images are stored in XML format (may be MPEG-7 or something else), (ii) the storage is optimized for feature extraction or image similarity types of queries, (iii) indexing schemes suitable for image data are available, and so on... thanks, Gajanan On Sun, Mar 15, 2009 at 9:46 AM, Vyacheslav Sedov wrote: > you mean metadata extraction ability? > > On Sun, Mar 15, 2009 at 7:33 PM, Gajanan Chinchwadkar > wrote: >> Hi, >> >> Is anybody on this list aware of any commercial/academic XML databases >> (or XQuery extensions) meant specially for image, video and sound >> tracks etc.? Alternatively, any standardization effort for >> representing such information in general XML databases? >> >> Thanks, >> >> Gajanan >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> > From howardk at fatdog.com Sun Mar 15 18:04:27 2009 From: howardk at fatdog.com (Howard Katz) Date: Sun Mar 15 17:05:23 2009 Subject: [xquery-talk] reversing element ordering, with a caveat Message-ID: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> I have a series of books ordered chronologically by publication date, 1942 to 2009. I want to generate a file in which the books have the reverse chronological ordering, 2009 to 1942, but with the caveat that books *within* a particular year need to maintain the original document order relative to that year. In the following, the catid attributes within a particular year remain in ascending order after the transformation. (The catid's are used here only for demonstration purposes; they're not present in the actual document.) I'd be happy to see a solution either in XQuery or in XSLT. Here's some sample input and the output. Input: ... Output: ... TIA, Howard From brian at blumenfeld-maso.com Sun Mar 15 19:23:36 2009 From: brian at blumenfeld-maso.com (Brian Maso) Date: Sun Mar 15 18:24:31 2009 Subject: [xquery-talk] reversing element ordering, with a caveat In-Reply-To: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> References: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> Message-ID: In XQuery, I think its just a matter of running over the distinct values of //book/@pubYear in descending order. Something like: (* Maybe there's a more elegant way of getting the sequence of years in descending order? *) let $descending-distinct-years := distinct-values(for $v in //book/@pubYear/value() order by $v descending return $v) for $year in $descending-distinct-years return //book[@pubYear = $year] This will retain original document ordering for elements with the same @pubYear value, but years will be descending from highest value to lowest. Brian Maso On Sun, Mar 15, 2009 at 6:04 PM, Howard Katz wrote: > I have a series of books ordered chronologically by publication date, 1942 > to 2009. I want to generate a file in which the books have the reverse > chronological ordering, 2009 to 1942, but with the caveat that books > *within* a particular year need to maintain the original document order > relative to that year. In the following, the catid attributes within a > particular year remain in ascending order after the transformation. (The > catid's are used here only for demonstration purposes; they're not present > in the actual document.) > > I'd be happy to see a solution either in XQuery or in XSLT. Here's some > sample input and the output. > > Input: > > > > > > > > > ... > > > > > > > > > > Output: > > > > > > > > > ... > > > > > > > > > > TIA, > Howard > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090315/0d9a4701/attachment.htm From howardk at fatdog.com Sun Mar 15 19:44:00 2009 From: howardk at fatdog.com (Howard Katz) Date: Sun Mar 15 18:44:57 2009 Subject: [xquery-talk] reversing element ordering, with a caveat In-Reply-To: References: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> Message-ID: Beautiful. I just removed the value() function following the path ending in @pubYear, as Saxon returned an "Unknown system function," and it worked perfectly. Thanks you, Howard _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Brian Maso Sent: Sunday, March 15, 2009 7:24 PM To: Howard Katz; talk@x-query.com Subject: Re: [xquery-talk] reversing element ordering, with a caveat In XQuery, I think its just a matter of running over the distinct values of //book/@pubYear in descending order. Something like: (* Maybe there's a more elegant way of getting the sequence of years in descending order? *) let $descending-distinct-years := distinct-values(for $v in //book/@pubYear/value() order by $v descending return $v) for $year in $descending-distinct-years return //book[@pubYear = $year] This will retain original document ordering for elements with the same @pubYear value, but years will be descending from highest value to lowest. Brian Maso On Sun, Mar 15, 2009 at 6:04 PM, Howard Katz wrote: I have a series of books ordered chronologically by publication date, 1942 to 2009. I want to generate a file in which the books have the reverse chronological ordering, 2009 to 1942, but with the caveat that books *within* a particular year need to maintain the original document order relative to that year. In the following, the catid attributes within a particular year remain in ascending order after the transformation. (The catid's are used here only for demonstration purposes; they're not present in the actual document.) I'd be happy to see a solution either in XQuery or in XSLT. Here's some sample input and the output. Input: ... Output: ... TIA, Howard _______________________________________________ talk@x-query.com http://x-query.com/mailman/listinfo/talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090315/f1477ef5/attachment.htm From gkholman at CraneSoftwrights.com Mon Mar 16 07:54:13 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 15 22:55:53 2009 Subject: [xquery-talk] reversing element ordering, with a caveat In-Reply-To: References: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> Message-ID: <7.0.1.0.2.20090316074353.025b18f8@wheresmymailserver.com> At 2009-03-15 19:23 -0700, Brian Maso wrote: >In XQuery, I think its just a matter of running over the distinct >values of //book/@pubYear in descending order. Something like: I don't think that level of complexity is needed at all. XQuery clause 3.8.3 includes in one of the examples the text: "the keyword stable indicates that their input order is preserved" >This will retain original document ordering for elements with the >same @pubYear value, but years will be descending from highest value to lowest. I suspect, Howard, this is all you need: { for $each in library/book stable order by $each/@pubYear descending return $each } A running example is below. Note that if your implementation-dependent default mode for ordering is unordered or you want a portable query across all implementations, then a safe portable addition would be to add at the top: default ordering ordered; ... and would be required in Brian's solution as well to guarantee a correct order across all implementations. But I'm using Saxon below so I don't have to. I hope this helps. You shouldn't need to go into distinct-values at all. . . . . . . . Ken t:\ftemp>type howard.xml ... t:\ftemp>xquery howard.xml howard.xq t:\ftemp>type howard.xq { for $each in library/book stable order by $each/@pubYear descending return $each } t:\ftemp> -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From gkholman at CraneSoftwrights.com Mon Mar 16 08:30:49 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 15 23:39:38 2009 Subject: [xquery-talk] Implementation practices regarding ordering Message-ID: <7.0.1.0.2.20090316082445.026637e0@CraneSoftwrights.com> In my post earlier to Howard regarding his requirement for preserving document order, I talked about the difference between: { for $each in library/book order by $each/@pubYear descending return $each } ... and ... declare ordering ordered; { for $each in library/book stable order by $each/@pubYear descending return $each } ... where the second is portable across all implementations and the first only when the implementation-defined values for ordering in both the separate default mode and FLWOR expression are implemented as ordered. I'm starting my 5-day hands-on XQuery/XSLT class this morning in Prague in advance of the http://XMLPrague.cz conference, and I would like to tell students about implementation practices. I'm running the same class in the Los Angeles area June 8-12. Which of the publicly-announced implementations of XQuery do not assume document order when using location path addresses to get nodes from the source node tree? Thanks for sharing! . . . . . . . . . . . Ken -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From gkholman at CraneSoftwrights.com Mon Mar 16 08:37:32 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sun Mar 15 23:39:41 2009 Subject: [xquery-talk] reversing element ordering, with a caveat In-Reply-To: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> References: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> Message-ID: <7.0.1.0.2.20090316083135.0264d908@wheresmymailserver.com> At 2009-03-15 18:04 -0700, Howard Katz wrote: >I'd be happy to see a solution either in XQuery or in XSLT. Here's some >sample input and the output. Below, Howard, is a solution in XSLT. Note that the XSLT specification defaults access to the source node tree in document order, so there is no need for the portable provisions I commented on regarding XQuery. I hope this helps. . . . . . . . . . Ken t:\ftemp>type howard.xml ... t:\ftemp>xslt howard.xml howard.xsl t:\ftemp>type howard.xsl t:\ftemp> -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From howardk at fatdog.com Mon Mar 16 07:02:54 2009 From: howardk at fatdog.com (Howard Katz) Date: Mon Mar 16 06:03:13 2009 Subject: [xquery-talk] reversing element ordering, with a caveat In-Reply-To: <7.0.1.0.2.20090316074353.025b18f8@wheresmymailserver.com> References: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM> <7.0.1.0.2.20090316074353.025b18f8@wheresmymailserver.com> Message-ID: Thanks, Ken, The ordering appears to remain stable in Saxon, even w/out the 'stable' keyword. An interesting discussion! Howard > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of G. Ken Holman > Sent: Sunday, March 15, 2009 11:54 PM > To: talk@x-query.com > Cc: Howard Katz; Brian Maso > Subject: Re: [xquery-talk] reversing element ordering, with a caveat > > At 2009-03-15 19:23 -0700, Brian Maso wrote: > >In XQuery, I think its just a matter of running over the distinct > >values of //book/@pubYear in descending order. Something like: > > I don't think that level of complexity is needed at all. > > XQuery clause 3.8.3 includes in one of the examples the text: > > "the keyword stable indicates that their input order is preserved" > > >This will retain original document ordering for elements with the > >same @pubYear value, but years will be descending from > highest value to lowest. > > I suspect, Howard, this is all you need: > > > { > for $each in library/book > stable order by $each/@pubYear descending > return $each > } > > > A running example is below. Note that if your > implementation-dependent default mode for ordering is unordered or > you want a portable query across all implementations, then a safe > portable addition would be to add at the top: > > default ordering ordered; > > ... and would be required in Brian's solution as well to guarantee a > correct order across all implementations. > > But I'm using Saxon below so I don't have to. > > I hope this helps. You shouldn't need to go into > distinct-values at all. > > . . . . . . . Ken > > t:\ftemp>type howard.xml > > > > > > > > ... > > > > > > > > > > t:\ftemp>xquery howard.xml howard.xq > > > > > > > > > > > > > > > > > > > > > > t:\ftemp>type howard.xq > > { > for $each in library/book > stable order by $each/@pubYear descending > return $each > } > > t:\ftemp> > > -- > XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 > Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > G. Ken Holman mailto:gkholman@CraneSoftwrights.com > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc > Legal business disclaimers: http://www.CraneSoftwrights.com/legal > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From mike at saxonica.com Mon Mar 16 14:32:50 2009 From: mike at saxonica.com (Michael Kay) Date: Mon Mar 16 06:33:22 2009 Subject: [xquery-talk] reversing element ordering, with a caveat In-Reply-To: References: <7B0E51FDE18843EF9FD6367CC959BE45@HOWARDM><7.0.1.0.2.20090316074353.025b18f8@wheresmymailserver.com> Message-ID: <0EED2F13A6D24DE1AD2E1EE9033CBC76@Sealion> > The ordering appears to remain stable in Saxon, even w/out > the 'stable' keyword. Yes, that's correct. I expect there are a few microseconds to be saved by not doing stable ordering unless the user requests it, but I would think more people will notice that their results have become unpredictable than will notice the performance improvement. Michael Kay http://www.saxonica.com/ From michalmas at gmail.com Wed Mar 18 00:37:48 2009 From: michalmas at gmail.com (Michalmas) Date: Tue Mar 17 15:44:47 2009 Subject: [xquery-talk] xquery: iteration simulation In-Reply-To: References: <701515240903081329r24203b14y23441d289871cfc6@mail.gmail.com> Message-ID: <701515240903171637h744f1dddpaee3afebfab46fdc@mail.gmail.com> Hello guys, thanks a lot! Both solutions seems to be ok (i only had to fix some typos in Michael's solution, like missing '"' or too many ')' :P). The main purpose is, as Micheal guessed, histogram of some nodes. Best, M. On Mon, Mar 9, 2009 at 12:29 AM, Michael Kay wrote: > Is "someStr" the same element name throughout? If so, it looks like this: > > declare function local:depth($e as element(*)) as xs:integer { > count($e/ancestor::*[node-name(.)=node-name($e)] > }; > > declare function local:histogram($root as element(mainNode), $name as > xs:QName) as element(count)* > for $d in distinct-values(mainNode//*[node-name()=$s]/local:depth(.)) > return } > > for $n in (xs:QName("", "someStr"), xs:QName("", "someOtherStr"), .....) > return local:histogram(mainNode, $n) > > Michael Kay > http://www.saxonica.com/ > > ------------------------------ > *From:* talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] *On > Behalf Of *Michalmas > *Sent:* 08 March 2009 20:29 > *To:* talk@x-query.com > *Subject:* [xquery-talk] xquery: iteration simulation > > Hello guys, > > Can you help me with the following problem: > > I have some XML. > > Now, i need to query it. But what i need to do, is to make queries of the > form: > > count(mainNode//someStr) > count(mainNode//someStr/someStr) > (...) > > count(mainNode//someStr/someStr/someStr/someStr/someStr/someStr/someStr/someStr) > > The deep level of the last query may be even around 50 (so, 50 queries). > Such set of queries will be repeated for about 100 keywords (like someStr). > In total, that gives about 500 queries to create. > > Is is posible to write iteration in XQuery for that. Or pass it as a > function? > > Thanks, > M. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090318/9d0886ab/attachment.htm From thomas.jones at maitreyasecurity.com Wed Mar 18 13:06:10 2009 From: thomas.jones at maitreyasecurity.com (Thomas R. Jones) Date: Wed Mar 18 10:18:04 2009 Subject: [xquery-talk] querying attribute? Message-ID: <1237395970.4163.24.camel@linux-90tc> Hello all, I have the following code: I am trying everything i can think of to return the attribute value but am hanging up on the namespace(i think). I believe because the attribute is not prefixed that it is located within a NULL namespace and not the element default namespace declared----correct? Here is my xquery: declare default element namespace "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"; for $attr in document("apache2.package.novell.maitreyasecurity.en_US.xml","inventory.a")/tests/rpminfo_test/@id return string($attr) Ideas? Thank you for your time. Thomas Jones From gkholman at CraneSoftwrights.com Wed Mar 18 20:05:33 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Wed Mar 18 11:12:54 2009 Subject: [xquery-talk] querying attribute? In-Reply-To: <1237395970.4163.24.camel@linux-90tc> References: <1237395970.4163.24.camel@linux-90tc> Message-ID: <7.0.1.0.2.20090318200344.026e3df8@wheresmymailserver.com> At 2009-03-18 13:06 -0400, Thomas R. Jones wrote: >Hello all, I have the following code: > > > xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" >check="all" comment="apache2 is installed" >id="oval:com.maitreyasecurity:tst:674" version="1"> > > > > > >I am trying everything i can think of to return the attribute value but >am hanging up on the namespace(i think). I believe because the attribute >is not prefixed that it is located within a NULL namespace and not the >element default namespace declared----correct? Yes, that is correct. *All* unprefixed attributes are in no namespace, never the default namespace. >Here is my xquery: > >declare default element namespace >"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"; for $attr in >document("apache2.package.novell.maitreyasecurity.en_US.xml","inventory.a")/tests/rpminfo_test/@id >return string($attr) > >Ideas? You declare the "#linux" namespace as your default element namespace, so it is being applied to *every* element (after all, it is the default) which includes the element. Your element is in not in the "#linux" namespace, so your problem is it isn't finding the element with the attribute, not that it isn't finding the attribute. I tell my students that using the default namespace can be awkward when dealing with an instance of numerous namespaces (as I learned the hard way when working with UBL). I believe it will make maintenance easier if you explicitly use prefixes when there is more than one namespace in your source tree. A running example is below ... I hope this helps. . . . . . . . . . Ken t:\ftemp>type thomas.xml t:\ftemp>call xquery thomas.xml thomas.xq oval:com.maitreyasecurity:tst:674 t:\ftemp>type thomas.xq declare namespace o = "http://oval.mitre.org/XMLSchema/oval-definitions-5"; declare namespace l = "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"; for $attr in /o:tests/l:rpminfo_test/@id return string($attr) t:\ftemp> -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From thomas.jones at maitreyasecurity.com Wed Mar 18 17:06:24 2009 From: thomas.jones at maitreyasecurity.com (Thomas R. Jones) Date: Wed Mar 18 14:09:36 2009 Subject: Fwd: [xquery-talk] querying attribute? References: <003C06ED-95A2-41A7-8BE7-372881D2729A@maitreyasecurity.com> Message-ID: <278CF5D3-3323-4D63-A18E-D8B639754B60@maitreyasecurity.com> The following message was mistakingly only sent to ken. I'm forwarding it to the list at his request so that other users may benefit from his insight. :) Thomas Sent from my iPhone Begin forwarded message: > From: "Thomas R. Jones" > Date: March 18, 2009 2:42:49 PM CDT > To: "G. Ken Holman" > Subject: Re: [xquery-talk] querying attribute? > > Thanks so much for your response ken. > > So it is correct to declare and reference namespace prefixes within > xquery even though they are not "explicitly" done so in source code? > I'm guessing the parser is handling this natively. The XML source is > located within an international database and it strips prefix > declarations within the import triggers. :( > > I'll try this as soon as I get home. Thanks again > > Sent from my iPhone > > On Mar 18, 2009, at 2:05 PM, "G. Ken Holman" > wrote: > >> At 2009-03-18 13:06 -0400, Thomas R. Jones wrote: >>> Hello all, I have the following code: >>> >>> >>> >> xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" >>> check="all" comment="apache2 is installed" >>> id="oval:com.maitreyasecurity:tst:674" version="1"> >>> >>> >>> >>> >>> >>> I am trying everything i can think of to return the attribute >>> value but >>> am hanging up on the namespace(i think). I believe because the >>> attribute >>> is not prefixed that it is located within a NULL namespace and not >>> the >>> element default namespace declared----correct? >> >> Yes, that is correct. *All* unprefixed attributes are in no >> namespace, never the default namespace. >> >> >>> Here is my xquery: >>> >>> declare default element namespace >>> "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"; for >>> $attr in >>> document( >>> "apache2.package.novell.maitreyasecurity.en_US.xml","inventory.a")/ >>> tests/rpminfo_test/@id return string($attr) >>> >>> Ideas? >> >> You declare the "#linux" namespace as your default element >> namespace, so it is being applied to *every* element (after all, it >> is the default) which includes the element. Your >> element is in not in the "#linux" namespace, so your problem is it >> isn't finding the element with the attribute, not that it isn't >> finding the attribute. >> >> I tell my students that using the default namespace can be awkward >> when dealing with an instance of numerous namespaces (as I learned >> the hard way when working with UBL). I believe it will make >> maintenance easier if you explicitly use prefixes when there is >> more than one namespace in your source tree. >> >> A running example is below ... I hope this helps. >> >> . . . . . . . . . Ken >> >> t:\ftemp>type thomas.xml >> >> > xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" >> check="all" comment="apache2 is installed" >> id="oval:com.maitreyasecurity:tst:674" version="1"> >> >> >> >> >> >> t:\ftemp>call xquery thomas.xml thomas.xq >> oval:com.maitreyasecurity:tst: >> 674 >> t:\ftemp>type thomas.xq >> declare namespace o = >> "http://oval.mitre.org/XMLSchema/oval-definitions-5"; >> declare namespace l = >> "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"; >> for $attr in >> /o:tests/l:rpminfo_test/@id return string($attr) >> >> t:\ftemp> >> >> >> -- >> XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 >> Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video >> Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 >> Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 >> G. Ken Holman mailto:gkholman@CraneSoftwrights.com >> Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ >> Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc >> Legal business disclaimers: http://www.CraneSoftwrights.com/legal >> >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090318/36494859/attachment.htm From rpbourret at rpbourret.com Wed Mar 18 20:34:10 2009 From: rpbourret at rpbourret.com (Ronald Bourret) Date: Wed Mar 18 19:34:13 2009 Subject: Fwd: [xquery-talk] querying attribute? In-Reply-To: <278CF5D3-3323-4D63-A18E-D8B639754B60@maitreyasecurity.com> References: <003C06ED-95A2-41A7-8BE7-372881D2729A@maitreyasecurity.com> <278CF5D3-3323-4D63-A18E-D8B639754B60@maitreyasecurity.com> Message-ID: <49C1BD32.9070904@rpbourret.com> Thomas R. Jones wrote: >> So it is correct to declare and reference namespace prefixes within >> xquery even though they are not "explicitly" done so in source code? I'm not sure what you mean by "source code". Do you mean the XML document? What XQuery requires is that, after prefixes and the default namespace are resolved, the names in the query must be the same (namespace and element/attribute name) as the names in the XML document in order to have a successful match. >> I'm guessing the parser is handling this natively. The XML source is >> located within an international database and it strips prefix >> declarations within the import triggers. :( Stripping prefix declarations is almost certainly an error -- I'd be curious to hear the reason for it. There are two problems: 1) If the trigger leaves the prefixes in the element and attribute names, the resulting document is namespace invalid, as the prefixes are not declared. 2) If the prefixes are also stripped from the element and attribute names, the resulting document, although namespace valid, is not the same document. Namespaces are used to create two-part names for elements and attributes, and removing half the name (the namespace) is akin to changing the element and attribute names themselves. -- Ron From gkholman at CraneSoftwrights.com Thu Mar 19 07:54:49 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Wed Mar 18 22:55:39 2009 Subject: Fwd: [xquery-talk] querying attribute? In-Reply-To: <278CF5D3-3323-4D63-A18E-D8B639754B60@maitreyasecurity.com> References: <003C06ED-95A2-41A7-8BE7-372881D2729A@maitreyasecurity.com> <278CF5D3-3323-4D63-A18E-D8B639754B60@maitreyasecurity.com> Message-ID: <7.0.1.0.2.20090319075232.02637d10@wheresmymailserver.com> At 2009-03-18 17:06 -0500, Thomas R. Jones wrote: >>So it is correct to declare and reference namespace prefixes within >>xquery even though they are not "explicitly" done so in source code? Absolutely ... in fact it is required. Prefixes are ephemeral and should be irrelevant in queries. They are only a proxy to the URI string associated with the prefix. The data model happens to contain the prefixes used, but the name matching is based on the URI string and the local part. Your transform references URI/local-part names using your choice of prefixes. Your users' XML documents reference URI/local-part names using their choices of prefixes. The URI/local-part names match regardless of the prefixes used in both. After all, you still want your transform to work even if the users change their minds about their use of namespace prefixes or the default namespace. >>I'm guessing the parser is handling this natively. The XML source >>is located within an international database and it strips prefix >>declarations within the import triggers. :( This is not a sad thing. Provided that they have not lost the fully qualified names by stripping the URI strings, they can choose to use any prefix they want (for elements and attributes) or no prefix (for elements). Your transform doesn't have to change. I hope this helps. . . . . . . . . Ken -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From joewiz at gmail.com Thu Mar 19 11:28:19 2009 From: joewiz at gmail.com (Joe Wicentowski) Date: Thu Mar 19 07:29:07 2009 Subject: [xquery-talk] index-of() behavior Message-ID: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com> Hi all, Can anyone shed some light on the following question? I'm trying to use fn:index-of() to derive the sequential appearance of elements -- in this case, I have 2 elements, and I want index-of() to return the values 1 and 2: { let $content := z z for $child in $content/y let $index := fn:index-of($content/y, $child) return {$index} } I expected this to return: 1 2 but instead it returns: 1 2 1 2 If, on the other hand, I change $content to z1 z2 Then I get my desired result. Shouldn't fn:index-of() index against the unique nodes rather than their text content? I've tested this in eXist 1.3 and in oXygen (using Saxon 9). Thanks, Joe From Geert.Josten at daidalos.nl Thu Mar 19 16:40:05 2009 From: Geert.Josten at daidalos.nl (Geert Josten) Date: Thu Mar 19 07:41:04 2009 Subject: [xquery-talk] index-of() behavior In-Reply-To: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com> Message-ID: <0260356C6DFE754BA6FA48E659A14338248AA5457F@helios.olympus.borgus.nl> Hi Joe, I wouldn't be surprised when index-of() happens to work on atomic values only. I think using the 'at' keyword of the for loop is much easier: for $child at $index in $content/y return {$index} Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Joe Wicentowski > Sent: donderdag 19 maart 2009 16:28 > To: talk@x-query.com > Subject: [xquery-talk] index-of() behavior > > Hi all, > > Can anyone shed some light on the following question? I'm > trying to use fn:index-of() to derive the sequential > appearance of elements -- in this case, I have 2 > elements, and I want index-of() to return the values 1 and 2: > > { > let $content := > > z > z > > for $child in $content/y > let $index := fn:index-of($content/y, $child) return > {$index} > } > > I expected this to return: > > > 1 > 2 > > > but instead it returns: > > > 1 2 > 1 2 > > > If, on the other hand, I change $content to > > > z1 > z2 > > > Then I get my desired result. Shouldn't fn:index-of() index > against the unique nodes rather than their text content? > I've tested this in eXist 1.3 and in oXygen (using Saxon 9). > > Thanks, > Joe > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From mike at saxonica.com Thu Mar 19 15:46:26 2009 From: mike at saxonica.com (Michael Kay) Date: Thu Mar 19 07:47:31 2009 Subject: [xquery-talk] index-of() behavior In-Reply-To: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com> References: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com> Message-ID: <2CF67CB1A3D748EAB6F3725038E1C855@Sealion> index-of() compares items by atomizing them and comparing the atomic values using the eq operator. What you're trying to do could be achieved simply by for $child at $index in $content/y return {$index} but if you want a general function that's like index-of except that it compares using node identity, you could do declare function my:index-by-identity($seq as node()*, $srch as node()) { for $i at $p in $seq where $i is $srch return $p } Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Joe Wicentowski > Sent: 19 March 2009 15:28 > To: talk@x-query.com > Subject: [xquery-talk] index-of() behavior > > Hi all, > > Can anyone shed some light on the following question? I'm > trying to use fn:index-of() to derive the sequential > appearance of elements -- in this case, I have 2 > elements, and I want index-of() to return the values 1 and 2: > > { > let $content := > > z > z > > for $child in $content/y > let $index := fn:index-of($content/y, $child) return > {$index} > } > > I expected this to return: > > > 1 > 2 > > > but instead it returns: > > > 1 2 > 1 2 > > > If, on the other hand, I change $content to > > > z1 > z2 > > > Then I get my desired result. Shouldn't fn:index-of() index > against the unique nodes rather than their text content? > I've tested this in eXist 1.3 and in oXygen (using Saxon 9). > > Thanks, > Joe > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From lists at fgeorges.org Thu Mar 19 15:55:14 2009 From: lists at fgeorges.org (Florent Georges) Date: Thu Mar 19 07:56:05 2009 Subject: [xquery-talk] index-of() behavior In-Reply-To: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com> Message-ID: <535603.1003.qm@web23001.mail.ird.yahoo.com> Joe Wicentowski wrote: > { > let $content := > > z > z > > for $child in $content/y > let $index := fn:index-of($content/y, $child) > return > {$index} > } > I expected this to return: > > 1 > 2 > index-of() compares items by value. If you want to use identity comparison instead, you can write your own function to do that. A simple recursive function is obvious: declare function local:index-of($seq as node()*, $n as node()) as xs:integer* { local:index-of($seq, $n, 1) }; declare function local:index-of($seq as node()*, $n as node(), $i as xs:integer) as xs:integer* { if ( empty($seq) ) then () else if ( $seq[1] is $n ) then ( $i, local:index-of(remove($seq, 1), $n, $i + 1) ) else local:index-of(remove($seq, 1), $n, $i + 1) }; { let $content := z z for $child in $content/y return { local:index-of($content/y, $child) } } results in: 1 2 Hope that helps, -- Florent Georges http://www.fgeorges.org/ From lists at fgeorges.org Thu Mar 19 15:58:44 2009 From: lists at fgeorges.org (Florent Georges) Date: Thu Mar 19 07:59:33 2009 Subject: [xquery-talk] index-of() behavior In-Reply-To: <2CF67CB1A3D748EAB6F3725038E1C855@Sealion> Message-ID: <151418.6064.qm@web23001.mail.ird.yahoo.com> Michael Kay wrote: > declare function my:index-by-identity($seq as node()*, > $srch as node()) { > for $i at $p in $seq where $i is $srch return $p > } Nice! I always forget about the 'at' clause in XQuery, while I always cry because it is not available in XPath... Regards, -- Florent Georges http://www.fgeorges.org/ From joewiz at gmail.com Thu Mar 19 12:12:19 2009 From: joewiz at gmail.com (Joe Wicentowski) Date: Thu Mar 19 08:13:11 2009 Subject: [xquery-talk] index-of() behavior In-Reply-To: <151418.6064.qm@web23001.mail.ird.yahoo.com> References: <2CF67CB1A3D748EAB6F3725038E1C855@Sealion> <151418.6064.qm@web23001.mail.ird.yahoo.com> Message-ID: <2e0234190903190912i63c89a0er5f8999782ba73f2c@mail.gmail.com> Thanks very much, Michael, Geert, and Florent. I hadn't realized that index-of() compared by atomizing. The 'at' clause does the trick! - Joe From joewiz at gmail.com Thu Mar 19 15:05:08 2009 From: joewiz at gmail.com (Joe Wicentowski) Date: Thu Mar 19 11:05:56 2009 Subject: [xquery-talk] index-of() behavior In-Reply-To: <535603.1003.qm@web23001.mail.ird.yahoo.com> References: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com> <535603.1003.qm@web23001.mail.ird.yahoo.com> Message-ID: <2e0234190903191205w55968833p1f99c26bf194224f@mail.gmail.com> An update: I actually used's Florent's function for one of my two cases. What I'm actually doing is processing footnotes (specifically, TEI elements) so they appear inline and at the end of the document. I'm using recursive typeswitching to mimic XSLT. The "at" clause worked for the 2nd case -- where I'm iterating through the all at once, but it didn't work when in the 1st case, where the function was only receiving one at a time. For that case, I needed to step out of the received node and call Florent's functions. Thanks very much, Florent! p.s. In case anyone's interested, here is the "at" clause at work: declare function render:note-end($content, $options) as element() {
{ for $note at $incr in $content//tei:note return if ($note/@type = 'summary') then (: suppress ePub summary notes from being displayed :) () else

{data($note/@n)}  {render:recurse($note, $options)}

}
}; and here is where I call Florent's functions: declare function render:note($node as element(tei:note), $options ) as element() { let $incr := xs:integer(local:index-of($node/ancestor::tei:div[1]//tei:note, $node)) return {data($node/@n)} {data($node/@n)}. {data($node)} }; On Thu, Mar 19, 2009 at 11:55 AM, Florent Georges wrote: > > Joe Wicentowski wrote: > >> { >> let $content := >> ? ? >> ? ? ? ? z >> ? ? ? ? z >> ? ? >> for $child in $content/y >> let $index := fn:index-of($content/y, $child) >> return >> ? ? {$index} >> } > >> I expected this to return: > >> >> ? ?1 >> ? ?2 >> > > ?index-of() compares items by value. ?If you want to use identity comparison instead, you can write your own function to do that. ?A simple recursive function is obvious: > > declare function local:index-of($seq as node()*, $n as node()) > ? ? ?as xs:integer* > { > ? local:index-of($seq, $n, 1) > }; > > declare function local:index-of($seq as node()*, $n as node(), $i as xs:integer) > ? ? ?as xs:integer* > { > ? if ( empty($seq) ) then > ? ? ?() > ? else if ( $seq[1] is $n ) then > ? ? ?( $i, local:index-of(remove($seq, 1), $n, $i + 1) ) > ? else > ? ? ?local:index-of(remove($seq, 1), $n, $i + 1) > }; > > { > ? let $content := > ? ? ? ? ? ? ? ? ? ? ?z > ? ? ? ? ? ? ? ? ? ? ?z > ? ? ? ? ? ? ? ? ? > ? for $child in $content/y > ? return > ? ? ? { local:index-of($content/y, $child) } > } > > > results in: > > > ? 1 > ? 2 > > > ?Hope that helps, > > -- > Florent Georges > http://www.fgeorges.org/ > > > > > > > > > > > > > > > > > > > > > > > > > > From mike at saxonica.com Thu Mar 19 19:38:18 2009 From: mike at saxonica.com (Michael Kay) Date: Thu Mar 19 11:39:23 2009 Subject: [xquery-talk] Tree-walking (was: index-of() behavior) In-Reply-To: <2e0234190903191205w55968833p1f99c26bf194224f@mail.gmail.com> References: <2e0234190903190828l2481c7f4k760bdeaf5c092db@mail.gmail.com><535603.1003.qm@web23001.mail.ird.yahoo.com> <2e0234190903191205w55968833p1f99c26bf194224f@mail.gmail.com> Message-ID: >I'm using recursive typeswitching to mimic XSLT. The XQuery WG decided recently to add higher-order functions to the language, and I've been wondering how this might be used to make recursive tree-walking a less painful process. Clearly it's easy enough to write a higher-order function that walks the tree and applies a supplied (argument) function to each node in the tree, which is a big step forward. Can one go further and apply a different function to each node based on a pattern matching (or type matching) capability? Well, you could pass a set of functions and invoke them all, and each one could do nothing unless the node is one that it is interested in. But that sounds difficult to optimize. To get close to emulating apply-templates, I think you need a function M that maps node-names to functions T, so you pass M to your tree-walking function W, and W when it reaches a node N calls M to obtain the function T corresponding to the node-name of N, and then calls T. (M=mode, T=template). I fear the result would be rather impenetrable to all but Haskell addicts. But perhaps it could be dressed in some syntactic sugar... Michael Kay http://www.saxonica.com/ From lists at fgeorges.org Thu Mar 19 20:38:37 2009 From: lists at fgeorges.org (Florent Georges) Date: Thu Mar 19 12:39:29 2009 Subject: [xquery-talk] Tree-walking (was: index-of() behavior) In-Reply-To: Message-ID: <916551.65450.qm@web23006.mail.ird.yahoo.com> Michael Kay wrote: > To get close to emulating apply-templates, I think you need > a function M that maps node-names to functions T, so you pass > M to your tree-walking function W, and W when it reaches a node > N calls M to obtain the function T corresponding to the node-name > of N, and then calls T. (M=mode, T=template). Very interesting. Except that I would define M as mapping a node (not a node name) to functions, to emulate match patterns. But I guess a general, user-defined function to map from nodes to functions would be less than optimal. I guess I am too much XSLT-oriented, but a set of pairs of match patterns (as defined by XSLT) and function objects sounds reasonable to me: M1 := (("pattern1", T1), ("pattern2", T2), ("pattern3", T3), ...) M2 := (("pattern-a", Ta), ("pattern-b", Tb), ("pattern-c", Tc), ...) One obvious advantage of what you describe is that W is not fixed, and could be defined by the user or by a library, and be reused, instead of having to write it again and again as in XSLT. I thought a few weeks ago that it would be interesting to expose patterns as first-class objects, even in XSLT. It seems this would be an interesting application. Regards, -- Florent Georges http://www.fgeorges.org/ From james.fuller.2007 at gmail.com Sat Mar 21 14:50:56 2009 From: james.fuller.2007 at gmail.com (James Fuller) Date: Sat Mar 21 05:51:59 2009 Subject: [xquery-talk] XML Prague live broadcast Message-ID: Jeni Tennison is on now details here http://www.xmlprague.cz - Jim Fuller From matthias.brantner at 28msec.com Mon Mar 23 11:33:44 2009 From: matthias.brantner at 28msec.com (Matthias Brantner) Date: Mon Mar 23 02:33:30 2009 Subject: [xquery-talk] html serialization Message-ID: <8CD7EF7F-3063-4D43-8725-2473F904FB85@28msec.com> Hello, the HTML specification (http://www.w3.org/TR/html4/) says that div, textarea, and script tags require an end tag to be present. It seems to me that this doesn't allow those tags to be empty element tags (e.g.

Hello, world!

On Thu, Mar 26, 2009 at 12:19 PM, Markus Pilman wrote:> Hi,>>> But world of browsers not divided to IE part & FF part :)> Of course not. At the moment we are redesigning the code. After that,> integrating xqib into another Browser should be done in several hours.> But of course it is not possible to support all browsers at once :-)>> Regards>> Markus>> On Thu, Mar 26, 2009 at 7:55 AM, Vyacheslav Sedov> wrote:>> Hello,>>>> Yep. I note it.>>>> But world of browsers not divided to IE part & FF part :)>>>> i mean here also Safari, Google Chrome & Opera (Opera take about 20% in Russia).>>>> http://www.liveinternet.ru/stat/ru/browsers.html?lang=en>>>> Michael, can i ask why you (or your company) use this *stupid* (sorry>> but it`s true) warning "Notice: This email message, together with any>> attachments, may contain information of BEA Systems, Inc., its>> subsidiaries and affiliated entities, that may be confidential,>> proprietary, copyrighted and/or legally privileged, and is intended>> solely for the use of the individual or entity named in this message.>> If you are not the intended recipient, and have received this message>> in error, please immediately return this by email and then delete it.">>>> Why not end with "and format your HD (twice)"? ;)>>>> This is look like similar warning on wallet - good people can use>> visit card info to return it to you, but thief don`t even read your>> strong warning. Just this look like some kind of mental virus. Or this>> is some kind of advertising? Still not good too.>>>> Why not use something like "Please don`t print this letter without>> need" (i guess this is mental virus too but at least less dangerous).>>>> With best wishes,>> Slav>>>> NOTICE: If you still reading this - don`t worry be happy :)>>>> On Wed, Mar 25, 2009 at 11:39 PM, Michael Reiche>> wrote:>>> > A similar Firefox plugin is under construction.>>>>>> Last line of the message>>>>>>>>>>>> -----Original Message----->>> From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Vyacheslav Sedov>>> Sent: Wednesday, March 25, 2009 12:49 PM>>> To: daniela florescu>>> Cc: talk@x-query.com>>> Subject: Re: [xquery-talk] [ANN] XQuery as a scripting language in IE>>>>>> cool>>>>>> what about other browsers?>>>>>> 2009/3/25 daniela florescu :>>>> Dear all,>>>>>>>> we are happy to announce the public release of XQiB, a plugin for>>>> Internet Explorer which allows the execution of client-side XQuery to>>>> navigate and update the browser's internal DOM. This plugin allows to>>>> execute XQuery in the same way as JavaScript. However, the resulting>>>> code is more elegant because there's no data model mismatch. For>>>> example, opening an alert window that shows the text of the first H1>>>> element of the current site is as simple as that>>>>>>>> declare function local:main() {>>>> browser:alert ( fn:data( ( //H1 )[1] ) ) };>>>>>>>> Note that the browser plugin provides a rich set of functions to>>>> accomplish things as showing alert windows or modifying styles.>>>>>>>> XQiB is based on the Zorba XQuery processor. Specifically, XQiB is an>>>> implementation of the Zorba Store API and implements a set of>>>> browser-specific functions such as the alert function and a variety of>>>> other AJAX functions (e.g., drag & drop, window controls, asynchronous>>>> REST calls, etc.). The implementation of the Store API essentially>>>> encapsulates the browser's DOM and therefore delegates accessor and>>>> updating function calls on the XDM to the DOM.>>>>>>>> Zorba's powerful function library (e.g. REST functions), the>>>> implementation of various XQuery-related specifications (e.g. XQuery>>>> Updating Facility), and a variety of language extensions (e.g. eval)>>>> make it a pleasure to develop rich internet applications.>>>>>>>> If you want to learn more about XQiB, are interested in playing around>>>> with it, or would like to contribute to the project, please visit>>>> http://www.xqib.org/.>>>>>>>> A similar Firefox plugin is under construction.>>>>>>>> The XQIB team>>>>>>>> _______________________________________________>>>> talk@x-query.com>>>> http://x-query.com/mailman/listinfo/talk>>>>>>>>>> _______________________________________________>>> talk@x-query.com>>> http://x-query.com/mailman/listinfo/talk>>>>>> Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.>>>>>>>>>> _______________________________________________>> talk@x-query.com>> http://x-query.com/mailman/listinfo/talk>>> From mpilman at student.ethz.ch Thu Mar 26 15:13:57 2009 From: mpilman at student.ethz.ch (Markus Pilman) Date: Thu Mar 26 06:14:47 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <7ab7cbac0903260429s5dd680dci55de285d756128bb@mail.gmail.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <7ab7cbac0903251248t320336f9vc7cd0922869e2f3@mail.gmail.com> <20090325133930125.00000002076@mreiche05> <7ab7cbac0903252355p54fd6480j3e5b9f7ca9685a77@mail.gmail.com> <60f8b5ce0903260219l208a0884td4ac6d0a169ce8e0@mail.gmail.com> <7ab7cbac0903260429s5dd680dci55de285d756128bb@mail.gmail.com> Message-ID: <60f8b5ce0903260713x24674accq544b9fee8f4ebc3a@mail.gmail.com> Hi Slav, > by the way i can suggest to your team next target - XQuery as > OpenOffice scripting language :) I am sure, there are a lot of use cases for XQuery in applications :-) > i note in sample that element names in XPath is uppercase and don`t > seen default namespace declaration as xhtml, probably it is not good > (i copy sample below) As you have probably noticed, you are not writing a query in the > ? > ? > ? ? ?

Hello, world!

> ? > > > > On Thu, Mar 26, 2009 at 12:19 PM, Markus Pilman wrote: >> Hi, >> >>> But world of browsers not divided to IE part & FF part :) >> Of course not. At the moment we are redesigning the code. After that, >> integrating xqib into another Browser should be done in several hours. >> But of course it is not possible to support all browsers at once :-) >> >> Regards >> >> Markus >> >> On Thu, Mar 26, 2009 at 7:55 AM, Vyacheslav Sedov >> wrote: >>> Hello, >>> >>> Yep. I note it. >>> >>> But world of browsers not divided to IE part & FF part :) >>> >>> i mean here also Safari, Google Chrome & Opera (Opera take about 20% in Russia). >>> >>> http://www.liveinternet.ru/stat/ru/browsers.html?lang=en >>> >>> Michael, can i ask why you (or your company) use this *stupid* (sorry >>> but it`s true) warning "Notice: ?This email message, together with any >>> attachments, may contain information ?of ?BEA Systems, ?Inc., ?its >>> subsidiaries ?and ?affiliated entities, ?that may be confidential, >>> proprietary, ?copyrighted ?and/or legally privileged, and is intended >>> solely for the use of the individual or entity named in this message. >>> If you are not the intended recipient, and have received this message >>> in error, please immediately return this by email and then delete it." >>> >>> Why not end with "and format your HD (twice)"? ;) >>> >>> This is look like similar warning on wallet - good people can use >>> visit card info to return it to you, but thief don`t even read your >>> strong warning. Just this look like some kind of mental virus. Or this >>> is some kind of advertising? Still not good too. >>> >>> Why not use something like "Please don`t print this letter without >>> need" (i guess this is mental virus too but at least less dangerous). >>> >>> With best wishes, >>> Slav >>> >>> NOTICE: If you still reading this - don`t worry be happy :) >>> >>> On Wed, Mar 25, 2009 at 11:39 PM, Michael Reiche >>> wrote: >>>> ?> A similar Firefox plugin is under construction. >>>> >>>> Last line of the message >>>> >>>> >>>> >>>> -----Original Message----- >>>> From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Vyacheslav Sedov >>>> Sent: Wednesday, March 25, 2009 12:49 PM >>>> To: daniela florescu >>>> Cc: talk@x-query.com >>>> Subject: Re: [xquery-talk] [ANN] XQuery as a scripting language in IE >>>> >>>> cool >>>> >>>> what about other browsers? >>>> >>>> 2009/3/25 daniela florescu : >>>>> Dear all, >>>>> >>>>> we are happy to announce the public release of XQiB, ?a plugin for >>>>> Internet Explorer which allows the execution of client-side XQuery to >>>>> navigate and update the browser's internal DOM. This plugin allows to >>>>> execute XQuery in the same way as JavaScript. However, the resulting >>>>> code is more elegant because there's no data model mismatch. For >>>>> example, opening an alert window that shows the text of the first H1 >>>>> element of the current site is as simple as that >>>>> >>>>> declare function local:main() { >>>>> ? browser:alert ( fn:data( ( //H1 )[1] ) ) }; >>>>> >>>>> Note that the browser plugin provides a rich set of functions to >>>>> accomplish things as showing alert windows or modifying styles. >>>>> >>>>> XQiB is based on the Zorba XQuery processor. Specifically, XQiB is an >>>>> implementation of the Zorba Store API and implements a set of >>>>> browser-specific functions such as the alert function and a variety of >>>>> other AJAX functions (e.g., drag & drop, window controls, asynchronous >>>>> REST calls, etc.). The implementation of the Store API essentially >>>>> encapsulates the browser's DOM and therefore delegates accessor and >>>>> updating function calls on the XDM to the DOM. >>>>> >>>>> Zorba's powerful function library (e.g. REST functions), the >>>>> implementation of various XQuery-related specifications (e.g. XQuery >>>>> Updating Facility), and a variety of language extensions (e.g. eval) >>>>> make it a pleasure to develop rich internet applications. >>>>> >>>>> If you want to learn more about XQiB, are interested in playing around >>>>> with it, or would like to contribute to the project, please visit >>>>> http://www.xqib.org/. >>>>> >>>>> A similar Firefox plugin is under construction. >>>>> >>>>> The XQIB team >>>>> >>>>> _______________________________________________ >>>>> talk@x-query.com >>>>> http://x-query.com/mailman/listinfo/talk >>>>> >>>> >>>> _______________________________________________ >>>> talk@x-query.com >>>> http://x-query.com/mailman/listinfo/talk >>>> >>>> Notice: ?This email message, together with any attachments, may contain information ?of ?BEA Systems, ?Inc., ?its subsidiaries ?and ?affiliated entities, ?that may be confidential, ?proprietary, ?copyrighted ?and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. >>>> >>>> >>> >>> _______________________________________________ >>> talk@x-query.com >>> http://x-query.com/mailman/listinfo/talk >>> >> > From adam.retter at googlemail.com Thu Mar 26 15:05:06 2009 From: adam.retter at googlemail.com (Adam Retter) Date: Thu Mar 26 07:05:26 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <60f8b5ce0903260713x24674accq544b9fee8f4ebc3a@mail.gmail.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <7ab7cbac0903251248t320336f9vc7cd0922869e2f3@mail.gmail.com> <20090325133930125.00000002076@mreiche05> <7ab7cbac0903252355p54fd6480j3e5b9f7ca9685a77@mail.gmail.com> <60f8b5ce0903260219l208a0884td4ac6d0a169ce8e0@mail.gmail.com> <7ab7cbac0903260429s5dd680dci55de285d756128bb@mail.gmail.com> <60f8b5ce0903260713x24674accq544b9fee8f4ebc3a@mail.gmail.com> Message-ID: >> by the way i can suggest to your team next target - XQuery as >> OpenOffice scripting language :) > I am sure, there are a lot of use cases for XQuery in applications :-) With my EXQuery hat on - We would love to here about them so that we can make improvements, if you do have use-cases for XQuery Applications, where you have needed additional extensions or features please file them here - http://www.exquery.org/standards/use-cases.xql Unfortunately we are having a temporary problem with that page and the rich text editor in IE (hope to fix it very soon), so if you have Firefox you may find that easier. -- Adam Retter www.exquery.org From adam.retter at googlemail.com Thu Mar 26 15:16:39 2009 From: adam.retter at googlemail.com (Adam Retter) Date: Thu Mar 26 07:17:09 2009 Subject: [xquery-talk] ANN EXQuery Message-ID: We have started an effort called EXQuery http://www.exquery.org to try and increase the portability of XQuery Applications. We believe that a number of additional standards are required to complement W3C XQuery 1.0. If we can develop such standards and get broad vendor adoption then portability should become easier. Our first standardisation project is to look at extension functions for XQuery. Currently many XQuery implementations provide similar extension functionality but through different function signatures, this makes creating portable applications very difficult. If you have previously had to extend XQuery with additional functionality to deliver an application we would love to hear about it. Please submit such use cases here - http://www.exquery.org/standards/use-cases.xql (Note - There is a known problem with the rich-text editor on that page in Internet Explorer, we hope to fix it very soon. If you do wish to submit rich-text, you may find an alternative browser such as Firefox makes this possible). Anyone is welcome to join via. our mailing lists and contribute ideas, suggestions and resources. We also have a core team of experts from within the XQuery community to provide drive, guidance and support for our projects. Thanks Adam -- Adam Retter EXQuery Founder adam.retter@exquery.org http://www.exquery.org From pjcantin at gmail.com Thu Mar 26 10:49:50 2009 From: pjcantin at gmail.com (Philip Cantin) Date: Thu Mar 26 07:50:19 2009 Subject: [xquery-talk] returning elements without duplicates, based on an XML schema and using an attribute as context node Message-ID: Hello All, I am new to this mailing list, as well as fairly new to XQuery and XPath (having learned it for a month or two). For the most part, I haven't had too much trouble editing an old XQuery document, until now. I am trying to access the 'maxOccurs' attribute within the for-loop, where $ref is the 'ref' attribute, and return distinct elements with no duplicate elements. However, I can't seem to set the $max variable properly using XPath functions, without getting an error. I imagine it must have something to do with setting/finding/using the current context. The XQuery code looks like this: if (exists($schema//xs:element[exists(@maxOccurs) and @maxOccurs != '1'])) then ( for $ref in distinct-values($schema//xs:element[exists(@maxOccurs) and @maxOccurs != '1' and @maxOccurs ne 'unbounded']/@ref) let $name := string($ref) let $max := string($ref//following-sibling::maxOccurs) let $index_max := ($max cast as xs:integer) return ) else () }; and the XML schema code looks (very) roughly like this - and the only purpose of showing this is to help illustrate what I'd like to do: Can someone show me the proper way to access the maxOccurs attribute from the ref attribute, and/or provide me with a link that can help me understand this situation a little more? Thanks much in advance! ~PJC -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090326/3c4b0ead/attachment.htm From lists at fgeorges.org Thu Mar 26 16:24:46 2009 From: lists at fgeorges.org (Florent Georges) Date: Thu Mar 26 08:25:14 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> Message-ID: <711025.36483.qm@web23002.mail.ird.yahoo.com> daniela florescu wrote: > we are happy to announce the public release of XQiB Really nice! I like the REST sample. From the source. But it does not work. It freeze for a while, then nothing. I am behind a proxy here, that's maybe the point (depends on Zorba configured to use the same connection settings as IE.) The weather forecast does not work in the same way (city not found, neither as the cities list.) Not sure how I can provide additional info, though. Maybe there is a more appropriated place to report such issues? Great to be able to use XQuery instead of Javascript on the client! Regards, -- Florent Georges http://www.fgeorges.org/ From lists at fgeorges.org Thu Mar 26 16:36:50 2009 From: lists at fgeorges.org (Florent Georges) Date: Thu Mar 26 08:37:17 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <711025.36483.qm@web23002.mail.ird.yahoo.com> Message-ID: <730518.64448.qm@web23006.mail.ird.yahoo.com> Florent Georges wrote: > I like the REST sample. BTW, the examples use type="text/xquery", while the XQuery rec. defines application/xquery, though it seems it has not been accepted by IANA yet: http://www.w3.org/TR/xquery/#id-mime-type Regards, -- Florent Georges http://www.fgeorges.org/ From gfourny at inf.ethz.ch Thu Mar 26 17:41:13 2009 From: gfourny at inf.ethz.ch (Ghislain Fourny) Date: Thu Mar 26 08:41:42 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <7ab7cbac0903252355p54fd6480j3e5b9f7ca9685a77@mail.gmail.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <7ab7cbac0903251248t320336f9vc7cd0922869e2f3@mail.gmail.com> <20090325133930125.00000002076@mreiche05> <7ab7cbac0903252355p54fd6480j3e5b9f7ca9685a77@mail.gmail.com> Message-ID: Hello, You are actually welcome to contribute to the project, especially if you have experience in programming extensions for any browser (IE, Firefox, Safari, Opera, Google Chrome...). There are also other interesting features which could be added, e.g., a debugger. So, if you would like to contribute, your help will be appreciated. Kind regards, Ghislain From mike at saxonica.com Thu Mar 26 16:58:53 2009 From: mike at saxonica.com (Michael Kay) Date: Thu Mar 26 08:59:27 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <711025.36483.qm@web23002.mail.ird.yahoo.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <711025.36483.qm@web23002.mail.ird.yahoo.com> Message-ID: <1D250BCA405F42188F861E128C880A9E@Sealion> > But it does not > work. It freeze for a while, then nothing. I have to say that one reason I quietly dropped the sample applet from Saxon a couple of years ago was that it was so hard to help users with this kind of problem. (That and the fact that the code was simply getting far too bloated.) But I wish the new venture success! Michael Kay http://www.saxonica.com/ From mpilman at student.ethz.ch Thu Mar 26 18:04:14 2009 From: mpilman at student.ethz.ch (Markus Pilman) Date: Thu Mar 26 09:04:58 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <711025.36483.qm@web23002.mail.ird.yahoo.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <711025.36483.qm@web23002.mail.ird.yahoo.com> Message-ID: <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> > I like the REST sample. From the source. But it does not > work. It freeze for a while, then nothing. I am behind a proxy > here, that's maybe the point (depends on Zorba configured to use > the same connection settings as IE.) The weather forecast does > not work in the same way (city not found, neither as the cities > list.) XQiB uses a rest-implementation from zorba which makes use of libcurl. So it ignores browser-configuration and I think it does not work because zorba didn't make use of the proxy. There is already an implementation which uses the XMLHttpRequest from the browser, but that one is not complete. If you need any support, please feel free to write me directly. XQuery-Talk is probably not the appropriate place to discuss xqib issues. > BTW, the examples use type="text/xquery", while the XQuery rec. defines application/xquery, though it seems it has not been accepted by IANA yet: Thanks for that input! Didn't realize that and we have to discuss this internally. Regards Markus On Thu, Mar 26, 2009 at 5:24 PM, Florent Georges wrote: > > daniela florescu wrote: > >> we are happy to announce the public release of XQiB > > ?Really nice! > > ?I like the REST sample. ?From the source. ?But it does not > work. ?It freeze for a while, then nothing. ?I am behind a proxy > here, that's maybe the point (depends on Zorba configured to use > the same connection settings as IE.) ?The weather forecast does > not work in the same way (city not found, neither as the cities > list.) > > ?Not sure how I can provide additional info, though. ?Maybe > there is a more appropriated place to report such issues? > > ?Great to be able to use XQuery instead of Javascript on the > client! ?Regards, > > -- > Florent Georges > http://www.fgeorges.org/ > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From gkholman at CraneSoftwrights.com Thu Mar 26 18:08:08 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Thu Mar 26 09:08:48 2009 Subject: [xquery-talk] returning elements without duplicates, based on an XML schema and using an attribute as context node In-Reply-To: References: Message-ID: <7.0.1.0.2.20090326180517.025aeff0@wheresmymailserver.com> At 2009-03-26 10:49 -0500, Philip Cantin wrote: >I am trying to access the 'maxOccurs' attribute within the for-loop, >where $ref is the 'ref' attribute, and return distinct >elements with no duplicate elements. However, I can't seem to set >the $max variable properly using XPath functions, without getting an >error. I imagine it must have something to do with >setting/finding/using the current context. > > >The XQuery code looks like this: > > >if (exists($schema//xs:element[exists(@maxOccurs) and @maxOccurs != '1'])) >then ( > for $ref in > distinct-values($schema//xs:element[exists(@maxOccurs) and > @maxOccurs != '1' and @maxOccurs ne 'unbounded']/@ref) >... >Can someone show me the proper way to access the maxOccurs attribute >from the ref attribute, $ref/../@maxOccurs >and/or provide me with a link that can help me understand this >situation a little more? All attributes are attached to an element ... the element is the attribute's parent ... "sibling" attributes are attached to the same parent. So the address I gave to you goes to the attribute's parent's attached maxOccurs attribute. I hope this helps. . . . . . . . . . . . Ken -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From mike at saxonica.com Thu Mar 26 17:15:52 2009 From: mike at saxonica.com (Michael Kay) Date: Thu Mar 26 09:16:26 2009 Subject: [xquery-talk] returning elements without duplicates, based on an XML schema and using an attribute as context node In-Reply-To: References: Message-ID: ________________________________ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Philip Cantin Sent: 26 March 2009 15:50 To: talk@x-query.com Subject: [xquery-talk] returning elements without duplicates,based on an XML schema and using an attribute as context node Hello All, I am new to this mailing list, as well as fairly new to XQuery and XPath (having learned it for a month or two). For the most part, I haven't had too much trouble editing an old XQuery document, until now. I am trying to access the 'maxOccurs' attribute within the for-loop, where $ref is the 'ref' attribute, and return distinct elements with no duplicate elements. However, I can't seem to set the $max variable properly using XPath functions, without getting an error. I imagine it must have something to do with setting/finding/using the current context. The XQuery code looks like this: if (exists($schema//xs:element[exists(@maxOccurs) and @maxOccurs != '1'])) ## note the exists(@maxOccurs) is redundant here. @maxOccurs != 1 always returns false if @maxOccurs does not exist. then ( for $ref in distinct-values($schema//xs:element[exists(@maxOccurs) and @maxOccurs != '1' and @maxOccurs ne 'unbounded']/@ref) ## it might be worth using a variable here to save doing the search twice (or writing it twice). ## if your query is schema-aware, then @ref is a QName. Otherwise, it is a string in the lexical form of a QName. Theoretically, you should be looking for unique QNames, not unique strings. let $name := string($ref) let $max := string($ref//following-sibling::maxOccurs) ## This is pretty strange. $ref is an atomic value, so you can't use it on the lhs of "/" or "//". Perhaps you wanted the attribute node? But which attribute node: you're dealing with a group of @ref attributes that have the same value. At this point I'm afraid I'm stuck, because you haven't given any clues about what the query is supposed to do, and it's hard to reverse engineer the requirements from incorrect code. > Can someone show me the proper way to access the maxOccurs attribute from the ref attribute, and/or provide me with a link that can help me understand this situation a little more? If $ref were a ref attribute (which it isn't), then you could get the maxOccurs attribute as $ref/../@maxOccurs Michael Kay http://www.saxonica.com/ From vyacheslav.sedov at gmail.com Thu Mar 26 20:45:36 2009 From: vyacheslav.sedov at gmail.com (Vyacheslav Sedov) Date: Thu Mar 26 09:46:05 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <711025.36483.qm@web23002.mail.ird.yahoo.com> <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> Message-ID: <7ab7cbac0903261045l27234d95q45a0cec4cf247943@mail.gmail.com> I posted feature request to OO to implement possibility to use XQuery as scripting language (in addition to Basic, JavaScript, BeanShell & Python). http://qa.openoffice.org/issues/show_bug.cgi?id=100594 Please vote if you like this idea and stay tuned. By the way - it would be nice to have Bugzilla at XQiB.org. With best wishes, Slav On Thu, Mar 26, 2009 at 8:04 PM, Markus Pilman wrote: >> ?I like the REST sample. ?From the source. ?But it does not >> work. ?It freeze for a while, then nothing. ?I am behind a proxy >> here, that's maybe the point (depends on Zorba configured to use >> the same connection settings as IE.) ?The weather forecast does >> not work in the same way (city not found, neither as the cities >> list.) > XQiB uses a rest-implementation from zorba which makes use of libcurl. > So it ignores browser-configuration and I think it does not work > because zorba didn't make use of the proxy. There is already an > implementation which uses the XMLHttpRequest from the browser, but > that one is not complete. > If you need any support, please feel free to write me directly. > XQuery-Talk is probably not the appropriate place to discuss xqib > issues. > >> BTW, the examples use type="text/xquery", while the XQuery rec. defines application/xquery, though it seems it has not been accepted by IANA yet: > Thanks for that input! Didn't realize that and we have to discuss this > internally. > > Regards > > Markus > > On Thu, Mar 26, 2009 at 5:24 PM, Florent Georges wrote: >> >> daniela florescu wrote: >> >>> we are happy to announce the public release of XQiB >> >> ?Really nice! >> >> ?I like the REST sample. ?From the source. ?But it does not >> work. ?It freeze for a while, then nothing. ?I am behind a proxy >> here, that's maybe the point (depends on Zorba configured to use >> the same connection settings as IE.) ?The weather forecast does >> not work in the same way (city not found, neither as the cities >> list.) >> >> ?Not sure how I can provide additional info, though. ?Maybe >> there is a more appropriated place to report such issues? >> >> ?Great to be able to use XQuery instead of Javascript on the >> client! ?Regards, >> >> -- >> Florent Georges >> http://www.fgeorges.org/ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From pjcantin at gmail.com Thu Mar 26 13:12:44 2009 From: pjcantin at gmail.com (Philip Cantin) Date: Thu Mar 26 10:13:14 2009 Subject: [xquery-talk] returning elements without duplicates, based on an XML schema and using an attribute as context node Message-ID: Michael and Ken, Thanks a bunch for your responses and help! Michael, I'll try and illustrate a bit better what I was trying to do earlier. I want the XQuery to determine if the @maxOccurs attribute exists in an tag somewhere in the schema, and its value isn't 1. If this is true, then, for all elements that have a @ref attribute in the schema (because we now know there's at least one), the XQuery should get the string value of the element's @ref attribute (what I wanted $name to be), along with the value of element's @maxOccurs attribute (what i wanted $max to be), and lastly the string value of $max (what I wanted $index_max to be). Then finally, I just wanted to use these three values within an tag that was to be returned. Also, I wanted to respond to few of your comments: ## note the exists(@maxOccurs) is redundant here. @maxOccurs != 1 always returns false if @maxOccurs does not exist. ## it might be worth using a variable here to save doing the search twice (or writing it twice). ---Thanks for the advice; at the moment I was going for getting the query to work first, and optimization second, but I'll definitely change these things once everything works the way it should. ## if your query is schema-aware, then @ref is a QName. Otherwise, it is a string in the lexical form of a QName. Theoretically, you should be looking for unique QNames, not unique strings. ---When you say the "query is schema-aware," are you referring to the editor I am using to process the query (I'm using Altova XMLSpy), or the actual query itself? ## This is pretty strange. $ref is an atomic value, so you can't use it on the lhs of "/" or "//". Perhaps you wanted the attribute node? But which attribute node: you're dealing with a group of @ref attributes that have the same value. If $ref were a ref attribute (which it isn't), then you could get the maxOccurs attribute as $ref/../@maxOccurs ---Yes, I knew that code was completely incorrect. I was attempting to show you the direction I wanted to go with my XPath expression, which was to find the 'maxOccurs' attribute in an element based on where the 'ref' attribute within the same element was. ~PJC On Thu, Mar 26, 2009 at 12:15 PM, Michael Kay wrote: ______________________________ > > __ > > From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On > Behalf Of Philip Cantin > Sent: 26 March 2009 15:50 > To: talk@x-query.com > Subject: [xquery-talk] returning elements without duplicates,based > on an XML schema and using an attribute as context node > > > Hello All, > > I am new to this mailing list, as well as fairly new to XQuery and > XPath (having learned it for a month or two). For the most part, I haven't > had too much trouble editing an old XQuery document, until now. > > I am trying to access the 'maxOccurs' attribute within the for-loop, > where $ref is the 'ref' attribute, and return distinct elements > with no duplicate elements. However, I can't seem to set the $max variable > properly using XPath functions, without getting an error. I imagine it must > have something to do with setting/finding/using the current context. > > > The XQuery code looks like this: > > > if (exists($schema//xs:element[exists(@maxOccurs) and @maxOccurs != > '1'])) > > ## note the exists(@maxOccurs) is redundant here. @maxOccurs != 1 always > returns false if @maxOccurs does not exist. > > then ( > for $ref in > distinct-values($schema//xs:element[exists(@maxOccurs) and @maxOccurs != > '1' > and @maxOccurs ne 'unbounded']/@ref) > > ## it might be worth using a variable here to save doing the search twice > (or writing it twice). > > ## if your query is schema-aware, then @ref is a QName. Otherwise, it is a > string in the lexical form of a QName. Theoretically, you should be looking > for unique QNames, not unique strings. > > let $name := string($ref) > let $max := string($ref//following-sibling::maxOccurs) > > ## This is pretty strange. $ref is an atomic value, so you can't use it on > the lhs of "/" or "//". Perhaps you wanted the attribute node? But which > attribute node: you're dealing with a group of @ref attributes that have > the > same value. > > At this point I'm afraid I'm stuck, because you haven't given any clues > about what the query is supposed to do, and it's hard to reverse engineer > the requirements from incorrect code. > > > Can someone show me the proper way to access the maxOccurs > attribute > from the ref attribute, and/or provide me with a link that can help me > understand this situation a little more? > > > If $ref were a ref attribute (which it isn't), then you could get the > maxOccurs attribute as $ref/../@maxOccurs > > Michael Kay > http://www.saxonica.com/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090326/5469080e/attachment.htm From mike at saxonica.com Thu Mar 26 18:51:22 2009 From: mike at saxonica.com (Michael Kay) Date: Thu Mar 26 10:51:53 2009 Subject: [xquery-talk] returning elements without duplicates, based on an XML schema and using an attribute as context node In-Reply-To: References: Message-ID: <7F365A94801E4C7F92AEB6E4C4E02083@Sealion> I want the XQuery to determine if the @maxOccurs attribute exists in an tag somewhere in the schema, and its value isn't 1. If this is true, then, for all elements that have a @ref attribute in the schema (because we now know there's at least one), the XQuery should get the string value of the element's @ref attribute (what I wanted $name to be), along with the value of element's @maxOccurs attribute (what i wanted $max to be), and lastly the string value of $max (what I wanted $index_max to be). Then finally, I just wanted to use these three values within an tag that was to be returned. That translates to me as: if (//xs:element[@maxOccurs[.!="1"]]) then for $e in //xs:element[@ref] return else () I can't really see where the distinct-values() comes into it - it doesn't appear in your English description. Michael Kay http://www.saxonica.com/ From dflorescu at mac.com Thu Mar 26 12:16:37 2009 From: dflorescu at mac.com (daniela florescu) Date: Thu Mar 26 11:17:10 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <7ab7cbac0903261045l27234d95q45a0cec4cf247943@mail.gmail.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <711025.36483.qm@web23002.mail.ird.yahoo.com> <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> <7ab7cbac0903261045l27234d95q45a0cec4cf247943@mail.gmail.com> Message-ID: Slav, That's a great idea. Thanks. A more general question: in which other environments would people like to have XQuery accessible and they don't (iphone, windowsmobile, etc, etc) ? Any suggestions are welcome ! Thanks Dana On Mar 26, 2009, at 10:45 AM, Vyacheslav Sedov wrote: > I posted feature request to OO to implement possibility to use XQuery > as scripting language (in addition to Basic, JavaScript, BeanShell & > Python). > > http://qa.openoffice.org/issues/show_bug.cgi?id=100594 > > Please vote if you like this idea and stay tuned. By the way - it > would be nice to have Bugzilla at XQiB.org. > > With best wishes, > Slav > > On Thu, Mar 26, 2009 at 8:04 PM, Markus Pilman > wrote: >>> I like the REST sample. From the source. But it does not >>> work. It freeze for a while, then nothing. I am behind a proxy >>> here, that's maybe the point (depends on Zorba configured to use >>> the same connection settings as IE.) The weather forecast does >>> not work in the same way (city not found, neither as the cities >>> list.) >> XQiB uses a rest-implementation from zorba which makes use of >> libcurl. >> So it ignores browser-configuration and I think it does not work >> because zorba didn't make use of the proxy. There is already an >> implementation which uses the XMLHttpRequest from the browser, but >> that one is not complete. >> If you need any support, please feel free to write me directly. >> XQuery-Talk is probably not the appropriate place to discuss xqib >> issues. >> >>> BTW, the examples use type="text/xquery", while the XQuery rec. >>> defines application/xquery, though it seems it has not been >>> accepted by IANA yet: >> Thanks for that input! Didn't realize that and we have to discuss >> this >> internally. >> >> Regards >> >> Markus >> >> On Thu, Mar 26, 2009 at 5:24 PM, Florent Georges >> wrote: >>> >>> daniela florescu wrote: >>> >>>> we are happy to announce the public release of XQiB >>> >>> Really nice! >>> >>> I like the REST sample. From the source. But it does not >>> work. It freeze for a while, then nothing. I am behind a proxy >>> here, that's maybe the point (depends on Zorba configured to use >>> the same connection settings as IE.) The weather forecast does >>> not work in the same way (city not found, neither as the cities >>> list.) >>> >>> Not sure how I can provide additional info, though. Maybe >>> there is a more appropriated place to report such issues? >>> >>> Great to be able to use XQuery instead of Javascript on the >>> client! Regards, >>> >>> -- >>> Florent Georges >>> http://www.fgeorges.org/ >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> talk@x-query.com >>> http://x-query.com/mailman/listinfo/talk >>> >> >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> From pjcantin at gmail.com Thu Mar 26 14:37:44 2009 From: pjcantin at gmail.com (Philip Cantin) Date: Thu Mar 26 11:38:19 2009 Subject: [xquery-talk] returning elements without duplicates, based on an XML schema and using an attribute as context node In-Reply-To: <7F365A94801E4C7F92AEB6E4C4E02083@Sealion> References: <7F365A94801E4C7F92AEB6E4C4E02083@Sealion> Message-ID: Michael, Oh, yes...I forgot to mention earlier: I'd like no two element tags to be the same; that's why I was using the distinct-values() function. ~PJC On Thu, Mar 26, 2009 at 1:51 PM, Michael Kay wrote: > > I want the XQuery to determine if the @maxOccurs attribute exists in > an tag somewhere in the schema, and its value isn't 1. If this > is true, then, for all elements that have a @ref attribute in the schema > (because we now know there's at least one), the XQuery should get the > string > value of the element's @ref attribute (what I wanted $name to be), along > with the value of element's @maxOccurs attribute (what i wanted $max to > be), > and lastly the string value of $max (what I wanted $index_max to be). Then > finally, I just wanted to use these three values within an tag > that was to be returned. > > > That translates to me as: > > if (//xs:element[@maxOccurs[.!="1"]]) > then for $e in //xs:element[@ref] > return id="{$e/@ref}-add-trigger" > nodeset="instance('views')/{$e/@ref}-add-trigger" > > relevant="instance('save-data')//{$e/@ref}[{$e/@maxOccurs}]"/> > else () > > I can't really see where the distinct-values() comes into it - it doesn't > appear in your English description. > > Michael Kay > http://www.saxonica.com/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090326/6243ef9f/attachment-0001.htm From howardk at fatdog.com Thu Mar 26 12:47:24 2009 From: howardk at fatdog.com (Howard Katz) Date: Thu Mar 26 11:47:54 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com><711025.36483.qm@web23002.mail.ird.yahoo.com><60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com><7ab7cbac0903261045l27234d95q45a0cec4cf247943@mail.gmail.com> Message-ID: <275E28841A5441C98A92D7DEBD6949FB@HOWARDM> iPhone! I just had to write a fairly complex SAX-type parser on the iPhone because XQuery isn't supported; it probably took me ten times longer than it would have using XQuery. I'm suspecting that the iPhone team decided not to move the Mac's native XQuery support onto the device because of memory constraints. Howard > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of daniela florescu > Sent: Thursday, March 26, 2009 12:17 PM > To: Vyacheslav Sedov > Cc: talk@x-query.com > Subject: Re: [xquery-talk] [ANN] XQuery as a scripting language in IE > > Slav, > > That's a great idea. Thanks. > > A more general question: in which other environments > would people like to have XQuery accessible and they > don't (iphone, windowsmobile, etc, etc) ? > > Any suggestions are welcome ! > > Thanks > Dana > > > > On Mar 26, 2009, at 10:45 AM, Vyacheslav Sedov wrote: > > > I posted feature request to OO to implement possibility to > use XQuery > > as scripting language (in addition to Basic, JavaScript, > BeanShell & > > Python). > > > > http://qa.openoffice.org/issues/show_bug.cgi?id=100594 > > > > Please vote if you like this idea and stay tuned. By the way - it > > would be nice to have Bugzilla at XQiB.org. > > > > With best wishes, > > Slav > > > > On Thu, Mar 26, 2009 at 8:04 PM, Markus Pilman > > > wrote: > >>> I like the REST sample. From the source. But it does not > >>> work. It freeze for a while, then nothing. I am behind a proxy > >>> here, that's maybe the point (depends on Zorba configured to use > >>> the same connection settings as IE.) The weather forecast does > >>> not work in the same way (city not found, neither as the cities > >>> list.) > >> XQiB uses a rest-implementation from zorba which makes use of > >> libcurl. > >> So it ignores browser-configuration and I think it does not work > >> because zorba didn't make use of the proxy. There is already an > >> implementation which uses the XMLHttpRequest from the browser, but > >> that one is not complete. > >> If you need any support, please feel free to write me directly. > >> XQuery-Talk is probably not the appropriate place to discuss xqib > >> issues. > >> > >>> BTW, the examples use type="text/xquery", while the XQuery rec. > >>> defines application/xquery, though it seems it has not been > >>> accepted by IANA yet: > >> Thanks for that input! Didn't realize that and we have to > discuss > >> this > >> internally. > >> > >> Regards > >> > >> Markus > >> > >> On Thu, Mar 26, 2009 at 5:24 PM, Florent Georges > >> wrote: > >>> > >>> daniela florescu wrote: > >>> > >>>> we are happy to announce the public release of XQiB > >>> > >>> Really nice! > >>> > >>> I like the REST sample. From the source. But it does not > >>> work. It freeze for a while, then nothing. I am behind a proxy > >>> here, that's maybe the point (depends on Zorba configured to use > >>> the same connection settings as IE.) The weather forecast does > >>> not work in the same way (city not found, neither as the cities > >>> list.) > >>> > >>> Not sure how I can provide additional info, though. Maybe > >>> there is a more appropriated place to report such issues? > >>> > >>> Great to be able to use XQuery instead of Javascript on the > >>> client! Regards, > >>> > >>> -- > >>> Florent Georges > >>> http://www.fgeorges.org/ > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> _______________________________________________ > >>> talk@x-query.com > >>> http://x-query.com/mailman/listinfo/talk > >>> > >> > >> _______________________________________________ > >> talk@x-query.com > >> http://x-query.com/mailman/listinfo/talk > >> > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From dflorescu at mac.com Thu Mar 26 13:41:39 2009 From: dflorescu at mac.com (daniela florescu) Date: Thu Mar 26 12:42:14 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <275E28841A5441C98A92D7DEBD6949FB@HOWARDM> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <711025.36483.qm@web23002.mail.ird.yahoo.com> <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> <7ab7cbac0903261045l27234d95q45a0cec4cf247943@mail.gmail.com> <275E28841A5441C98A92D7DEBD6949FB@HOWARDM> Message-ID: <64122B3A-AF65-42F8-8FDF-5E0C1E817B90@mac.com> > Mac's native XQuery support Howard, May I ask a potentially stupid question here: does Mac has native XQuery support ? Could you send a pointer? Thanks Dana > onto the device because of memory > constraints. > > Howard > >> -----Original Message----- >> From: talk-bounces@x-query.com >> [mailto:talk-bounces@x-query.com] On Behalf Of daniela florescu >> Sent: Thursday, March 26, 2009 12:17 PM >> To: Vyacheslav Sedov >> Cc: talk@x-query.com >> Subject: Re: [xquery-talk] [ANN] XQuery as a scripting language in IE >> >> Slav, >> >> That's a great idea. Thanks. >> >> A more general question: in which other environments >> would people like to have XQuery accessible and they >> don't (iphone, windowsmobile, etc, etc) ? >> >> Any suggestions are welcome ! >> >> Thanks >> Dana >> >> >> >> On Mar 26, 2009, at 10:45 AM, Vyacheslav Sedov wrote: >> >>> I posted feature request to OO to implement possibility to >> use XQuery >>> as scripting language (in addition to Basic, JavaScript, >> BeanShell & >>> Python). >>> >>> http://qa.openoffice.org/issues/show_bug.cgi?id=100594 >>> >>> Please vote if you like this idea and stay tuned. By the way - it >>> would be nice to have Bugzilla at XQiB.org. >>> >>> With best wishes, >>> Slav >>> >>> On Thu, Mar 26, 2009 at 8:04 PM, Markus Pilman >> >>> wrote: >>>>> I like the REST sample. From the source. But it does not >>>>> work. It freeze for a while, then nothing. I am behind a proxy >>>>> here, that's maybe the point (depends on Zorba configured to use >>>>> the same connection settings as IE.) The weather forecast does >>>>> not work in the same way (city not found, neither as the cities >>>>> list.) >>>> XQiB uses a rest-implementation from zorba which makes use of >>>> libcurl. >>>> So it ignores browser-configuration and I think it does not work >>>> because zorba didn't make use of the proxy. There is already an >>>> implementation which uses the XMLHttpRequest from the browser, but >>>> that one is not complete. >>>> If you need any support, please feel free to write me directly. >>>> XQuery-Talk is probably not the appropriate place to discuss xqib >>>> issues. >>>> >>>>> BTW, the examples use type="text/xquery", while the XQuery rec. >>>>> defines application/xquery, though it seems it has not been >>>>> accepted by IANA yet: >>>> Thanks for that input! Didn't realize that and we have to >> discuss >>>> this >>>> internally. >>>> >>>> Regards >>>> >>>> Markus >>>> >>>> On Thu, Mar 26, 2009 at 5:24 PM, Florent Georges >>>> wrote: >>>>> >>>>> daniela florescu wrote: >>>>> >>>>>> we are happy to announce the public release of XQiB >>>>> >>>>> Really nice! >>>>> >>>>> I like the REST sample. From the source. But it does not >>>>> work. It freeze for a while, then nothing. I am behind a proxy >>>>> here, that's maybe the point (depends on Zorba configured to use >>>>> the same connection settings as IE.) The weather forecast does >>>>> not work in the same way (city not found, neither as the cities >>>>> list.) >>>>> >>>>> Not sure how I can provide additional info, though. Maybe >>>>> there is a more appropriated place to report such issues? >>>>> >>>>> Great to be able to use XQuery instead of Javascript on the >>>>> client! Regards, >>>>> >>>>> -- >>>>> Florent Georges >>>>> http://www.fgeorges.org/ >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> talk@x-query.com >>>>> http://x-query.com/mailman/listinfo/talk >>>>> >>>> >>>> _______________________________________________ >>>> talk@x-query.com >>>> http://x-query.com/mailman/listinfo/talk >>>> >> >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From gfourny at inf.ethz.ch Thu Mar 26 17:55:05 2009 From: gfourny at inf.ethz.ch (Ghislain Fourny) Date: Thu Mar 26 13:11:24 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <7ab7cbac0903260429s5dd680dci55de285d756128bb@mail.gmail.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <7ab7cbac0903251248t320336f9vc7cd0922869e2f3@mail.gmail.com> <20090325133930125.00000002076@mreiche05> <7ab7cbac0903252355p54fd6480j3e5b9f7ca9685a77@mail.gmail.com> <60f8b5ce0903260219l208a0884td4ac6d0a169ce8e0@mail.gmail.com> <7ab7cbac0903260429s5dd680dci55de285d756128bb@mail.gmail.com> Message-ID: <757F855B-65E9-42C2-9DC5-7DA664BC71F5@inf.ethz.ch> Hi Slav, Yes, JavaScript and XQuery can work together on the same page. They can interact with one another through the DOM. This allows you to use existing JavaScript code, e.g., to program mash-ups, without having to completely rewrite this code with XQuery. Kind regards, Ghislain > can js and xquery safely be mixed at one page? From lists at fgeorges.org Thu Mar 26 22:51:26 2009 From: lists at fgeorges.org (Florent Georges) Date: Thu Mar 26 14:51:52 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> Message-ID: <207281.13842.qm@web23002.mail.ird.yahoo.com> Markus Pilman wrote: Hi, > There is already an implementation which uses the XMLHttpRequest > from the browser, but that one is not complete. Good news. > If you need any support, please feel free to write me directly. Well, I am just having a look and evaluating the integration. I must admit this is so nice to have a look at the sources and see XQuery instead of Javascript! I will if I have any question or if I find bugs. I really like the idea! Good luck to implement that support for other browsers ;-) Regards, -- Florent Georges http://www.fgeorges.org/ From alain.couthures at agencexml.com Fri Mar 27 09:59:02 2009 From: alain.couthures at agencexml.com (COUTHURES Alain) Date: Fri Mar 27 00:58:34 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE Message-ID: <49CC9556.5040803@agencexml.com> Hello, I also think that XQuery can be very nice at client-side, especially with XForms. I already looked at Zorba... When a plug-in is necessary, it means that public use is a problem and that version management is difficult. My project named XSLTForms is a client-side implementation of XForms based on XSLT and Javascript. For this, I had to write XPath expression analysis with XSLT 1.0 only. It's complex but didn't required more than few days. The result is a sort of compiled expression easy be to executed by Javascript. Surprisingly, the XSLT transformation is fast and the generated Javascript is light. XSLT 1.0 and Javascript are well supported and stable in recent browsers such as IE, FireFox, Opera and Safari/Chrome. I don't like to have to wait for editors to implement recommendations and some of them prefer invent new "revolutionary" stuff instead... Let me add that this architecture (XSLT transformation then generated Javascript code execution) permit people to easily add the specific functions they could require. Version 1.0 of XSLTForms has to be released before implementing XQuery instruction analysis in it but I now think it's possible without too many difficulties (I would have liked a reasonable XML notation for XQuery...). As XSLTForms is already an opensource project, contributors are welcome to join ! Alain COUTHURES Bordeaux, France XForms for browsers without plug-in : http://www.agencexml.com/xsltforms From mike at saxonica.com Fri Mar 27 09:46:25 2009 From: mike at saxonica.com (Michael Kay) Date: Fri Mar 27 01:45:55 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <49CC9556.5040803@agencexml.com> References: <49CC9556.5040803@agencexml.com> Message-ID: <0605BA82590447D09FD3405A7BAFBF99@Sealion> > I would have liked a reasonable XML notation for XQuery... I think this requirement will keep coming up. It's frankly embarrassing that in XProc, queries have to be escaped as CDATA. If we solved this problem, all sorts of opportunities would open up - XQuery used for assertions in XSD, XSD schemas embedded in XQuery modules, XQuery embedded in XSLT, XSLT embedded in XQuery, XQuery embedded in XForms. Michael Kay http://www.saxonica.com/ From alain.couthures at agencexml.com Fri Mar 27 10:59:32 2009 From: alain.couthures at agencexml.com (COUTHURES Alain) Date: Fri Mar 27 01:59:02 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <0605BA82590447D09FD3405A7BAFBF99@Sealion> References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> Message-ID: <49CCA384.4080908@agencexml.com> Hello Michael, Thank you for your answer. Because a recommendation needs a long time to be published, as soon as I will write my own XRX application, I will add to my XML script engine "tXs" (something in between XProc and the XSLT machine shown at XML Prague) my own XML notation for XQuery. I will publish it then... Regards, Alain COUTHURES Bordeaux, France XForms for browsers without plug-in : http://www.agencexml.com/xsltforms Michael Kay a ?crit : >> I would have liked a reasonable XML notation for XQuery... >> > > I think this requirement will keep coming up. It's frankly embarrassing that > in XProc, queries have to be escaped as CDATA. If we solved this problem, > all sorts of opportunities would open up - XQuery used for assertions in > XSD, XSD schemas embedded in XQuery modules, XQuery embedded in XSLT, XSLT > embedded in XQuery, XQuery embedded in XForms. > > Michael Kay > http://www.saxonica.com/ > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090327/25a2e766/attachment.htm From vyacheslav.sedov at gmail.com Fri Mar 27 13:04:41 2009 From: vyacheslav.sedov at gmail.com (Vyacheslav Sedov) Date: Fri Mar 27 02:03:41 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <0605BA82590447D09FD3405A7BAFBF99@Sealion> References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> Message-ID: <7ab7cbac0903270304k1513970fi1d84324acf718f7@mail.gmail.com> > I would have liked a reasonable XML notation for XQuery... did you mean XQueryX (http://www.w3.org/TR/xqueryx/) By the way - is it possible to have in xquery function similar to XSLT`s doc(' ') which return XSLT itself, but for XQuery best case is to return this in XML form - XQueryX)? With best wishes, Slav On Fri, Mar 27, 2009 at 12:46 PM, Michael Kay wrote: >> I would have liked a reasonable XML notation for XQuery... > > I think this requirement will keep coming up. It's frankly embarrassing that > in XProc, queries have to be escaped as CDATA. If we solved this problem, > all sorts of opportunities would open up - XQuery used for assertions in > XSD, XSD schemas embedded in XQuery modules, XQuery embedded in XSLT, XSLT > embedded in XQuery, XQuery embedded in XForms. > > Michael Kay > http://www.saxonica.com/ > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From gfourny at inf.ethz.ch Fri Mar 27 11:08:50 2009 From: gfourny at inf.ethz.ch (Ghislain Fourny) Date: Fri Mar 27 02:08:15 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <0605BA82590447D09FD3405A7BAFBF99@Sealion> References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> Message-ID: <943E4EB1-6E0E-4D62-9006-31E3215A3844@inf.ethz.ch> Hello Michael, The same issue arises when one uses XQuery server-side code together with XQuery client-side code: either the XQuery application server has to serialise the content of the script tag as a CDATA section instead of escaping special characters, or the browser/plug-in should decode entity references before executing the script (in the latter case, the query is not easy to read). Kind regards, Ghislain > > I think this requirement will keep coming up. It's frankly > embarrassing that > in XProc, queries have to be escaped as CDATA. If we solved this > problem, > all sorts of opportunities would open up - XQuery used for > assertions in > XSD, XSD schemas embedded in XQuery modules, XQuery embedded in > XSLT, XSLT > embedded in XQuery, XQuery embedded in XForms. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090327/0334dd07/attachment.htm From alain.couthures at agencexml.com Fri Mar 27 11:13:37 2009 From: alain.couthures at agencexml.com (COUTHURES Alain) Date: Fri Mar 27 02:13:07 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <7ab7cbac0903270304k1513970fi1d84324acf718f7@mail.gmail.com> References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> <7ab7cbac0903270304k1513970fi1d84324acf718f7@mail.gmail.com> Message-ID: <49CCA6D1.2070809@agencexml.com> Hello Vyacheslav, >> I would have liked a reasonable XML notation for XQuery... >> > > did you mean XQueryX (http://www.w3.org/TR/xqueryx/ I'm afraid XQueryX is just a notation for machines not for human beings because each and every expression is represented in a tree notation and developers just can't write it themselves. A smart IDE could do it... Regards, Alain COUTHURES Bordeaux, France XForms for browsers without plug-in : http://www.agencexml.com/xsltforms -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090327/d8785841/attachment-0001.htm From mike at saxonica.com Fri Mar 27 10:49:59 2009 From: mike at saxonica.com (Michael Kay) Date: Fri Mar 27 02:49:28 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <49CCA384.4080908@agencexml.com> References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> <49CCA384.4080908@agencexml.com> Message-ID: <26E501CA7E9A44038451EBF288FF0D64@Sealion> > Because a recommendation needs a long time to be published, as soon as I will write my own XRX application, I will add to my XML script engine "tXs" (something in between XProc and the XSLT machine shown at XML Prague) my own XML notation for XQuery. I will publish it then... Perhaps this should be a project for EXQuery. I suspect your chances of getting everyone to accept your design are much better if you have a forum for consultation rather than trying to present it as a fait accompli - even if you do a magnificent job of the design, other people might have different use cases. I think there are three possible styles of XML representation: (a) one that looks as much as possible like current human-readable XQuery. This is largely a question of changing the rules for escaping of special characters such as the "<" and "<<" operators, and preventing people writing non-XML things like }"/> which are currently legal but rather useless. (b) one that uses a bit more XML markup, e.g. giving an alternative XML-based syntax for prolog declarations like "import schema" and for function signatures. (c) the full (non-human-readable) fine-grained XQueryX syntax. Since we already have (c), I think the main requirement is probably for something like (a) (though (b) would give benefits if people want a compromise between human-readability and software-readability). One of the challenges is in defining how the in-scope namespaces from the containing XML document should affect the static context of the query. Michael Kay http://www.saxonica.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090327/50952522/attachment.htm From lists at fgeorges.org Fri Mar 27 13:27:29 2009 From: lists at fgeorges.org (Florent Georges) Date: Fri Mar 27 05:28:14 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <26E501CA7E9A44038451EBF288FF0D64@Sealion> Message-ID: <182884.70830.qm@web23001.mail.ird.yahoo.com> Michael Kay wrote: >> I will add to my XML script engine "tXs" [...] my own XML >> notation for XQuery. > Perhaps this should be a project for EXQuery. Yes, I think so. > I think there are three possible styles of XML representation: > (a) one that looks as much as possible like current > human-readable XQuery. Yes, I think this one could be more than useful, in particular for pipeline languages. What a pity that such a definition does not exist yet, so it could have been used by XProc. Too late now... > One of the challenges is in defining how the in-scope > namespaces from the containing XML document should affect the > static context of the query. Funny, I wouldn't have thought of that one. To integrate smoothly with an XML document, I would say the static context should inherit the in-scope namespace bindings from the element the query is embedded into (with "declare namespace" having higher precedence.) Of course, experience accumulated by languages like XPL in Orbeon is of great help here. For the challenges part, I would think more about rewriting XQuery grammar production rules. Regards, -- Florent Georges http://www.fgeorges.org/ From alain.couthures at agencexml.com Fri Mar 27 14:33:05 2009 From: alain.couthures at agencexml.com (COUTHURES Alain) Date: Fri Mar 27 05:34:03 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <26E501CA7E9A44038451EBF288FF0D64@Sealion> References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> <49CCA384.4080908@agencexml.com> <26E501CA7E9A44038451EBF288FF0D64@Sealion> Message-ID: <49CCD591.4040504@agencexml.com> Thank you again, Michael, for your response. > Perhaps this should be a project for EXQuery. Good idea ! > I suspect your chances of getting everyone to accept your design are > much better if you have a forum for consultation rather than trying to > present it as a fait accompli - even if you do a magnificent job of > the design, other people might have different use cases. Yes, you're right. > > I think there are three possible styles of XML representation: > > (a) one that looks as much as possible like current human-readable > XQuery. This is largely a question of changing the rules for escaping > of special characters such as the "<" and "<<" operators, and > preventing people writing non-XML things like }"/> which are currently legal but rather useless. > > (b) one that uses a bit more XML markup, e.g. giving an alternative > XML-based syntax for prolog declarations like "import schema" and for > function signatures. > > (c) the full (non-human-readable) fine-grained XQueryX syntax. > > Since we already have (c), I think the main requirement is probably > for something like (a) (though (b) would give benefits if people want > a compromise between human-readability and software-readability). In my point of view, benefits with (a) would be less than with (b). Grammar analysis is much easier with XML markup. I would like XQuery XML notation to be at the same level as XSLT. > > One of the challenges is in defining how the in-scope namespaces from > the containing XML document should affect the static context of the query. Thank you also for this remark ! Regards, Alain COUTHURES Bordeaux, France XForms for browsers without plug-in : http://www.agencexml.com/xsltforms -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090327/778d2a2c/attachment.htm From davidc at nag.co.uk Fri Mar 27 14:08:45 2009 From: davidc at nag.co.uk (David Carlisle) Date: Fri Mar 27 06:09:37 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <49CCD591.4040504@agencexml.com> (message from COUTHURES Alain on Fri, 27 Mar 2009 14:33:05 +0100) References: <49CC9556.5040803@agencexml.com> <0605BA82590447D09FD3405A7BAFBF99@Sealion> <49CCA384.4080908@agencexml.com> <26E501CA7E9A44038451EBF288FF0D64@Sealion> <49CCD591.4040504@agencexml.com> Message-ID: <200903271408.n2RE8ji6003346@edinburgh.nag.co.uk> > I would like XQuery XML notation to be at the same level as XSLT. If you make it look too much like xslt then essentially it is XSLT since it's the same programming model, with (then) the same syntax. This is explictly what xq2xml did http://monet.nag.co.uk/xq2xml/ But I agree it would be good to aim for something with xslt inspired xml syntax for top level declarations, but using xquery (rather than xslt) inspired syntax for expressions (so you can go /b with element constructors and path expressions mixed) David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ From howardk at fatdog.com Fri Mar 27 07:52:38 2009 From: howardk at fatdog.com (Howard Katz) Date: Fri Mar 27 06:53:32 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <64122B3A-AF65-42F8-8FDF-5E0C1E817B90@mac.com> References: <15CFB06B-F7CC-4EEE-AFBF-1ECCF66CC8B3@mac.com> <711025.36483.qm@web23002.mail.ird.yahoo.com> <60f8b5ce0903261004u5004ca55s8888a2592175ed4@mail.gmail.com> <7ab7cbac0903261045l27234d95q45a0cec4cf247943@mail.gmail.com> <275E28841A5441C98A92D7DEBD6949FB@HOWARDM> <64122B3A-AF65-42F8-8FDF-5E0C1E817B90@mac.com> Message-ID: <2C58CBBA94BF4C7B9B4E53EDFE3CA118@HOWARDM> Hi Dana, Not potentially stupid at all. This is probably as good a place to start as any other: http://tinyurl.com/dfyko5 Ta, Howard > -----Original Message----- > From: daniela florescu [mailto:dflorescu@mac.com] > Sent: Thursday, March 26, 2009 1:42 PM > To: Howard Katz > Cc: talk@x-query.com > Subject: Re: [xquery-talk] [ANN] XQuery as a scripting language in IE > > > Mac's native XQuery support > > Howard, > > May I ask a potentially stupid question here: > does Mac has native XQuery support ? > > Could you send a pointer? > > Thanks > Dana > > > > > > onto the device because of memory > > constraints. > > > > Howard > > > >> -----Original Message----- > >> From: talk-bounces@x-query.com > >> [mailto:talk-bounces@x-query.com] On Behalf Of daniela florescu > >> Sent: Thursday, March 26, 2009 12:17 PM > >> To: Vyacheslav Sedov > >> Cc: talk@x-query.com > >> Subject: Re: [xquery-talk] [ANN] XQuery as a scripting > language in IE > >> > >> Slav, > >> > >> That's a great idea. Thanks. > >> > >> A more general question: in which other environments > >> would people like to have XQuery accessible and they > >> don't (iphone, windowsmobile, etc, etc) ? > >> > >> Any suggestions are welcome ! > >> > >> Thanks > >> Dana > >> > >> > >> > >> On Mar 26, 2009, at 10:45 AM, Vyacheslav Sedov wrote: > >> > >>> I posted feature request to OO to implement possibility to > >> use XQuery > >>> as scripting language (in addition to Basic, JavaScript, > >> BeanShell & > >>> Python). > >>> > >>> http://qa.openoffice.org/issues/show_bug.cgi?id=100594 > >>> > >>> Please vote if you like this idea and stay tuned. By the way - it > >>> would be nice to have Bugzilla at XQiB.org. > >>> > >>> With best wishes, > >>> Slav > >>> > >>> On Thu, Mar 26, 2009 at 8:04 PM, Markus Pilman > >> >>>> wrote: > >>>>> I like the REST sample. From the source. But it does not > >>>>> work. It freeze for a while, then nothing. I am > behind a proxy > >>>>> here, that's maybe the point (depends on Zorba > configured to use > >>>>> the same connection settings as IE.) The weather forecast does > >>>>> not work in the same way (city not found, neither as the cities > >>>>> list.) > >>>> XQiB uses a rest-implementation from zorba which makes use of > >>>> libcurl. > >>>> So it ignores browser-configuration and I think it does not work > >>>> because zorba didn't make use of the proxy. There is already an > >>>> implementation which uses the XMLHttpRequest from the > browser, but > >>>> that one is not complete. > >>>> If you need any support, please feel free to write me directly. > >>>> XQuery-Talk is probably not the appropriate place to > discuss xqib > >>>> issues. > >>>> > >>>>> BTW, the examples use type="text/xquery", while the XQuery rec. > >>>>> defines application/xquery, though it seems it has not been > >>>>> accepted by IANA yet: > >>>> Thanks for that input! Didn't realize that and we have to > >> discuss > >>>> this > >>>> internally. > >>>> > >>>> Regards > >>>> > >>>> Markus > >>>> > >>>> On Thu, Mar 26, 2009 at 5:24 PM, Florent Georges > >>>> wrote: > >>>>> > >>>>> daniela florescu wrote: > >>>>> > >>>>>> we are happy to announce the public release of XQiB > >>>>> > >>>>> Really nice! > >>>>> > >>>>> I like the REST sample. From the source. But it does not > >>>>> work. It freeze for a while, then nothing. I am > behind a proxy > >>>>> here, that's maybe the point (depends on Zorba > configured to use > >>>>> the same connection settings as IE.) The weather forecast does > >>>>> not work in the same way (city not found, neither as the cities > >>>>> list.) > >>>>> > >>>>> Not sure how I can provide additional info, though. Maybe > >>>>> there is a more appropriated place to report such issues? > >>>>> > >>>>> Great to be able to use XQuery instead of Javascript on the > >>>>> client! Regards, > >>>>> > >>>>> -- > >>>>> Florent Georges > >>>>> http://www.fgeorges.org/ > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> _______________________________________________ > >>>>> talk@x-query.com > >>>>> http://x-query.com/mailman/listinfo/talk > >>>>> > >>>> > >>>> _______________________________________________ > >>>> talk@x-query.com > >>>> http://x-query.com/mailman/listinfo/talk > >>>> > >> > >> _______________________________________________ > >> talk@x-query.com > >> http://x-query.com/mailman/listinfo/talk > >> > > > > _______________________________________________ > > talk@x-query.com > > http://x-query.com/mailman/listinfo/talk > From lists at fgeorges.org Fri Mar 27 15:05:02 2009 From: lists at fgeorges.org (Florent Georges) Date: Fri Mar 27 07:06:00 2009 Subject: [xquery-talk] [ANN] XQuery as a scripting language in IE In-Reply-To: <49CCD591.4040504@agencexml.com> Message-ID: <490002.8028.qm@web23006.mail.ird.yahoo.com> COUTHURES Alain wrote: > > I think there are three possible styles of XML > > representation: > > (a) one that looks as much as possible like current > > human-readable XQuery. [...] > > (b) one that uses a bit more XML markup, e.g. giving an > > alternative XML-based syntax for prolog declarations like > > "import schema" and for function signatures. [...] > In my point of view, benefits with (a) would be less than with > (b). Grammar analysis is much easier with XML markup. I would > like XQuery XML notation to be at the same level as XSLT. Well, as David said this would then be mostly XSLT. And if the aim is to ease machine processing we have XQueryX (and David's xq2xml.) I think (a) had been more cruelly missing to integrate queries in XML documents (for XML pipelines, to wrap queries to send to a database, to write queries in an application config file, etc.) Do you have any precise example for (b)? Regards, -- Florent Georges http://www.fgeorges.org/ From dsewell at virginia.edu Fri Mar 27 14:31:41 2009 From: dsewell at virginia.edu (David Sewell) Date: Fri Mar 27 10:32:32 2009 Subject: [xquery-talk] Question on expected XQuery return per standards Message-ID: Over on another list there has been a discussion of unexpected results from an XQuery like the following. The issues are how the parser interprets, in particular, the abbreviated syntax '//' and '[N]' as an equivalent to '[position() eq N]'. My belief is that the standard requires that two nodes (p2, p4) should be returned for result sets 1-4 below, because the interpretation of the XPath should in each case be identical. Set 5, on the other hand, should return only p2. We're seeing different behavior from a couple of XML parsers. Anyone care to read from the stone tablets on this one? (: begin query :) let $xml :=

p1

p2

p3

p4

return ( { $xml/descendant-or-self::node()/p[position() eq 2] }, { $xml//p[position() eq 2] }, { $xml/descendant-or-self::node()/p[2] }, { $xml//p[2] }, { $xml/descendant::p[2] } ) (: end query :) David S. -- David Sewell, Editorial and Technical Manager ROTUNDA, The University of Virginia Press PO Box 801079, Charlottesville, VA 22904-4318 USA Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 Email: dsewell@virginia.edu Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/ From dsewell at virginia.edu Fri Mar 27 14:34:38 2009 From: dsewell at virginia.edu (David Sewell) Date: Fri Mar 27 10:35:27 2009 Subject: Correction: Re: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: Message-ID: "We're seeing different behavior from a couple of XML parsers." I mean "XQuery parsers", sorry. On Fri, 27 Mar 2009, David Sewell wrote: > Over on another list there has been a discussion of unexpected results > from an XQuery like the following. The issues are how the parser > interprets, in particular, the abbreviated syntax '//' and '[N]' as an > equivalent to '[position() eq N]'. > > My belief is that the standard requires that two nodes (p2, p4) should > be returned for result sets 1-4 below, because the interpretation of the > XPath should in each case be identical. Set 5, on the other hand, should > return only p2. > > We're seeing different behavior from a couple of XML parsers. Anyone > care to read from the stone tablets on this one? > > (: begin query :) > > let $xml := > >
>

p1

>

p2

>
>
>

p3

>

p4

>
>
> > return ( > { $xml/descendant-or-self::node()/p[position() eq 2] }, > { $xml//p[position() eq 2] }, > { $xml/descendant-or-self::node()/p[2] }, > { $xml//p[2] }, > { $xml/descendant::p[2] } > ) > > (: end query :) > > David S. > > -- David Sewell, Editorial and Technical Manager ROTUNDA, The University of Virginia Press PO Box 801079, Charlottesville, VA 22904-4318 USA Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 Email: dsewell@virginia.edu Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/ From mike at saxonica.com Fri Mar 27 18:57:43 2009 From: mike at saxonica.com (Michael Kay) Date: Fri Mar 27 10:58:37 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: Message-ID: <1A9AFA8C7E834F6A8BC02DCED5FBB8D0@Sealion> > My belief is that the standard requires that two nodes (p2, > p4) should be returned for result sets 1-4 below, because the > interpretation of the XPath should in each case be identical. > Set 5, on the other hand, should return only p2. Yes, you're right. Anything else is a bug. I'm surprised - I thought cases like this were pretty thoroughly covered in the XQuery test suite. Michael Kay http://www.saxonica.com/ > > We're seeing different behavior from a couple of XML parsers. > Anyone care to read from the stone tablets on this one? > > (: begin query :) > > let $xml := > >
>

p1

>

p2

>
>
>

p3

>

p4

>
>
> > return ( > { $xml/descendant-or-self::node()/p[position() eq 2] }, > { $xml//p[position() eq 2] }, > { $xml/descendant-or-self::node()/p[2] }, > { $xml//p[2] }, > { $xml/descendant::p[2] } > ) > > (: end query :) > > David S. > > -- > David Sewell, Editorial and Technical Manager ROTUNDA, The > University of Virginia Press PO Box 801079, Charlottesville, > VA 22904-4318 USA > Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 > Email: dsewell@virginia.edu Tel: +1 434 924 9973 > Web: http://rotunda.upress.virginia.edu/ > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From gkholman at CraneSoftwrights.com Fri Mar 27 20:00:28 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Fri Mar 27 11:02:10 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: Message-ID: <7.0.1.0.2.20090327195308.026caf58@wheresmymailserver.com> At 2009-03-27 14:31 -0400, David Sewell wrote: >Over on another list there has been a discussion of unexpected results >from an XQuery like the following. The issues are how the parser >interprets, in particular, the abbreviated syntax '//' and '[N]' as an >equivalent to '[position() eq N]'. > >My belief is that the standard requires that two nodes (p2, p4) should >be returned for result sets 1-4 below, because the interpretation of the >XPath should in each case be identical. Yes, because "//" is a step abbreviation (it isn't an axis abbreviation) and because when the data type of a predicate is numeric that is an abbreviation for position()=. >Set 5, on the other hand, should return only p2. Agreed. >We're seeing different behavior from a couple of XML parsers. Anyone >care to read from the stone tablets on this one? Quoting chapter and verse, http://www.w3.org/TR/xpath20/ section 3.2 explains the "//" abbreviation found at the start of an expression, and cites section 3.2.4 for the use of the non-initial "//" abbreviation. And you are lucky because there is a note in 3.2.4(3) that states: "The path expression //para[1] does not mean the same as the path expression /descendant::para[1]. The latter selects the first descendant para element; the former selects all descendant para elements that are the first para children of their respective parents." ... which should help you categorically explain the result to an implementation that is returning something different than two items for the first four sets and one item for the last set. I hope this helps. . . . . . . . . . . Ken >(: begin query :) > >let $xml := > >
>

p1

>

p2

>
>
>

p3

>

p4

>
>
> >return ( > { $xml/descendant-or-self::node()/p[position() eq 2] }, > { $xml//p[position() eq 2] }, > { $xml/descendant-or-self::node()/p[2] }, > { $xml//p[2] }, > { $xml/descendant::p[2] } >) > >(: end query :) -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From rpbourret at rpbourret.com Fri Mar 27 12:06:54 2009 From: rpbourret at rpbourret.com (Ronald Bourret) Date: Fri Mar 27 11:07:42 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: Message-ID: <49CD23CE.4040804@rpbourret.com> Hmmm. I would have thought that, in each case, only p2 is returned. According to the spec, "For each item in the input sequence, the predicate expression is evaluated using an inner focus, defined as follows: The context item is the item currently being tested against the predicate. The context size is the number of items in the input sequence. The context position is the position of the context item within the input sequence." In each case, the input sequence is the result of $xml//p, which is a sequence of four p elements. Since the position is the position within this sequence, only p2 is in the second position. But I'm sure I could be wrong... -- Ron David Sewell wrote: > Over on another list there has been a discussion of unexpected results > from an XQuery like the following. The issues are how the parser > interprets, in particular, the abbreviated syntax '//' and '[N]' as an > equivalent to '[position() eq N]'. > > My belief is that the standard requires that two nodes (p2, p4) should > be returned for result sets 1-4 below, because the interpretation of the > XPath should in each case be identical. Set 5, on the other hand, should > return only p2. > > We're seeing different behavior from a couple of XML parsers. Anyone > care to read from the stone tablets on this one? > > (: begin query :) > > let $xml := > >
>

p1

>

p2

>
>
>

p3

>

p4

>
>
> > return ( > { $xml/descendant-or-self::node()/p[position() eq 2] }, > { $xml//p[position() eq 2] }, > { $xml/descendant-or-self::node()/p[2] }, > { $xml//p[2] }, > { $xml/descendant::p[2] } > ) > > (: end query :) > > David S. > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.238 / Virus Database: 270.11.30/2026 - Release Date: 03/27/09 07:13:00 > From vyacheslav.sedov at gmail.com Fri Mar 27 22:27:36 2009 From: vyacheslav.sedov at gmail.com (Vyacheslav Sedov) Date: Fri Mar 27 11:28:25 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <49CD23CE.4040804@rpbourret.com> References: <49CD23CE.4040804@rpbourret.com> Message-ID: <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> exist 1.2.5 - set 4 is same as set 5 :( anybody can check 1.3? i did not get yet latest 1.3 from svn Also would be helpful same info about Marklogic. 2Ronald for your case you can use brackets { ($xml//p)[2] } With best wishes, Slav On Fri, Mar 27, 2009 at 10:06 PM, Ronald Bourret wrote: > Hmmm. I would have thought that, in each case, only p2 is returned. > > According to the spec, "For each item in the input sequence, the predicate > expression is evaluated using an inner focus, defined as follows: The > context item is the item currently being tested against the predicate. The > context size is the number of items in the input sequence. The context > position is the position of the context item within the input sequence." > > In each case, the input sequence is the result of $xml//p, which is a > sequence of four p elements. Since the position is the position within this > sequence, only p2 is in the second position. > > But I'm sure I could be wrong... > > -- Ron > > David Sewell wrote: >> >> Over on another list there has been a discussion of unexpected results >> from an XQuery like the following. The issues are how the parser >> interprets, in particular, the abbreviated syntax '//' and '[N]' as an >> equivalent to '[position() eq N]'. >> >> My belief is that the standard requires that two nodes (p2, p4) should >> be returned for result sets 1-4 below, because the interpretation of the >> XPath should in each case be identical. Set 5, on the other hand, should >> return only p2. >> >> We're seeing different behavior from a couple of XML parsers. Anyone >> care to read from the stone tablets on this one? >> >> (: begin query :) >> >> let $xml := >> ? >> ? ?
>> ? ? ?

p1

>> ? ? ?

p2

>> ? ?
>> ? ?
>> ? ? ?

p3

>> ? ? ?

p4

>> ? ?
>> ?
>> >> return ( >> ?{ $xml/descendant-or-self::node()/p[position() eq 2] }, >> ?{ $xml//p[position() eq 2] }, >> ?{ $xml/descendant-or-self::node()/p[2] }, >> ?{ $xml//p[2] }, >> ?{ $xml/descendant::p[2] } >> ) >> >> (: end query :) >> >> David S. >> >> >> >> ------------------------------------------------------------------------ >> >> >> No virus found in this incoming message. >> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: >> 270.11.30/2026 - Release Date: 03/27/09 07:13:00 >> > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From wolfgang at exist-db.org Fri Mar 27 20:33:04 2009 From: wolfgang at exist-db.org (Wolfgang) Date: Fri Mar 27 11:33:54 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> References: <49CD23CE.4040804@rpbourret.com> <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> Message-ID: <49CD29F0.2020902@exist-db.org> > exist 1.2.5 - set 4 is same as set 5 :( > anybody can check 1.3? I already noticed this as a bug and will take care of it. Thanks for the test. Wolfgang From dsewell at virginia.edu Fri Mar 27 15:35:25 2009 From: dsewell at virginia.edu (David Sewell) Date: Fri Mar 27 11:36:14 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> References: <49CD23CE.4040804@rpbourret.com> <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> Message-ID: For MarkLogic (4.0-4), sets 1 and 2 return the same as set 5 (only p2). In other words, [position() eq 2] is parsed differently from [2]. Before filing a bug report I wanted more input, as this seems to be an area where informed people disagree about the standard. So I'm temporarily resisting my default behavior of assuming that whatever Michael Kay says must be true. :-) David On Fri, 27 Mar 2009, Vyacheslav Sedov wrote: > exist 1.2.5 - set 4 is same as set 5 :( > anybody can check 1.3? > i did not get yet latest 1.3 from svn > Also would be helpful same info about Marklogic. > > 2Ronald for your case you can use brackets { ($xml//p)[2] } > > With best wishes, > Slav > > On Fri, Mar 27, 2009 at 10:06 PM, Ronald Bourret > wrote: > > Hmmm. I would have thought that, in each case, only p2 is returned. > > > > According to the spec, "For each item in the input sequence, the predicate > > expression is evaluated using an inner focus, defined as follows: The > > context item is the item currently being tested against the predicate. The > > context size is the number of items in the input sequence. The context > > position is the position of the context item within the input sequence." > > > > In each case, the input sequence is the result of $xml//p, which is a > > sequence of four p elements. Since the position is the position within this > > sequence, only p2 is in the second position. > > > > But I'm sure I could be wrong... > > > > -- Ron > > > > David Sewell wrote: > >> > >> Over on another list there has been a discussion of unexpected results > >> from an XQuery like the following. The issues are how the parser > >> interprets, in particular, the abbreviated syntax '//' and '[N]' as an > >> equivalent to '[position() eq N]'. > >> > >> My belief is that the standard requires that two nodes (p2, p4) should > >> be returned for result sets 1-4 below, because the interpretation of the > >> XPath should in each case be identical. Set 5, on the other hand, should > >> return only p2. > >> > >> We're seeing different behavior from a couple of XML parsers. Anyone > >> care to read from the stone tablets on this one? > >> > >> (: begin query :) > >> > >> let $xml := > >> ? > >> ? ?
> >> ? ? ?

p1

> >> ? ? ?

p2

> >> ? ?
> >> ? ?
> >> ? ? ?

p3

> >> ? ? ?

p4

> >> ? ?
> >> ?
> >> > >> return ( > >> ?{ $xml/descendant-or-self::node()/p[position() eq 2] }, > >> ?{ $xml//p[position() eq 2] }, > >> ?{ $xml/descendant-or-self::node()/p[2] }, > >> ?{ $xml//p[2] }, > >> ?{ $xml/descendant::p[2] } > >> ) > >> > >> (: end query :) > >> > >> David S. > >> > >> > >> > >> ------------------------------------------------------------------------ > >> > >> > >> No virus found in this incoming message. > >> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: > >> 270.11.30/2026 - Release Date: 03/27/09 07:13:00 > >> > > _______________________________________________ > > talk@x-query.com > > http://x-query.com/mailman/listinfo/talk > > > -- David Sewell, Editorial and Technical Manager ROTUNDA, The University of Virginia Press PO Box 801079, Charlottesville, VA 22904-4318 USA Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 Email: dsewell@virginia.edu Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/ From vyacheslav.sedov at gmail.com Fri Mar 27 22:46:45 2009 From: vyacheslav.sedov at gmail.com (Vyacheslav Sedov) Date: Fri Mar 27 11:47:35 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: <49CD23CE.4040804@rpbourret.com> <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> Message-ID: <7ab7cbac0903271246n7f31565bv9660e4b99193f2ae@mail.gmail.com> ML 4.0-4 in 3.2 compatibility mode? try (1,2,3,4,5)[2 to 3] if no error and result is 2 3 then better not care about it - it in history. On Fri, Mar 27, 2009 at 10:35 PM, David Sewell wrote: > For MarkLogic (4.0-4), sets 1 and 2 return the same as set 5 (only p2). > In other words, [position() eq 2] is parsed differently from [2]. > > Before filing a bug report I wanted more input, as this seems to be an > area where informed people disagree about the standard. So I'm > temporarily resisting my default behavior of assuming that whatever > Michael Kay says must be true. :-) > > David > > On Fri, 27 Mar 2009, Vyacheslav Sedov wrote: > >> exist 1.2.5 - set 4 is same as set 5 :( >> anybody can check 1.3? >> i did not get yet latest 1.3 from svn >> Also would be helpful same info about Marklogic. >> >> 2Ronald for your case you can use brackets { ($xml//p)[2] } >> >> With best wishes, >> Slav >> >> On Fri, Mar 27, 2009 at 10:06 PM, Ronald Bourret >> wrote: >> > Hmmm. I would have thought that, in each case, only p2 is returned. >> > >> > According to the spec, "For each item in the input sequence, the predicate >> > expression is evaluated using an inner focus, defined as follows: The >> > context item is the item currently being tested against the predicate. The >> > context size is the number of items in the input sequence. The context >> > position is the position of the context item within the input sequence." >> > >> > In each case, the input sequence is the result of $xml//p, which is a >> > sequence of four p elements. Since the position is the position within this >> > sequence, only p2 is in the second position. >> > >> > But I'm sure I could be wrong... >> > >> > -- Ron >> > >> > David Sewell wrote: >> >> >> >> Over on another list there has been a discussion of unexpected results >> >> from an XQuery like the following. The issues are how the parser >> >> interprets, in particular, the abbreviated syntax '//' and '[N]' as an >> >> equivalent to '[position() eq N]'. >> >> >> >> My belief is that the standard requires that two nodes (p2, p4) should >> >> be returned for result sets 1-4 below, because the interpretation of the >> >> XPath should in each case be identical. Set 5, on the other hand, should >> >> return only p2. >> >> >> >> We're seeing different behavior from a couple of XML parsers. Anyone >> >> care to read from the stone tablets on this one? >> >> >> >> (: begin query :) >> >> >> >> let $xml := >> >> ? >> >> ? ?
>> >> ? ? ?

p1

>> >> ? ? ?

p2

>> >> ? ?
>> >> ? ?
>> >> ? ? ?

p3

>> >> ? ? ?

p4

>> >> ? ?
>> >> ?
>> >> >> >> return ( >> >> ?{ $xml/descendant-or-self::node()/p[position() eq 2] }, >> >> ?{ $xml//p[position() eq 2] }, >> >> ?{ $xml/descendant-or-self::node()/p[2] }, >> >> ?{ $xml//p[2] }, >> >> ?{ $xml/descendant::p[2] } >> >> ) >> >> >> >> (: end query :) >> >> >> >> David S. >> >> >> >> >> >> >> >> ------------------------------------------------------------------------ >> >> >> >> >> >> No virus found in this incoming message. >> >> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: >> >> 270.11.30/2026 - Release Date: 03/27/09 07:13:00 >> >> >> > _______________________________________________ >> > talk@x-query.com >> > http://x-query.com/mailman/listinfo/talk >> > >> > > -- > David Sewell, Editorial and Technical Manager > ROTUNDA, The University of Virginia Press > PO Box 801079, Charlottesville, VA 22904-4318 USA > Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 > Email: dsewell@virginia.edu ? Tel: +1 434 924 9973 > Web: http://rotunda.upress.virginia.edu/ From int19h at gmail.com Fri Mar 27 12:48:28 2009 From: int19h at gmail.com (Pavel Minaev) Date: Fri Mar 27 11:49:31 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <49CD23CE.4040804@rpbourret.com> References: <49CD23CE.4040804@rpbourret.com> Message-ID: On Fri, Mar 27, 2009 at 12:06 PM, Ronald Bourret wrote: > Hmmm. I would have thought that, in each case, only p2 is returned. > > According to the spec, "For each item in the input sequence, the predicate > expression is evaluated using an inner focus, defined as follows: The > context item is the item currently being tested against the predicate. The > context size is the number of items in the input sequence. The context > position is the position of the context item within the input sequence." > > In each case, the input sequence is the result of $xml//p, which is a > sequence of four p elements. Since the position is the position within this > sequence, only p2 is in the second position. But it isn't. The standard is very clear that $xml//p expands to $xml/descendant-or-self::node()/p. The ordering is also very clear: "Each non-initial occurrence of "//" in a path expression is expanded as described in 3.2.4 Abbreviated Syntax, leaving a sequence of steps separated by "/". This sequence of steps is then evaluated from left to right." and, obviously, in $xml/descendant-or-self::node()/p[2], 2 is the position within the sequence of child nodes of the parent of p, not the expression as a whole. From dsewell at virginia.edu Fri Mar 27 15:52:03 2009 From: dsewell at virginia.edu (David Sewell) Date: Fri Mar 27 11:52:52 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <7ab7cbac0903271246n7f31565bv9660e4b99193f2ae@mail.gmail.com> References: <49CD23CE.4040804@rpbourret.com> <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> <7ab7cbac0903271246n7f31565bv9660e4b99193f2ae@mail.gmail.com> Message-ID: No, it's in ML 4.0-4 in strict XQuery 1.0 mode as well. On Fri, 27 Mar 2009, Vyacheslav Sedov wrote: > ML 4.0-4 in 3.2 compatibility mode? try (1,2,3,4,5)[2 to 3] > if no error and result is 2 3 then better not care about it - it in history. > > On Fri, Mar 27, 2009 at 10:35 PM, David Sewell wrote: > > For MarkLogic (4.0-4), sets 1 and 2 return the same as set 5 (only p2). > > In other words, [position() eq 2] is parsed differently from [2]. > > > > Before filing a bug report I wanted more input, as this seems to be an > > area where informed people disagree about the standard. So I'm > > temporarily resisting my default behavior of assuming that whatever > > Michael Kay says must be true. :-) > > > > David > > > > On Fri, 27 Mar 2009, Vyacheslav Sedov wrote: > > > >> exist 1.2.5 - set 4 is same as set 5 :( > >> anybody can check 1.3? > >> i did not get yet latest 1.3 from svn > >> Also would be helpful same info about Marklogic. > >> > >> 2Ronald for your case you can use brackets { ($xml//p)[2] } > >> > >> With best wishes, > >> Slav > >> > >> On Fri, Mar 27, 2009 at 10:06 PM, Ronald Bourret > >> wrote: > >> > Hmmm. I would have thought that, in each case, only p2 is returned. > >> > > >> > According to the spec, "For each item in the input sequence, the predicate > >> > expression is evaluated using an inner focus, defined as follows: The > >> > context item is the item currently being tested against the predicate. The > >> > context size is the number of items in the input sequence. The context > >> > position is the position of the context item within the input sequence." > >> > > >> > In each case, the input sequence is the result of $xml//p, which is a > >> > sequence of four p elements. Since the position is the position within this > >> > sequence, only p2 is in the second position. > >> > > >> > But I'm sure I could be wrong... > >> > > >> > -- Ron > >> > > >> > David Sewell wrote: > >> >> > >> >> Over on another list there has been a discussion of unexpected results > >> >> from an XQuery like the following. The issues are how the parser > >> >> interprets, in particular, the abbreviated syntax '//' and '[N]' as an > >> >> equivalent to '[position() eq N]'. > >> >> > >> >> My belief is that the standard requires that two nodes (p2, p4) should > >> >> be returned for result sets 1-4 below, because the interpretation of the > >> >> XPath should in each case be identical. Set 5, on the other hand, should > >> >> return only p2. > >> >> > >> >> We're seeing different behavior from a couple of XML parsers. Anyone > >> >> care to read from the stone tablets on this one? > >> >> > >> >> (: begin query :) > >> >> > >> >> let $xml := > >> >> ? > >> >> ? ?
> >> >> ? ? ?

p1

> >> >> ? ? ?

p2

> >> >> ? ?
> >> >> ? ?
> >> >> ? ? ?

p3

> >> >> ? ? ?

p4

> >> >> ? ?
> >> >> ?
> >> >> > >> >> return ( > >> >> ?{ $xml/descendant-or-self::node()/p[position() eq 2] }, > >> >> ?{ $xml//p[position() eq 2] }, > >> >> ?{ $xml/descendant-or-self::node()/p[2] }, > >> >> ?{ $xml//p[2] }, > >> >> ?{ $xml/descendant::p[2] } > >> >> ) > >> >> > >> >> (: end query :) > >> >> > >> >> David S. > >> >> > >> >> > >> >> > >> >> ------------------------------------------------------------------------ > >> >> > >> >> > >> >> No virus found in this incoming message. > >> >> Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: > >> >> 270.11.30/2026 - Release Date: 03/27/09 07:13:00 > >> >> > >> > _______________________________________________ > >> > talk@x-query.com > >> > http://x-query.com/mailman/listinfo/talk > >> > > >> > > > > -- > > David Sewell, Editorial and Technical Manager > > ROTUNDA, The University of Virginia Press > > PO Box 801079, Charlottesville, VA 22904-4318 USA > > Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 > > Email: dsewell@virginia.edu ? Tel: +1 434 924 9973 > > Web: http://rotunda.upress.virginia.edu/ > -- David Sewell, Editorial and Technical Manager ROTUNDA, The University of Virginia Press PO Box 801079, Charlottesville, VA 22904-4318 USA Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 Email: dsewell@virginia.edu Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/ From gkholman at CraneSoftwrights.com Fri Mar 27 20:53:15 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Fri Mar 27 11:54:47 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: <49CD23CE.4040804@rpbourret.com> <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> Message-ID: <7.0.1.0.2.20090327205138.026cb118@wheresmymailserver.com> At 2009-03-27 15:35 -0400, David Sewell wrote: >For MarkLogic (4.0-4), sets 1 and 2 return the same as set 5 (only p2). >In other words, [position() eq 2] is parsed differently from [2]. But 3.2.2(1) reads: "If the value of the predicate expression is a singleton atomic value of a numeric type or derived from a numeric type, the predicate truth value is true if the value of the predicate expression is equal (by the eq operator) to the context position, and is false otherwise. [Definition: A predicate whose predicate expression returns a numeric type is called a numeric predicate.] >Before filing a bug report I wanted more input, as this seems to be an >area where informed people disagree about the standard. So I'm >temporarily resisting my default behavior of assuming that whatever >Michael Kay says must be true. :-) :{)} But that is always a good place to start! . . . . . . . . . . Ken -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From rpbourret at rpbourret.com Fri Mar 27 13:52:58 2009 From: rpbourret at rpbourret.com (Ronald Bourret) Date: Fri Mar 27 12:53:46 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: <49CD23CE.4040804@rpbourret.com> Message-ID: <49CD3CAA.7070305@rpbourret.com> Pavel Minaev wrote: > On Fri, Mar 27, 2009 at 12:06 PM, Ronald Bourret > wrote: >> Hmmm. I would have thought that, in each case, only p2 is returned. >> >> According to the spec, "For each item in the input sequence, the predicate >> expression is evaluated using an inner focus, defined as follows: The >> context item is the item currently being tested against the predicate. The >> context size is the number of items in the input sequence. The context >> position is the position of the context item within the input sequence." >> >> In each case, the input sequence is the result of $xml//p, which is a >> sequence of four p elements. Since the position is the position within this >> sequence, only p2 is in the second position. > > But it isn't. The standard is very clear that $xml//p expands to > $xml/descendant-or-self::node()/p. The ordering is also very clear: > > "Each non-initial occurrence of "//" in a path expression is > expanded as described in 3.2.4 Abbreviated Syntax, leaving a sequence > of steps separated by "/". This sequence of steps is then evaluated > from left to right." > > and, obviously, in $xml/descendant-or-self::node()/p[2], 2 is the > position within the sequence of child nodes of the parent of p, not > the expression as a whole. Thanks for the clarification. I had to think about it a bit -- the parent isn't obviously involved until you realize that the parent is a descendant of $xml -- but that now makes sense. -- Ron From christian.gruen at gmail.com Sat Mar 28 07:38:54 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Fri Mar 27 22:39:41 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <49CD3CAA.7070305@rpbourret.com> References: <49CD23CE.4040804@rpbourret.com> <49CD3CAA.7070305@rpbourret.com> Message-ID: >> But it isn't. The standard is very clear that $xml//p expands to >> $xml/descendant-or-self::node()/p. The ordering is also very clear: Just to add: I observed that this rule regularly causes irritations when teaching XPath/XQuery, as many users assume that the two slashes can be dissolved to a single descendant step, which actually works fine - as long as no position predicates are involved. Christian ___________________________ Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen From Geert.Josten at daidalos.nl Sat Mar 28 12:56:03 2009 From: Geert.Josten at daidalos.nl (Geert Josten) Date: Sat Mar 28 03:57:01 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <49CD3CAA.7070305@rpbourret.com> Message-ID: <0260356C6DFE754BA6FA48E659A14338248AA54FB8@helios.olympus.borgus.nl> Yes, It starts making sense to me now as well. I keep forgetting that $xml/p actually means $xml/child::p. And we all understand intuitively what $xml/p[2] means (especially when reading it as $xml/child::p[2]).. Just for the sake of completeness, I wrote a simplistic self-contained testsuite with most interesting cases. If someone of you lot could just take a look whether I didn't make any mistakes, that would be appreciated. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Ronald Bourret > Sent: vrijdag 27 maart 2009 21:53 > To: Pavel Minaev > Cc: talk@xquery.com > Subject: Re: [xquery-talk] Question on expected XQuery return > per standards > > Pavel Minaev wrote: > > On Fri, Mar 27, 2009 at 12:06 PM, Ronald Bourret > > wrote: > >> Hmmm. I would have thought that, in each case, only p2 is returned. > >> > >> According to the spec, "For each item in the input sequence, the > >> predicate expression is evaluated using an inner focus, defined as > >> follows: The context item is the item currently being > tested against > >> the predicate. The context size is the number of items in > the input > >> sequence. The context position is the position of the > context item within the input sequence." > >> > >> In each case, the input sequence is the result of $xml//p, > which is a > >> sequence of four p elements. Since the position is the position > >> within this sequence, only p2 is in the second position. > > > > But it isn't. The standard is very clear that $xml//p expands to > > $xml/descendant-or-self::node()/p. The ordering is also very clear: > > > > "Each non-initial occurrence of "//" in a path expression is > > expanded as described in 3.2.4 Abbreviated Syntax, leaving > a sequence > > of steps separated by "/". This sequence of steps is then evaluated > > from left to right." > > > > and, obviously, in $xml/descendant-or-self::node()/p[2], 2 is the > > position within the sequence of child nodes of the parent of p, not > > the expression as a whole. > > Thanks for the clarification. I had to think about it a bit > -- the parent isn't obviously involved until you realize that > the parent is a descendant of $xml -- but that now makes sense. > > -- Ron > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -------------- next part -------------- A non-text attachment was scrubbed... Name: position-testsuite.xqy Type: application/octet-stream Size: 14834 bytes Desc: position-testsuite.xqy Url : http://x-query.com/pipermail/talk/attachments/20090328/d1ab3f61/position-testsuite-0001.obj From christian.gruen at gmail.com Sat Mar 28 13:12:47 2009 From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=) Date: Sat Mar 28 04:13:31 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <0260356C6DFE754BA6FA48E659A14338248AA54FB8@helios.olympus.borgus.nl> References: <49CD3CAA.7070305@rpbourret.com> <0260356C6DFE754BA6FA48E659A14338248AA54FB8@helios.olympus.borgus.nl> Message-ID: Geert, I have checked your test cases; imho, all of them are correct. Christian 2009/3/28 Geert Josten : > Yes, > > It starts making sense to me now as well. I keep forgetting that $xml/p actually means $xml/child::p. And we all understand intuitively what $xml/p[2] means (especially when reading it as $xml/child::p[2]).. > > Just for the sake of completeness, I wrote a simplistic self-contained testsuite with most interesting cases. If someone of you lot could just take a look whether I didn't make any mistakes, that would be appreciated. > > Kind regards, > Geert > >> > > > Drs. G.P.H. Josten > Consultant > > > http://www.daidalos.nl/ > Daidalos BV > Source of Innovation > Hoekeindsehof 1-4 > 2665 JZ Bleiswijk > Tel.: +31 (0) 10 850 1200 > Fax: +31 (0) 10 850 1199 > http://www.daidalos.nl/ > KvK 27164984 > De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > > >> From: talk-bounces@x-query.com >> [mailto:talk-bounces@x-query.com] On Behalf Of Ronald Bourret >> Sent: vrijdag 27 maart 2009 21:53 >> To: Pavel Minaev >> Cc: talk@xquery.com >> Subject: Re: [xquery-talk] Question on expected XQuery return >> per standards >> >> Pavel Minaev wrote: >> > On Fri, Mar 27, 2009 at 12:06 PM, Ronald Bourret >> > wrote: >> >> Hmmm. I would have thought that, in each case, only p2 is returned. >> >> >> >> According to the spec, "For each item in the input sequence, the >> >> predicate expression is evaluated using an inner focus, defined as >> >> follows: The context item is the item currently being >> tested against >> >> the predicate. The context size is the number of items in >> the input >> >> sequence. The context position is the position of the >> context item within the input sequence." >> >> >> >> In each case, the input sequence is the result of $xml//p, >> which is a >> >> sequence of four p elements. Since the position is the position >> >> within this sequence, only p2 is in the second position. >> > >> > But it isn't. The standard is very clear that $xml//p expands to >> > $xml/descendant-or-self::node()/p. The ordering is also very clear: >> > >> > ? "Each non-initial occurrence of "//" in a path expression is >> > expanded as described in 3.2.4 Abbreviated Syntax, leaving >> a sequence >> > of steps separated by "/". This sequence of steps is then evaluated >> > from left to right." >> > >> > and, obviously, in $xml/descendant-or-self::node()/p[2], 2 is the >> > position within the sequence of child nodes of the parent of p, not >> > the expression as a whole. >> >> Thanks for the clarification. I had to think about it a bit >> -- the parent isn't obviously involved until you realize that >> the parent is a descendant of $xml -- but that now makes sense. >> >> -- Ron >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> > > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -- ___________________________ Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen From Geert.Josten at daidalos.nl Sat Mar 28 13:55:26 2009 From: Geert.Josten at daidalos.nl (Geert Josten) Date: Sat Mar 28 04:55:47 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <0260356C6DFE754BA6FA48E659A14338248AA54FB8@helios.olympus.borgus.nl> Message-ID: <0260356C6DFE754BA6FA48E659A14338248AA54FBF@helios.olympus.borgus.nl> Oh, by the way.. I converted the testcases from David Sewell to XSLT 1.0 and 2.0 as well (removed the $xml in front of the Xpath expressions and stored the $xml contents in a file to do the trick), just to see what various XSLT processors would be returning. To my surprise all of the processors I tried were returning p2 only, when running in XSLT 1.0 mode. Is it true that Xpath 2.0 has changed the meaning of such expressions compared to Xpath 1.0? Kind regards, Geert > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Geert Josten > Sent: zaterdag 28 maart 2009 12:56 > To: Ronald Bourret; Pavel Minaev > Cc: talk@xquery.com > Subject: RE: [xquery-talk] Question on expected XQuery return > per standards > > Yes, > > It starts making sense to me now as well. I keep forgetting > that $xml/p actually means $xml/child::p. And we all > understand intuitively what $xml/p[2] means (especially when > reading it as $xml/child::p[2]).. > > Just for the sake of completeness, I wrote a simplistic > self-contained testsuite with most interesting cases. If > someone of you lot could just take a look whether I didn't > make any mistakes, that would be appreciated. > > Kind regards, > Geert > > > > > > Drs. G.P.H. Josten > Consultant > > > http://www.daidalos.nl/ > Daidalos BV > Source of Innovation > Hoekeindsehof 1-4 > 2665 JZ Bleiswijk > Tel.: +31 (0) 10 850 1200 > Fax: +31 (0) 10 850 1199 > http://www.daidalos.nl/ > KvK 27164984 > De informatie - verzonden in of met dit emailbericht - is > afkomstig van Daidalos BV en is uitsluitend bestemd voor de > geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, > verzoeken wij u het te verwijderen. Aan dit bericht kunnen > geen rechten worden ontleend. > > > > From: talk-bounces@x-query.com > > [mailto:talk-bounces@x-query.com] On Behalf Of Ronald Bourret > > Sent: vrijdag 27 maart 2009 21:53 > > To: Pavel Minaev > > Cc: talk@xquery.com > > Subject: Re: [xquery-talk] Question on expected XQuery return per > > standards > > > > Pavel Minaev wrote: > > > On Fri, Mar 27, 2009 at 12:06 PM, Ronald Bourret > > > wrote: > > >> Hmmm. I would have thought that, in each case, only p2 > is returned. > > >> > > >> According to the spec, "For each item in the input sequence, the > > >> predicate expression is evaluated using an inner focus, > defined as > > >> follows: The context item is the item currently being > > tested against > > >> the predicate. The context size is the number of items in > > the input > > >> sequence. The context position is the position of the > > context item within the input sequence." > > >> > > >> In each case, the input sequence is the result of $xml//p, > > which is a > > >> sequence of four p elements. Since the position is the position > > >> within this sequence, only p2 is in the second position. > > > > > > But it isn't. The standard is very clear that $xml//p expands to > > > $xml/descendant-or-self::node()/p. The ordering is also > very clear: > > > > > > "Each non-initial occurrence of "//" in a path expression is > > > expanded as described in 3.2.4 Abbreviated Syntax, leaving > > a sequence > > > of steps separated by "/". This sequence of steps is then > evaluated > > > from left to right." > > > > > > and, obviously, in $xml/descendant-or-self::node()/p[2], 2 is the > > > position within the sequence of child nodes of the parent > of p, not > > > the expression as a whole. > > > > Thanks for the clarification. I had to think about it a bit > > -- the parent isn't obviously involved until you realize that the > > parent is a descendant of $xml -- but that now makes sense. > > > > -- Ron > > _______________________________________________ > > talk@x-query.com > > http://x-query.com/mailman/listinfo/talk > > > > From mike at saxonica.com Sat Mar 28 15:03:19 2009 From: mike at saxonica.com (Michael Kay) Date: Sat Mar 28 07:03:46 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: <49CD23CE.4040804@rpbourret.com><49CD3CAA.7070305@rpbourret.com> Message-ID: <6A00559A63A94F85A55A909B940BFB8B@Sealion> > >> But it isn't. The standard is very clear that $xml//p expands to > >> $xml/descendant-or-self::node()/p. The ordering is also very clear: > > Just to add: I observed that this rule regularly causes > irritations when teaching XPath/XQuery, as many users assume > that the two slashes can be dissolved to a single descendant > step, which actually works fine - as long as no position > predicates are involved. And so long as the step that follows "//" uses the child axis. Michael Kay http://www.saxonica.com/ From mike at saxonica.com Sat Mar 28 15:07:21 2009 From: mike at saxonica.com (Michael Kay) Date: Sat Mar 28 07:07:43 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <0260356C6DFE754BA6FA48E659A14338248AA54FBF@helios.olympus.borgus.nl> References: <0260356C6DFE754BA6FA48E659A14338248AA54FB8@helios.olympus.borgus.nl> <0260356C6DFE754BA6FA48E659A14338248AA54FBF@helios.olympus.borgus.nl> Message-ID: <30E7E4269EC046239DFA2FB7944F1847@Sealion> > Is it true that Xpath 2.0 has changed the meaning of such > expressions compared to Xpath 1.0? No, this is unchanged since XPath 1.0. Which processors did you try, and can we see your code? Michael Kay http://www.saxonica.com/ From Geert.Josten at daidalos.nl Sat Mar 28 16:23:56 2009 From: Geert.Josten at daidalos.nl (Geert Josten) Date: Sat Mar 28 07:24:19 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <30E7E4269EC046239DFA2FB7944F1847@Sealion> Message-ID: <0260356C6DFE754BA6FA48E659A14338248AA54FC6@helios.olympus.borgus.nl> Hi Michael, I ran it against msxsl 4.0, Xalan 2.7.0, Saxon 8 and Saxon 9. They all returned p2 in all cases.. Test.xml:

p1

p2

p3

p4

Test.xsl: , , , , Changing the version of the XSL to 2.0 and running it again with Saxon did return the expected results. But with version 1.0 even Saxon was strangely enough returning p2 only.. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: Michael Kay [mailto:mike@saxonica.com] > Sent: zaterdag 28 maart 2009 16:07 > To: Geert Josten; talk@xquery.com > Subject: RE: [xquery-talk] Question on expected XQuery return > per standards > > > > Is it true that Xpath 2.0 has changed the meaning of such > expressions > > compared to Xpath 1.0? > > No, this is unchanged since XPath 1.0. > > Which processors did you try, and can we see your code? > > Michael Kay > http://www.saxonica.com/ > > From gkholman at CraneSoftwrights.com Sat Mar 28 17:05:00 2009 From: gkholman at CraneSoftwrights.com (G. Ken Holman) Date: Sat Mar 28 08:05:36 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <0260356C6DFE754BA6FA48E659A14338248AA54FC6@helios.olympus. borgus.nl> References: <30E7E4269EC046239DFA2FB7944F1847@Sealion> <0260356C6DFE754BA6FA48E659A14338248AA54FC6@helios.olympus.borgus.nl> Message-ID: <7.0.1.0.2.20090328170336.02641740@wheresmymailserver.com> At 2009-03-28 16:23 +0100, Geert Josten wrote: >Hi Michael, >... > , >... > , >... > , >... > , >... >But with version 1.0 even Saxon was strangely enough returning p2 only.. Not strange at all! You are using which returns the first of the set addressed when using XSLT 1.0. Try using and then you will get a true reading. I hope this helps. . . . . . . . . . . Ken -- XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal From Geert.Josten at daidalos.nl Sat Mar 28 17:11:25 2009 From: Geert.Josten at daidalos.nl (Geert Josten) Date: Sat Mar 28 08:11:47 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <7.0.1.0.2.20090328170336.02641740@wheresmymailserver.com> Message-ID: <0260356C6DFE754BA6FA48E659A14338248AA54FC7@helios.olympus.borgus.nl> *Laughing out loud* Mystery solved, all results are as expected, for all processors I mentioned. I turn my back to XSLT just a few months and I am already getting this rusty. I'll pay closer attention to what I am doing next time.. :-) > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of G. Ken Holman > Sent: zaterdag 28 maart 2009 17:05 > To: talk@xquery.com > Subject: RE: [xquery-talk] Question on expected XQuery return > per standards > > At 2009-03-28 16:23 +0100, Geert Josten wrote: > >Hi Michael, > >... > > , ... > > , ... > > , ... > > , ... > >But with version 1.0 even Saxon was strangely enough > returning p2 only.. > > Not strange at all! You are using which > returns the first of the set addressed when using XSLT 1.0. > Try using and then you will get a true reading. > > I hope this helps. > > . . . . . . . . . . Ken > > -- > XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) > 2009-06-08 Training tools: Comprehensive interactive > XSLT/XPath 1.0/2.0 video > Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 > Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 > G. Ken Holman mailto:gkholman@CraneSoftwrights.com > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc > Legal business disclaimers: http://www.CraneSoftwrights.com/legal > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > From mrys at microsoft.com Sat Mar 28 19:55:10 2009 From: mrys at microsoft.com (Michael Rys) Date: Sat Mar 28 18:55:45 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: References: <49CD23CE.4040804@rpbourret.com> <49CD3CAA.7070305@rpbourret.com> Message-ID: <390310B3D9102C47B28642DB3CB9BE73250678FAE6@NA-EXMSG-C115.redmond.corp.microsoft.com> We had huge discussions around this in the beginning of the XQuery development, whether we need to preserve these confusing (to the end user) semantics of XPath 1.0. Backwards-compatibility and unification of XPath 2.0 for XSLT and XQuery won out in the end. Best regards Michael -----Original Message----- From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Christian Gr?n Sent: Friday, March 27, 2009 11:39 PM To: talk@xquery.com Subject: Re: [xquery-talk] Question on expected XQuery return per standards >> But it isn't. The standard is very clear that $xml//p expands to >> $xml/descendant-or-self::node()/p. The ordering is also very clear: Just to add: I observed that this rule regularly causes irritations when teaching XPath/XQuery, as many users assume that the two slashes can be dissolved to a single descendant step, which actually works fine - as long as no position predicates are involved. Christian ___________________________ Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen _______________________________________________ talk@x-query.com http://x-query.com/mailman/listinfo/talk From mike at saxonica.com Sun Mar 29 10:03:52 2009 From: mike at saxonica.com (Michael Kay) Date: Sun Mar 29 01:04:12 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <0260356C6DFE754BA6FA48E659A14338248AA54FC6@helios.olympus.borgus.nl> References: <30E7E4269EC046239DFA2FB7944F1847@Sealion> <0260356C6DFE754BA6FA48E659A14338248AA54FC6@helios.olympus.borgus.nl> Message-ID: The xsl:value-of instruction in XSLT 1.0, or in XSLT 2.0 when running in backwards-compatibility mode, only displays the first item in the selected node-set. To display all the nodes, use xsl:copy-of. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Geert Josten [mailto:Geert.Josten@daidalos.nl] > Sent: 28 March 2009 15:24 > To: Michael Kay; talk@xquery.com > Subject: RE: [xquery-talk] Question on expected XQuery return > per standards > > Hi Michael, > > I ran it against msxsl 4.0, Xalan 2.7.0, Saxon 8 and Saxon 9. > They all returned p2 in all cases.. > > Test.xml: > > > >
>

p1

>

p2

>
>
>

p3

>

p4

>
>
> > Test.xsl: > > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > > > > > > , > > > > , > > > > , > > > > , > > > > > > > > Changing the version of the XSL to 2.0 and running it again > with Saxon did return the expected results. But with version > 1.0 even Saxon was strangely enough returning p2 only.. > > Kind regards, > Geert > > > > > > Drs. G.P.H. Josten > Consultant > > > http://www.daidalos.nl/ > Daidalos BV > Source of Innovation > Hoekeindsehof 1-4 > 2665 JZ Bleiswijk > Tel.: +31 (0) 10 850 1200 > Fax: +31 (0) 10 850 1199 > http://www.daidalos.nl/ > KvK 27164984 > De informatie - verzonden in of met dit emailbericht - is > afkomstig van Daidalos BV en is uitsluitend bestemd voor de > geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, > verzoeken wij u het te verwijderen. Aan dit bericht kunnen > geen rechten worden ontleend. > > > > From: Michael Kay [mailto:mike@saxonica.com] > > Sent: zaterdag 28 maart 2009 16:07 > > To: Geert Josten; talk@xquery.com > > Subject: RE: [xquery-talk] Question on expected XQuery return per > > standards > > > > > > > Is it true that Xpath 2.0 has changed the meaning of such > > expressions > > > compared to Xpath 1.0? > > > > No, this is unchanged since XPath 1.0. > > > > Which processors did you try, and can we see your code? > > > > Michael Kay > > http://www.saxonica.com/ > > > > > From wolfgang at exist-db.org Mon Mar 30 15:40:42 2009 From: wolfgang at exist-db.org (Wolfgang) Date: Mon Mar 30 05:41:30 2009 Subject: [xquery-talk] Question on expected XQuery return per standards In-Reply-To: <49CD29F0.2020902@exist-db.org> References: <49CD23CE.4040804@rpbourret.com> <7ab7cbac0903271227r4c4b7b8ek9aed6fa0532875c@mail.gmail.com> <49CD29F0.2020902@exist-db.org> Message-ID: <49D0CBDA.5040901@exist-db.org> >> exist 1.2.5 - set 4 is same as set 5 :( >> anybody can check 1.3? > > I already noticed this as a bug and will take care of it. Thanks for the > test. I immediately fixed those issues in eXist trunk/1.3. Wolfgang From james.fuller.2007 at gmail.com Tue Mar 31 11:35:47 2009 From: james.fuller.2007 at gmail.com (James Fuller) Date: Tue Mar 31 01:36:34 2009 Subject: [xquery-talk] [ann] Dashboards with XQuery article Message-ID: hope people don't mind me posting this here my latest article on using XQuery to create web dashboards http://www.ibm.com/developerworks/xml/library/x-xqdashboard/index.html?ca=drs- ... note these articles are geared towards a broader audience, others have picked up on this and taken it to the next level (give me a shout if anyone wants more information) cheers, Jim Fuller From lists at fgeorges.org Tue Mar 31 12:19:48 2009 From: lists at fgeorges.org (Florent Georges) Date: Tue Mar 31 04:20:32 2009 Subject: [xquery-talk] [ann] Dashboards with XQuery article In-Reply-To: Message-ID: <492461.70400.qm@web23007.mail.ird.yahoo.com> James Fuller wrote: > my latest article on using XQuery to create web dashboards >http://www.ibm.com/developerworks/xml/library/x-xqdashboard/index.html?ca=drs- Very interesting, Jim! Some parts sound familiar ;-) > ... note these articles are geared towards a broader audience, > others have picked up on this and taken it to the next level (give > me a shout if anyone wants more information) Do you mean there are libraries or frameworks in that area? I am definitely interested! Do you have more info? Regards, -- Florent Georges http://www.fgeorges.org/