5

Can someone give an example of an html page that uses xquery, do you need something else in order to run xquery.

I tried to run some xquery code from w3schools but it is not evaluating in the html page.

<html>
  <ul>
  {
    for $x in doc("books.xml")/bookstore/book/title
      order by $x
      return <li>{$x}</li>
    }
  </ul>
</html>
Sampson
  • 265,109
  • 74
  • 539
  • 565

5 Answers5

6

Uhmm... I guess this is a misunderstanding.

Neither javascript itself or any webbrowser (IE, FF, Opera, ...) are XQuery capable or have support build in. You need some other software which has XQuery implemented (check the link provided by Jonathan Sampson). That software could be called from your html site and the results displayed inline

e.g. the wikibook about XQuery uses a eXist server to run their samples and output the result to the browser.

jitter
  • 53,475
  • 11
  • 111
  • 124
1

XML Query (XQuery) Implementations

Sampson
  • 265,109
  • 74
  • 539
  • 565
  • Thanks!....I just wanted a html snippet that worked, that I can run in a browser and shows a demonstration of xquery. –  Jun 28 '09 at 14:13
1

Like my previous speakers said, there is no native support for XQuery in any browser today. But at least for Firefox there seems to exist a plugin: XQuery USE ME

Cheers,

Boldewyn
  • 81,211
  • 44
  • 156
  • 212
  • [Xquery Use Me](https://addons.mozilla.org/en-US/firefox/addon/xquery-use-me-xquseme/?src=ss) seems dead. It is not available for Firefox 43.0. – Bulrush May 24 '16 at 14:56
1

You can try your example live at http://www.zorba-xquery.com/html/demo#OMEO40cpnqWzdgoCGtLwiSrN+8c=

wcandillon
  • 2,086
  • 19
  • 19
0

In addition to the mentioned links take a look at http://en.wikibooks.org/wiki/XRX for an introduction to the kind of architecture you might find useful.

Even if you're just window shopping at the moment, XRX is worth paying attention to.