<?xml version="1.0" encoding="ISO-8859-1"?><TUTORIAL>
<TITLE>How to create an XML language and its XML editor in 5 minutes</TITLE>

<SECTION>
<TITLE>Introduction</TITLE>
<PARAGRAPH>
This tutorial explains how to create a configuration file for Jaxe including the menu definitions to insert the XML elements, the way XML elements are displayed, and the XML language. It also gives an example of an XSLT stylesheet. The example has been used to create <LINK href="in_five_minutes.xml">the file</LINK> you are just reading.
</PARAGRAPH>
</SECTION>

<SECTION>
<TITLE>Creation of the configuration file</TITLE>
<PARAGRAPH>
The configuration files are stored in Jaxe's <CODE>config</CODE> folder, and their names end with <CODE>_Jaxe_cfg.xml</CODE>. For instance, the configuration file for configuration files (whose root element is <CODE>JAXECFG</CODE>), has the name <CODE>JAXECFG_Jaxe_cfg.xml</CODE>. To start the tutorial, we start Jaxe, choose the "New button", and select "JAXECFG - Jaxe configuration file".
</PARAGRAPH>
<PARAGRAPH>
There are two options for the creation of a Jaxe configuration file:
</PARAGRAPH>
<LIST>
<LI>Use an XML schema file to define the XML language to use, and only define the menus and the way to display elements in the configuration file.</LI>
<LI>Define an XML language with a very simplified syntax, within the configuration file.</LI>
</LIST>
<PARAGRAPH>
Here we will use the simplified syntax, which can only be used to define elements, attributes, sub-elements, and which elements can contain text. If we used an XML schema instead, we should not give any rule about the XML language in the configuration file.
</PARAGRAPH>
<PARAGRAPH>
To begin the construction of the configuration file, we insert a description that will be displayed in the dialog used to create new documents.
</PARAGRAPH>
<EXAMPLE>
JAXECFG&gt;
<SPACE/>DESCRIPTION&gt;Tutorial for config files&lt;DESCRIPTION
&lt;JAXECFG
</EXAMPLE>
<PARAGRAPH>
Then, we define the root element for the language, <CODE>TUTORIAL</CODE>. Every new document will include this element at the start.
</PARAGRAPH>
<EXAMPLE>
JAXECFG&gt;
<SPACE/>DESCRIPTION&gt;Tutorial for config files&lt;DESCRIPTION
<SPACE/>RACINE&gt;
<SPACE/><SPACE/>BALISE 'TUTORIAL'&gt;
<SPACE/><SPACE/>&lt;BALISE
<SPACE/>&lt;RACINE
&lt;JAXECFG
</EXAMPLE>
</SECTION>

<SECTION>
<TITLE>Creation of the menus</TITLE>
<PARAGRAPH>
We can now define the menus used to insert new elements. All the elements in the XML language must have a corresponding menu. For the tutorial, we will use the menus "Organisation", "List" and "Text".
</PARAGRAPH>
<EXAMPLE>
MENU 'Organisation'&gt;
&lt;MENU 'Organisation'

MENU 'List'&gt;
&lt;MENU 'List'

MENU 'Text'&gt;
&lt;MENU 'Text'
</EXAMPLE>
</SECTION>

<SECTION>
<TITLE>Definition of the elements</TITLE>
<PARAGRAPH>
Let's start with the <CODE>TITLE</CODE> element. Since it will be inserted with the Organisation menu, it will be defined there. We use the attributes <CODE>nom='TITLE'</CODE>, <CODE>titre='Title'</CODE> (which will be used for the menu), and <CODE>type='string'</CODE>. The <CODE>type</CODE> attribute specifies the Jaxe element type, which corresponds to the way an element is displayed and edited. Here, with the <CODE>'string'</CODE> type, Jaxe will display it as a simple string with start and end tags. Jaxe element types are described in the <LINK href="doc_config_en.html">syntax documentation</LINK>.
</PARAGRAPH>
<PARAGRAPH>
<CODE>TITLE</CODE> will be found for instance under the root element, <CODE>TUTORIAL</CODE>. To specify that, a <CODE>SOUSBALISE</CODE> (sub-element) element is added under <CODE>TUTORIAL</CODE>, with the attribute <CODE>nom='TITLE'</CODE>.
</PARAGRAPH>
<PARAGRAPH>
Since we want to have text in the titles, we add this information with the <CODE>TEXTE</CODE> element in the element definition.
</PARAGRAPH>
<EXAMPLE>
RACINE&gt;
<SPACE/>BALISE 'TUTORIAL'&gt;
<SPACE/><SPACE/>SOUSBALISE 'TITLE'
<SPACE/>&lt;BALISE
&lt;RACINE

MENU 'Organisation'&gt;
<SPACE/>BALISE 'TITLE'&gt;
<SPACE/><SPACE/>TEXTE
<SPACE/>&lt;BALISE 'TITLE'
&lt;MENU 'Organisation'
</EXAMPLE>
</SECTION>

