Our directory structure would be
<config> <site src='site' build='build'/> <lang> <en/><ro/> </lang> <copyright ref='site://copyright.xml'/> <header ref='site://header.xml'/> <menu ref='site://menu.xml'/> </config>
Let's talk about each of the options:
There are many ways to run staticxjam:
java -jar xjam.jar
ant run. This way you'll also have an uptodate version of the software because a build will occour if some files have changed
index.xml is the an actual site file (that will generate index.html and index.ro.html).
<html> <title> <lang> <ro> Romanian title </ro> <en> English title </en> </lang> </title> <body> The actual site contents, with valid xhtml. <lang> <ro> salut </ro> <en> hy </en> </lang> </body> </html>There are a few things worth mentioning here:
header.xml has all the stuff that you would usually place in the <head> section:
<head> <meta option='value'/> <link type="shortcut icon" ref="site://favicon.gif" lang='none'/> </head>There are also some new things here
This is where the global menu is defined. It is up to you to actually define the menu (however do you want it).
<ul> <li> <link ref='site://index.html'> <lang> <ro>acasa</ro> <en>home</en> </lang> </link> </li> <li> <link ref='site://products/list.html'> <lang> <ro>Produse</ro> <en>Products</en> </lang> </link> </li> <li> <a href='http://server.com'>Absolute link</a> </li> </ul>This could be one way of defining your menu. It is up to your html and css skills.
<div id='copyright'> <timestamp/> <lang> <en>Legal boring stuff</en> <ro>Copyight...</ro> </lang> </div>
The link tag is a rather central tag since it is the one we use to reffer to pages within out own site. Since xjam will generate relative and not absolute paths, it's worth it (we'll be able to move the generated site freely).
Suppose we are in site/a.xml and want a link to site/emi/b.xml. What do
we use ?
<link ref='site://emi/b.html'/>link name</link>
This will get translated to
<a href='emi/b.html'>link name</a>
Please note that this assumes that the current language is the default one.
In b.en.html, the link will become
<a href='emi/b.en.html'>link name</a>
Sometimes we want to link to a specific variant of the file or the file
doesn't have multiple versions (for each language). This is where the
lang attribute comes.
<link ref='site://emi/b.html' lang='ch'>link name</link>
<a href='emi/b.ch.html'>link name</a> (assuming
that ch is not the default language...).
With lang=none we say that the file has no variants.
<link ref='site://emi/movie.mpg' lang='none'>link name</link>
<a href='emi/movie.mpg'>link name</a>
You need some way to make a link from a file to the same file but in the other language.
Here is where
<link ref='self://' lang='something'>link name</link> comes in
handy. The self:// protocol means that this link is for the very same file that
contains it; and with the lang attribute we force a specific language. This is
so easy that I usually add it to the menus (like here).
Link also uses the type attribute, which is optional:
<link type="shortcut icon" ref="site://favicon.gif" lang='none'/>will generate the tag for the shortcut icon. Note that I've also used the lang attribute since we don't usually have specific favicons for every language.
<link type="stylesheet" ref="site://style.css" lang='none'/>will generate the tag for the stylesheet.
To inser an image we have the
<icon ref='site://some.gif'/>. The language
is ignored by default.
The program ignores ignore elements and prints only their content.
This file was generated using xjam.
Many thanks to Patrick Riley (SIMS, U.C. Berkeley)
This product includes software developed by the Apache Software Foundation (http://www.apache.org/).
Thanks to sourceforge for the hosting.