Xcerpt Tutorial - Chapter 1 (Hello World)

This document is (c)2003 Sebastian Schaffert and the Xcerpt Team.
Please contact schaffer@informatik.uni-muenchen.de on any questions.

Hello World

It is a tradition for programming tutorials to begin with a "Hello World" example. The output of the following Xcerpt program is <p>Hello World</p>:
GOAL
    p { "Hello World" }
END
      
On this simple example, one can observe the following properties: A goal has the following structure:
GOAL
  <construct part>
FROM
  <query part>
END
      
In a goal (and a rule), "cons" is wrapped around a term serving as construction pattern, and "query" is wrapped around a query specification (explained below). A "cons" part may be associated with an output resource, specifying where to write the results. If no output resource is provided, output is written to standard output. The following modified "Hello World"-example writes the document <p>Hello World</p> to the file "hello.html":
GOAL
  out {
    resource { "file:hello.html", "xml" },
    p { "Hello World" }
  }
END
      

Summary of Chapter 1

Go to Chapter 2 to see the first real query.

Sebastian Schaffert
Last modified: Wed Mar 12 11:55:08 CET 2003