XQuery (or XPath) console?

Hi, I should have missed something, but I can't find a tool in oXygen to evaluate XQuery (or at least XPath) expressions. For instance, I have a set of XML files in a directory, and I'd like to know which has the most 'elem' elements. So I'd like to evaluate a query (without creating a new file, if possible selecting the default collection with a file dialog, and if possible recording the query as part of the project) something like: for $d in collection() order by count(//elem) return document-uri(.) Does something similar exist in oXygen? Regards, -- Florent Georges http://www.fgeorges.org/

Hello, Yes, the XPath 2.0 queries are executed with Saxon 9 in the XPath toolbar and in the XPath Builder view. As you already know starting with Oxygen version 10 the queries are schema aware. There is an example in the section about XPath queries in the User Manual of using the Saxon implementation of the XPath 2.0 collection() function with Saxon specific parameters like recurse=yes, select=*.xml and parser=ro.sync.xml.parser.CatalogEnabledXMLReader: http://www.oxygenxml.com/doc/ug-oxygen/querying-documents.html#figure-xpath-... About the XPath toolbar and the XPath Builder view: http://www.oxygenxml.com/doc/ug-oxygen/querying-documents.html#xpath-console http://www.oxygenxml.com/doc/ug-oxygen/querying-documents.html#xpath-builder... If you need to set a custom URI resolver for Saxon 9 go to Options -> Preferences -> XML -> XSLT-FO-XQuery -> XSLT -> Saxon -> Saxon-B/SA -> Advanced: http://www.oxygenxml.com/doc/ug-oxygen/preferences-xslt-fo-xquery.html#prefe... Regards, Sorin Florent Georges wrote:
Hi,
I should have missed something, but I can't find a tool in oXygen to evaluate XQuery (or at least XPath) expressions.
For instance, I have a set of XML files in a directory, and I'd like to know which has the most 'elem' elements. So I'd like to evaluate a query (without creating a new file, if possible selecting the default collection with a file dialog, and if possible recording the query as part of the project) something like:
for $d in collection() order by count(//elem) return document-uri(.)
Does something similar exist in oXygen?
Regards,

Sorin Ristache wrote:
Yes, the XPath 2.0 queries are executed with Saxon 9 in the XPath toolbar and in the XPath Builder view.
Thanks for the response, Sorin. I didn't think about the XPath Builder view (the XPath toolbar is nice, but is really to small for queries longer than a 2 or 3 steps.) Three remarks though... 1/ XQuery is not usable there, though is would be useful. 2/ You have to get an XML document opened and selected in the editor in order to use the builder (even if your query begins by collection()...) 3/ You don't have any support to select a directory or document by a dialog box (when testing the builder before posting now, I actually made a typo in a looong path.) I think an additional button on the builder, to launch a simple dialog to set the default collection would be useful. It would be interesting also to have a list of queries saved within the project, in order to save useful queries often used while developing. Anyway, the builder can help for simple queries. And I like the "toggle floating" feature in that case (I haven't thought of a concrete usage before.) Thank you all oXygen folks, for all the help provided today. Regards, -- Florent Georges http://www.fgeorges.org/
participants (2)
-
Florent Georges
-
Sorin Ristache