Index: jrst2/src/site/en/rst/devel/XSLpresentation.rst diff -u /dev/null jrst2/src/site/en/rst/devel/XSLpresentation.rst:1.1 --- /dev/null Tue Jun 5 15:52:19 2007 +++ jrst2/src/site/en/rst/devel/XSLpresentation.rst Tue Jun 5 15:52:14 2007 @@ -0,0 +1,162 @@ +===================================== +XSL (Extensible Stylesheets Language) +===================================== + +.. contents:: Summary + +Presentation +============ + +XML is a data structural language, and not a data repressentation. So, XSL (Extensible Stylesheets Language) +is advise by W3C to doing XML document data representation. XSL is itself design with XML formalism, +that means that style sheet XSL is a well formed XML document. + +XSL is a language which makes possible to define style sheets for documents XML as well as CSS (Cascading +StyleSheets) for HTML or DSSSL (Document Style Semantics and Specification Language) for SGML. XSL is +inspired by DSSSL which it take many functionalities and is compatible with CSS. + +However, contrary to the CSS, XSL also enable to reprocess a XML document in order to modify +its structure completely, which enable with a XML document to be able to generate +other types of documents (PostScript, HTML, Tex, rtf,...) or a XML file of different structure. + +So, the data structuring (defined by XML) and their representation (defined by a language such as XSL) +are separate. That means that it is possible with a XML document to create documents using various +representations (HTML to create Web pages, WML for WAP mobiles,...). + +|presentationxsl| + +XSL document structure +====================== + + +XSL document being XML document, it starts obligatorily with the following tag:: + + + +In other part, any XSL style sheet are include between the tag and . +The tag xsl:stylesheet encapsulates tags xsl:template defining elements of XML document transformations. + +:: + + + + + + + + +Association of XSL sheet with XML document +========================================== + + +XSL style sheet (saved in a .xsl extension file) can be related to a XML document +(To XML document uses XSL sheet) inserting the following tag in the beginning of XML document:: + + + + + +Template rules +============== + +Template rules are XSL tags to define operations to be realized on XML document's elements +using XSL page, transform a XML tag to at least a HTML tag (generally several). + +So XML tag following:: + + + Pillou + Jean-François + + + VanHaute + Nico + + + Andrieu + Seb + + +Will be transform to following HTML tags:: + + + +The "match" attribute of the tag enable to define (with XPath notation) +the XML document's elements on which the transformation applies. + +Xpath notation enables to define patterns, character strings enable to locate +a node in XML document. Principals patterns are: + +======= ============= ================================================================= +Pattern Exemple Signification +======= ============= ================================================================= +``|`` left|right Indicate an alternative (a node either the other (or both)) +/ person/name Access path to the elements (person/arm/left) +* * Pattern "joker" indicating any element +// //person Indicate all the node descendants +. . Characterize the current node +``..`` ``..`` Indicate the parent node +@ @value Indicate a characteristic attribute +======= ============= ================================================================= + + +The transformation can be made: + +- by addition of text, +- by defining element transformation, elements which can define transformation rules + to be applied to the selected elements by match attribute + +This is an example of XSL sheet to transform XML towards HTML:: + + + + + + + Page title + + + + + + + +
    +
  • + + ... + +
  • +