<SECTION>
<TITLE>More display options</TITLE>
<PARAGRAPH>
Some <CODE>type</CODE> attributes often used are <CODE>division</CODE>, <CODE>zone</CODE> (area) and <CODE>string</CODE>. <CODE>division</CODE> displays an element with two long horizontal bars in the text, which is very useful to separate large areas in the document. It will be used in the tutorial for the element <CODE>SECTION</CODE>. <CODE>zone</CODE> displays an element by also adding newlines, but taking less horizontal space. We will use it for the elements <CODE>PARAGRAPH</CODE> and <CODE>EXAMPLE</CODE>, which will be found under <CODE>SECTION</CODE>. Finally, <CODE>string</CODE> also displays the element with <CODE>ELEMENT&gt;</CODE> and <CODE>&lt;ELEMENT</CODE>, but without adding newline characters. We will use it here for all the other elements.
</PARAGRAPH>
<PARAGRAPH>
It is possible to make editing with Jaxe more pleasing by specifying for example styles. For a title, we would like to have text in bold, which can be obtained with a parameter. A <CODE>PARAMETRE</CODE> element has just to be added under <CODE>BALISE 'TITLE'</CODE>, with the attributes <CODE>nom='style'</CODE> and <CODE>valeur='GRAS'</CODE> (value='BOLD'). The complete list of parameters is given in the <LINK href="doc_config_en.html">syntax documentation</LINK>.
</PARAGRAPH>
<EXAMPLE>
BALISE 'TITLE'&gt;
<SPACE/>PARAMETRE 'style'
<SPACE/>TEXTE
&lt;BALISE 'TITLE'
</EXAMPLE>
</SECTION>

<SECTION>
<TITLE>Element sets</TITLE>
<PARAGRAPH>
Rather than adding several times the same <CODE>SOUSBALISE</CODE> elements, they can be gathered in element sets, and used with <CODE>SOUSBALISE ensemble='setname'</CODE> each time we want to add a set of <CODE>SOUSBALISE</CODE>. For instance, we want here to use the elements <CODE>EMPHASIS</CODE>, <CODE>CODE</CODE> and <CODE>LINK</CODE> in the text. We just have to create a set under <CODE>JAXECFG</CODE>, and use each time we want to use text with all these elements: <CODE>SOUSBALISE ensemble='text'</CODE> instead of just using <CODE>TEXTE</CODE>.
</PARAGRAPH>
<EXAMPLE>
<SPACE/>ENSEMBLE 'text'&gt;
<SPACE/><SPACE/>TEXTE
<SPACE/><SPACE/>SOUSBALISE 'EMPHASIS'
<SPACE/><SPACE/>SOUSBALISE 'CODE'
<SPACE/><SPACE/>SOUSBALISE 'LINK'
<SPACE/>&lt;ENSEMBLE 'text'

&lt;JAXECFG
</EXAMPLE>
</SECTION>

<SECTION>
<TITLE>Tutorial file</TITLE>
<PARAGRAPH>
Here is the complete configuration file: <LINK href="TUTORIAL_Jaxe_cfg.xml">TUTORIAL_Jaxe_cfg.xml</LINK>.
</PARAGRAPH>
<PARAGRAPH>
If we had used an XML schema file separate from the configuration file, we would have had to give the path to the file with the element <CODE>FICHIERSCHEMA</CODE>. We would also have defined the menus, but we would not have used the elements to define the language : <CODE>SOUSBALISE, ATTRIBUT, VALEUR, TEXTE, ENSEMBLE</CODE>.
</PARAGRAPH>
<PARAGRAPH>
Here is the same example if we use an XML schema separate from the Jaxe configuration file, by separating the language from the way it is displayed in Jaxe: <LINK href="TUTORIAL2_Jaxe_cfg.xml">TUTORIAL2_Jaxe_cfg.xml</LINK> - <LINK href="TUTORIAL2.xsd">TUTORIAL2.xsd</LINK>.
</PARAGRAPH>
</SECTION>

<SECTION>
<TITLE>Creation of the stylesheet</TITLE>
<PARAGRAPH>
The only thing left is to define a way to display documents created with this new XML language. Jaxe is using XSLT stylesheets transforming XML into HTML for this task.
</PARAGRAPH>
<PARAGRAPH>
An XSLT document is created by choosing the "New" menu and selecting "stylesheet - XSLT". XSLT files mix several XLM languages in a document, and we see here the menus for XSLT together with the menus for XHTML.
</PARAGRAPH>
<PARAGRAPH>
The XSLT version should be defined with the value "1.0" for the attribute <CODE>version</CODE> of the root element. The transformation output has also to be defined. For instance, to obtain XHTML, <CODE>xsl:output</CODE> is used with the attributes
<CODE>doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" encoding="ISO-8859-1" indent="yes" method="xml"</CODE>.
</PARAGRAPH>
<PARAGRAPH>
In general, an HTML equivalent can be defined for every element. For instance, to display <CODE>CODE</CODE> as with <CODE>tt</CODE> in HTML, we write:
</PARAGRAPH>
<EXAMPLE>
<SPACE/>&lt;xsl:template match="CODE"&gt;
<SPACE/><SPACE/>&lt;tt&gt;&lt;xsl:apply-templates/&gt;&lt;/tt&gt;
<SPACE/>&lt;/xsl:template&gt;
</EXAMPLE>
<PARAGRAPH>
Once the <LINK href="TUTORIAL.xsl">XSL file</LINK> is created, a link to it has to be added in the configuration file, at the beginning. The stylesheet should also be placed in Jaxe's config folder.
</PARAGRAPH>
<EXAMPLE>
JAXECFG&gt;
<SPACE/>FICHIERXSL 'TUTORIAL.xsl'&gt;
<SPACE/>&lt;FICHIERXSL 'TUTORIAL.xsl'
</EXAMPLE>
</SECTION>

<SECTION>
<TITLE>Top chrono!</TITLE>
<PARAGRAPH>
Finally, we just need to choose the "Open configuration..." menu and to select our configuration file, <CODE>TUTORIAL_Jaxe_cfg.xml</CODE>, to create a new document with it. We could also move the configuration file to Jaxe's <CODE>config</CODE> folder, so that it appears in the list when a new document is created with the "New" menu.
</PARAGRAPH>
</SECTION>
</TUTORIAL>