24.05.2014 Views

pdf: 600KB - Potsdam Institute for Climate Impact Research

pdf: 600KB - Potsdam Institute for Climate Impact Research

pdf: 600KB - Potsdam Institute for Climate Impact Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

82<br />

The bank vole lives in hedgerows.<br />

The wood mouse lives in woodlands.<br />

We need to generate the HTML by trans<strong>for</strong>ming the original XML. We do this using the<br />

following XSLT document:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

The<br />

<br />

lives in<br />

.<br />

<br />

<br />

Don't worry about the shaded parts at the top and bottom. The main part consists of two XSLT<br />

template elements. The text in bold relates to XSLT, the rest is sent to the output file just as it<br />

appears. The first template element prints out some HTML to the output document, and calls the<br />

second template. This second template prints out some English words plus the content of the<br />

english_name and habitat elements in the original document. It does this <strong>for</strong> each<br />

species_description element in the original XML document.<br />

Note that an XSLT document is also expressed in XML syntax!<br />

A2.3 Prolog<br />

Prolog (programming in logic) is a computer language developed in the 70's <strong>for</strong> representing and<br />

reasoning with statements expressed in first-order predicate logic, a <strong>for</strong>m of logic that is both<br />

expressive (it can handle a rich variety of logical statements) while at the same time having welldefined<br />

<strong>for</strong>mal properties. Prolog is a declarative programming language: rather than giving the<br />

computer instructions, as in a conventional procedural or imperative programming language, you<br />

state facts and rules about some area of knowledge. Instead of 'running a program' to solve a<br />

problem, you 'enter a query', and the Prolog interpreter then tries to use the facts and rules to solve<br />

the problem.<br />

Here is an example Prolog program:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!