XSLT: XQuery

Eine Abfrage- und funktionale Programmier-Sprache, verwendet XPath.

XQuery Versionen

The mission of the XML Query project is to provide flexible query facilities to extract data from real and virtual documents on the World Wide Web, therefore finally providing the needed interaction between the Web world and the database world. Ultimately, collections of XML files will be accessed like databases".

XQuery Ziel

Datenextraktion /-manipulation aus Dateien, die

XQuery Methoden

XQuery and XPath Data Model

Beispiel I: XQuery Syntax

Die folgende XQuery sucht alle Rollen aus Shakespeare's Hamlet und gibt sie als HTML-Dokument aus.

XSLT-Workshop: XQuery Beispiel Hamlet
<html>
  <body>
    {
      for $act in doc("hamlet.xml")//ACT
      let $speakers := distinct-values($act//SPEAKER)
      return
        <div>
          <h1>{ string($act/TITLE) }</h1>
          <ul>
            {
              for $speaker in $speakers
              return <li>{ $speaker }</li>
            }
          </ul>
        </div>
    }
  </body>
</html>

XML-Workshop: XSLT – Übersicht