xQuery using FLWOR

on

Well, you actually can user FLWOR for xquery. It’s really refreshing!!

What is FLWOR?

FLWOR (pronounced “flower”) is an acronym for “For, Let, Where, Order by, Return”.

  • For – selects a sequence of nodes
  • Let – binds a sequence to a variable
  • Where – filters the nodes
  • Order by – sorts the nodes
  • Return – what to return (gets evaluated once for every node)

Samples :

<tokens>{
 for $t in tokenize("a/b/c/d/e/f/g","/")
 return <token>{$t}</token>
}</tokens>

In real sample case, you can iterate query-string into any XML you want. Combine with substring-before($string,$delimiter) and substring-after.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s