/queule

A template system for XHTML implemented in javascript and based in some ideas of XTiger

Primary LanguageJavaScript

Queule

A templating system for XHTML, implemented in Javascript and based in some ideas of XTiger.

Introduction

Queule includes an XML language for specifying document templates. Queule templates are intended to guide an editing tool for building documents that follow a predefined model. Like XTiger, the Queule language is used jointly with another XML language, typically XHTML, which is called the target language. A template is a target language document where Queule elements indicate how the document can be edited and still conform with the model. As XTiger is a tool for document editing, it can only send the entire document after editing. Unlike XTiger, the Queule is a tool for editing data. Thus, Queule can send partial changes in a document as a set of RDF triples. Queule is a versatile tool to build templates that constrains the structure of documents that are editing interfaces to databases.

For example, a server could send you an XHTML file that includes this code:

<div about="/people/123">
  <p>
    <q:use property="foaf:givenname" types="string">given name</q:use>
    <q:use property="foaf:familyname" types="string">family name</q:use>
  </p>
  <p>
    <q:use property="foaf:homepage" types="string">homepage</q:use>
  </p>
</div>

Then, if you click on “given name” the template will show up a text field. After you edit it will send an asyncronous request with a RDF triple like this:

</people/123> foaf:givenname "John" .

Obiously we must use valid URIs in subjects and predicates, but it is only an example to show how Queule works.

Using queule

Queule specification

The template body

Inclusion of types

In the document structure the use element indicates what type(s) of element can appear at that position in an instance. Only one element of the specified type(s) can appear at that position in an instance document. Also the use element is the basic component for coding triples in the document. The subject URI must be found recursively starting in the parent node. If there is a node with an about property that is the subject URI, else the subject URI is the document URI. The predicate uri is specified by the property attribute of the use element and the object must be found in the content of the use element.

<!ELEMENT use ANY>
<!ATTLIST use
    property       CDATA           #REQUIRED
    label          NMTOKEN         #IMPLIED
    types          CDATA           #REQUIRED
    option         (set|unset)     #IMPLIED
    currentType    CDATA           #IMPLIED
    initial        (true)          #IMPLIED>
Example
<h1><q:use property="dc:title" types="string">Title</q:use></h1>