<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/ajax-s-html.xml"?>
<ajax-s>
	<pages>
		<page>
			<h2>Introducing AJAX-S</h2>
			<p>The idea came to me because I wanted a lightweight slideshow based on HTML, CSS and JavaScript, but I also wanted to separate the data of each page from the actual code that presents it. Therefore, I decided to move the data into an XML file and then use AJAX to retrieve it. The name AJAX-S is short for AJAX-Slides (or Asynchronous JavaScript and XML Slides, if you want to).</p>
			<img src="images/masthead.jpg" alt="A nice image" class="left" />
			<p>The reason I decided to create this right now is that I have a couple of upcoming presentations, and I want to display the beauty and simplicity of using open formats, and how to create a presentation without the need for any particular program or provider when doing it.</p>
		</page>
		<page>
			<h2>The different components</h2>
			<dl>
				<dt>HTML</dt>
				<dd>Mainly as a container for the other components</dd>
				<dt>CSS</dt>
				<dd>All layout is controlled through CSS</dd>
				<dt>JavaScript</dt>
				<dd>Interaction and loading of content</dd>
				<dt>XML</dt>
				<dd>The data layer with the content</dd>
				<dt>XSLT</dt>
				<dd>Transforms the data and returns it as HTML to the JavaScript</dd>
			</dl>
		</page>
		<page>
			<h2>The main advantages of this approach</h2>			
			<p>These are the advantages of using this separation of functionality, presentation and content:</p>
			<ul>
				<li>No HTML knowledge needed at all, if you choose the custom XML formatting elements (easily designed by you)</li>
				<li>Only one page loaded a time, so there should be no flash of unstyled content</li>
				<li>Easy to customize by adding your own CSS file/-s</li>
				<li>You can have the same HTML, CSS and JavaScript file, and only change the XML and/or the XSLT file to create a brand new presentation</li>
				<li>You can change the entire design by only altering the CSS file/-s</li>
			</ul>			
		</page>
		<page>
			<h2>How to format the content</h2>
			<p>You can either use custom formatting nodes in the XML, or you can use plain HTML for formatting.  Remember to set the variable <code>bUseHTMLContent</code> in the JavaScript depending on what you choose.</p>
			<p>In the zip file you can find examples of XML formatting in the files <code>ajax-s.xml</code> and <code>ajax-s.xslt</code>, and examples of HTML formatting in the files <code>ajax-s-html.xml</code> and <code>ajax-s-html.xslt</code>.</p>
		</page>		
		<page>
			<h2>Incremental rendering</h2>
			<p>If you want to have incremental rendering without creating several pages, i.e. higlighting bullet after bullet without leaving the same page, you can now accomplish that by adding a class name to your list items, like this:</p>
			<pre><code>&lt;li class="incremental"&gt;Increment 1&lt;/li&gt;</code></pre>
			<p>Choose to move forward now, and that will happen to the list below. There are three different CSS classes for formatting increments: <code>incremental</code>, <code>incremental-active</code> and <code>incremental-past</code>.</p>
			<ul>
				<li class="incremental">Increment 1</li>
				<li class="incremental">Increment 2</li>
				<li class="incremental">Increment 3</li>
				<li class="incremental">Increment 4</li>
				<li class="incremental">Increment 5</li>
			</ul>			
		</page>
		<page>
			<h2>Files needed</h2>
			<p>These are all the files needed to make it work, but naturally, you can add as many files and functionality as you feel like. The images folder is optional for your design.</p>
			<ul>
				<li>index.htm</li>
				<li>css/ajax-s.css</li>
				<li>css/fonts.css</li>
				<li>css/print.css</li>
				<li>js/ajax-s.js</li>
				<li>xml/ajax-s-html.xml</li>
				<li>xslt/ajax-s-html.xml</li>
				<li>xslt/ajax-s-paging-html.xml</li>
			</ul>
		</page>
		<page>
			<h2>Settings in the JavaScript file</h2>			
			<p>In the JavaScript file, you can set the path to the XML file, the XSLT content file and the XSLT paging file. You can also set a boolean if the font should scale or not according to the current window size, if you want to use the XML formatting mode or the HTML mode and if you want to select the first increment when backing to the page from an upcoming page. It looks like this:</p>
			<ul>
				<li>var strXMLURL = "xml/ajax-s.xml";</li>
				<li>var strPagingXSLTURL = "xslt/ajax-s-paging.xslt";</li>
				<li>var strXSLTURL = "xslt/ajax-s.xslt";</li>
				<li>var bUseFontScaling = true;</li>
				<li>var bUseHTMLContent = true;</li>
				<li>var bSelectFirstIncrementWhenBacking = true;</li>
			</ul>
		</page>				
		<page>
			<h2>Settings for the printable version</h2>
			<p>Make sure to link your XML file with your different pages to the XSLT file that will handle the presentation. The URL shall be the same as the JavaScript variable strXSLTURL. Like this:</p>
			<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;?xml-stylesheet type="text/xsl" href="../xslt/ajax-s-html.xml"?&gt;
			</pre>
		</page>
		<page>
			<h2>Settings for non-JavaScript users</h2>
			<p>Non-JavaScript users will get the option to go straight to the print page to read all the pages at the same time. Remember to point to your XML file in the index.htm file within the <code>noscript</code> tags. The URL shall be the same as the JavaScript variable strXMLURL</p>
			<pre>