+
+
+ + +This XSL sheet signification : + +* The first tag makes possible to apply a transformation to the whole of the document + (the value "/" of match attribute indicates the XML document's root element). This tag contains HTML tags + which will be transmitted in the tree result. +* The element indicates the root's direct children treatment. +* The tag transform person type elements. +* Finally the two elements and + return name and firstname tags values. + +Links +===== + +- Article : http://www.commentcamarche.net/xml/xmlxsl.php3 +- Diagram : http://fr.wikipedia.org/wiki/Extended_stylesheet_language_transformations + +.. |presentationxsl| image:: image/presentationXSL.png + Index: jrst2/src/site/en/rst/devel/externalDoc.rst diff -u /dev/null jrst2/src/site/en/rst/devel/externalDoc.rst:1.1 --- /dev/null Tue Jun 5 15:52:22 2007 +++ jrst2/src/site/en/rst/devel/externalDoc.rst Tue Jun 5 15:52:14 2007 @@ -0,0 +1,11 @@ +====================== +External documentation +====================== + +DocUtils web site : http://docutils.sourceforge.net/rst.html + +reStructured DTD : http://docutils.sourceforge.net/docs/ref/doctree.html + +XSL used to convert the XML into RST : http://www.merten-home.de/FreeSoftware/xml2rst/ + +To generate javadoc in RST form : http://java.sun.com/j2se/1.3/docs/tooldocs/javadoc/overview.html \ No newline at end of file Index: jrst2/src/site/en/rst/devel/Todo.rst diff -u /dev/null jrst2/src/site/en/rst/devel/Todo.rst:1.1 --- /dev/null Tue Jun 5 15:52:25 2007 +++ jrst2/src/site/en/rst/devel/Todo.rst Tue Jun 5 15:52:14 2007 @@ -0,0 +1,22 @@ +==== +Todo +==== + +This is a list of the tasks which remains to be made. If somebody wants to help +or has ideas, don't hesitate. + +- multiformat date +- xsl file to converts xhtml -> xdoc + +- English documentation (somebody to correct me :) ) +- ant rules to generation help like : + + destination is destination folder + extension is extension modification of the source file with this one. + +- export yo pretion, magic, or an other presentation tool. + +- to allow the importation of other format that rst, for example .sxw. + to make possible the simple convertion of the .sxw in rst. + +- make a doclet to produce RST JavaDoc Index: jrst2/src/site/en/rst/devel/librairies.rst diff -u /dev/null jrst2/src/site/en/rst/devel/librairies.rst:1.1 --- /dev/null Tue Jun 5 15:52:25 2007 +++ jrst2/src/site/en/rst/devel/librairies.rst Tue Jun 5 15:52:14 2007 @@ -0,0 +1,31 @@ +===================== +Various librairy used +===================== + +.. contents:: Sommary + +dom4j_ +====== + +Dom4j_ is an easy to use, open source library for working with XML, XPath and XSLT on the Java platform +using the Java Collections Framework and with full support for DOM, SAX and JAXP. + +javax.xml.transform_ +==================== + +Librairy used to the XSL transformation. + +SDoc_ +===== + +SDoc_ provide Swing composants which includes syntax coloration for many languages. + +Xmlunit_ +======== + +Xmlunit_ used to compare two XML files to show their differences. + +.. _dom4j: http://www.dom4j.org +.. _javax.xml.transform: http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/package-summary.html +.. _SDoc: http://sdoc.sourceforge.net/wiki/pmwiki.php +.. _Xmlunit: http://xmlunit.sourceforge.net/ Index: jrst2/src/site/en/rst/devel/developerDoc.rst diff -u /dev/null jrst2/src/site/en/rst/devel/developerDoc.rst:1.1 --- /dev/null Tue Jun 5 15:52:25 2007 +++ jrst2/src/site/en/rst/devel/developerDoc.rst Tue Jun 5 15:52:14 2007 @@ -0,0 +1,126 @@ +======================= +Developer Documentation +======================= + +.. contents:: Summary + +Class diagram +============= + +|classDiagramme| + +AdvencedReader Class is used to easily read RST file using specifics methods: + - String readLine() : return a line. + - String[] readLines(int nb) : return nb lines + - String[] readWhile(Pattern p) : return lines while they match to the pattern + +... + +**JRSTLexer** Class uses **AdvencedReader** to build XML file, it browses all document to isolate the data types, parameters +and content, so assembling all usefuls informations to build the final XML. It will start by document's head (peekHeader(), +peekDocInfo()), and finally peeking on the body (peekBody()). + +**JRSTReader** Class uses **JRSTLexer**, it interprets the returned XML to build the final XML. This one is conform to the Docutils_ +DTD. This Class sometimes needs to be called itself when a document part must be interpreted independently of rest. For exemple, +if a table contains a list, we extract the cell's informations for being interpreted. Admonition's content must be considered like an +independant document. When generation is finished, Class **JRSTReader** build summary (composeContent()) and parse all the inline +specificities (inline()), like, italic or bold words, links, footnotes... All that can appear inside a line. + +**JRST** Class contents main() method, it's looking after options, files reading and writing. It reads document, parses +it with **JRSTReader** Class and transforms with the wish XSL (if needed) by using **JRSTGenerator** Class. + +Generation +========== + +|diagrammegeneration| + +Links : + + * xml2rst.xsl (convertion from xml of docutils towards rst) : http://www.merten-home.de/FreeSoftware/xml2rst + * dn2dbk.xsl (convertion from xml of docutils towards docbook) : http://membres.lycos.fr/ebellot/dn2dbk + * nwalsh xsl (convertion from docbook towards FO and xhtml) : http://nwalsh.com + + * XMLmind (convertion from FO towards ODT and RTF) : http://www.xmlmind.com/foconverter/what_is_xfc.html + * FOP (convertion from FO towards PDF) : http://xmlgraphics.apache.org/fop + +Use exemple +=========== + +We want to convert this following reStructuredText document (text.rst) to html (text.html) : + +:: + + ===== + Title + ===== + + :Author: Letellier Sylvain + + .. Attention:: this text must be interpreted independently + +So we use this following command:: + + JRST -t html -o text.html text.rst + +This sequence diagramme describes the parser's mechanism throughout the generation : + +|sequanceDiagramme| + +**JRSTGenerator** Class with the XSL file rst2xhtml.xsl, returns following html file:: + + + + + + + Title + + +

Title

+ + + + + + + + + +
author :Letellier Sylvain
+
+

attention :

+

+

this text must be interpreted independently

+

+
+ + + +What display the page (CSS was added to layout) : + +.. topic:: Titre + + :Author: Letellier Sylvain + .. Attention:: this text must be interpreted independently + +Uses axternal XSL +================= + +JRST able to transform DocUtils XML with external XSL files. +You must use this following command:: + + JRST -x XSLfile, XSLfile2 RSTfile + +or:: + + JRST --xslFile XSLfile, XSLfile2 RSTfile + +JRST process RST file, returned DocUtils_ XML will be transformed by JRSTgenerator Class +starting by XSLfile then XSL2file2... + +XSL documentation is available here_. + +.. _here: presentationXSL.html +.. _DocUtils: http://docutils.sourceforge.net/docs/ref/doctree.html +.. |classDiagramme| image:: images/DiagrammeClass.png +.. |sequanceDiagramme| image:: images/DiagrammeSequance.png \ No newline at end of file