[ query icon ]

Queries

One important requirement of some transformation applications is the ability to select some part of the XML documents to be further transformed. The query abstract transformation covers this goal.

It takes as input the source to be queried and the query to be processed against the input. Its output will be the result.

In order to test this interface we defined a very simple query language that only allows the expression of two elements: query which contains a set of select elements. The select elements have a match attribute containing an XPath [clark1999b] expression. The evaluation of the query will return all the subtrees of the input stream that match one of the select clauses. The conjunction can be implemented by composing two such queries. This is a very light query language which does not transform order or provide complex operations but it is embedded in a rich environment which can provide this.

For instance, the following query asks for all the references involving either Troncy or Brunet as author (in any position).

<query name="troncybrunet" type="tmq" root="bibliography"> <select match="bibliography/reference[authors/p/@last='Troncy']"/> <select match="bibliography/reference[authors/p/@last='Brunet']"/> </query> The root attribute specifies that the result is returned within a bibliography element.

This simple query language has been implemented by transforming the query element into an XSLT stylesheet that is processed against the input and returns the result

The apply-query element introduces the use of a query in a process body. Its structure is the following:

<apply-query type="type" ref="name" id="id" in="channel"> {<with-param>}* </apply-query>

Next chapter: Rule sets


Feel free to comment to transmorpher-dev@fluxmedia.fr, Last modified: Tue May 29 14:16:53 CEST 2001
$Id: queries.html,v 1.4 2001/10/10 07:29:23 jerome Exp $