&lt;noscript&gt;
	&lt;a href="xml/ajax-s-html.xml"&gt;Go to the printable version.&lt;/a&gt;
&lt;/noscript&gt;
			</pre>
		</page>
		<page>
			<h2>Navigating</h2>			
			<p>A drop down menu is automatically created listing the headings of each page while providing a quick way to navigate to a certain page. You can also click anywhere in the document to navigate to the next page.</p>
			<p>Another way of navigating is using the keyboard. The available keyboard shortcuts are:</p>
			<dl>
				<dt>To move forward</dt>
				<dd>Space bar, Enter, right-arrow and <code>alt</code> + right-arrow</dd>
				<dt>To move back</dt>
				<dd>Backspace, left-arrow and <code>alt</code> + left-arrow</dd>
			</dl>
			<p>In Mozilla web browsers, when the drop down is selected, you can navigate to chosen alternative by pressing the space bar or the enter key. In Internet Explorer, it automatically changes page when you change alternative using the arrow keys.</p>
		</page>
		<page>
			<h2>Formatting nodes (XML formatting mode)</h2>
			<p>These are the different nodes in the XML that you can use for formatting as of now. However, adding node types and logic to that is really a small feat, if necessary. The heading element is only used once for the page and then the rest of the content is wrapped within a node named content. The nodes below only works as direct children of the content node.</p>
			<ul>
				<li>heading, for the page heading</li>
				<li>paragraph</li>
				<li>image, with the attributes source, alternativetext and layout</li>
				<li>list</li>
				<li>orderedlist</li>
				<li>definitionlist</li>
				<li>subheading</li>
			</ul>
		</page>
		<page>
			<h2>Link, bold and italic (XML formatting mode)</h2>			
			<p>In the XML formatting mode, if you want to insert links in the middle of a text, or make it bold or italic (or other inline formatting), you need to resort to HTML tags and then escape them. You can do this either by including the tags in a <code>CDATA</code> section, or by replacing <![CDATA[<]]> with &amp;lt; and <![CDATA[>]]> with &amp;gt;.</p>
			<p>Since escaping escaped text is no child's play to present here, I recommend looking in the <code>ajax-s.xml</code> XML file how to do it.</p>			
		</page>
		<page>
			<h2>Using images (XML formatting mode)</h2>
			<p>When using images in XML formatting mode, you have three layouts to choose from:</p>
			<ul>
				<li>left</li>
				<li>center</li>
				<li>right</li>
			</ul>
			<p>Left and right will let the following p> texts flow next to it while center centers the image and uses a line for the image only. Remember that the layout you specify is case sensitive compared to the corresponding class name in the CSS.</p>
		</page>				
		<page>
			<h2>Requirements</h2>			
			<p>First of all, you need to have JavaScript turned on. Second, it only works in IE 6 and Mozilla-based web browsers as of now. This is because of the need to do on the fly transformations on the client, which means the necessary support for ActiveXObject or XSLTProcessor has to be there. I think Opera 9 will support XSLTProcessor and probably some upcoming version of Safari too, so more widespread support in the future is very likely.</p>			
		</page>
		<page>
			<h2>Rounding up</h2>			
			<p><a href="http://robertnyman.com/ajax-s/AJAX-S.zip">Download AJAX-S</a> now! Play around with it, tweak it and customize it. And let me know what you think!</p>
			<p>Robert Nyman, <a href="http://www.robertnyman.com">http://www.robertnyman.com</a></p>			
		</page>
	</pages>
</ajax-s>
