Click on the title to open Help in a new window. This is a general behaviour of all windows. You can download entire tutorial
Software can simplify some tasks both for authors and for readers. But contents is more important than data. Please help to build a valuable resource for XSL community.Help both from experienced XSL programmers and novices in the field is very important.
The program needs some polishing, but most functions are already here. The Help file is in this moment rudimental, it will be rewritten when time permits.
Hyperlink texts are not underlined, but they are colored and differ substantialy from its surrounding. The behaviour of the links depends on context. They can open an email message to the author of example or book, click on a title will open a new window with the contents of given frame, click in XSL source frame will display explanation in left frame, click on example number will open the example.
A click on the button in upper left window reloads start page of the program.
If you want to contribute, please send me an email (email@example.com) with your example or book file (either inside the text or as an attachement). I will process the file and publish it on the Zvon website. This mechanism will change in the future but it seems to be reasonable in initial stage of the project.
When I started to write this program I had two basic ideas. It occured to me that it would be very useful for a novice or for someone who wants to learn a new feature, if he/she can look at source file, XSL stylesheet and output at the same moment. I am a strong believer in 'teaching by examples', a minimal necessary explanation and a lot of examples is better than a long story sprinkled with a few examples.
But I am not an expert in the field and I am not even longing to become one. For myself XSL and few other standards like XML or HTML are just very useful tools which help me in my own areas of interest. On the other hand if people acquire at least basic skills with such tools, it will help me a lot in my future projects.
So although I plan to contribute to the examples pool, I am aware of the fact that I can only scratch the full potential of such a system.
And there was my second idea. There are nowadays some real experts, who can realy teach some cool ways how to do things and there is a lot of newcomers who are now struggling their ways through XSL jungle. And a novice or an average user can often provide a better help for a beginner than an expert who is mentally too far ahead. So both novices and experts are useful in tutorial writting.
If there was some simple mechanism how to share our common knowledge pool, it would be of great help to many of us. Well, I hope I have found quite a decent one.
An example is a building block of the system. The example consist of short description, XML sample and one or several XSL stylesheets. All is provided in one XML file. A parser reads the file and generates all necessary files for publication. As the output files are generated, we can be sure that all sources really corresponds each to other.
The DTD for input file is shown below. I actually do not validate input, as I have tags inside xmlSource and xslStylesheet elements and I do not want to mess with CDATA sections. But at least it is a convenient form of documentation.
<!ELEMENT xslTutorial (index?,description,xmlSource, attValues?,xslStylesheet+)> <!ATTLIST xslTutorial creator CDATA #REQUIRED> <!ELEMENT index EMPTY> <!ATTLIST index keywords CDATA #REQUIRED> <!ELEMENT description (#PCDATA|stylesheet)*> <!ELEMENT xmlSource ANY> <!ATTLIST xmlSource id ID #REQUIRED> <!ELEMENT xslStylesheet ANY> <!ATTLIST xslStylesheet id ID #REQUIRED> <!ELEMENT stylesheet EMPTY> <!ATTLIST stylesheet id IDREF #REQUIRED> <!ELEMENT attValues (value)*> <!ELEMENT value (#PCDATA)> <!ATTLIST value match CDATA #REQUIRED>
The root element is xslTutorial and creator attribute tracks the author of the example. I consider very important the fact that each example has its author quoted. According to my view everybody who contributes to such a project should be given proper credit and in the same time it should improve quality of the entries if authors are not anonymous.
Optional index element gives the author the opportunity to specify which keywords are especially pertinent to the example. From these keywords the Keywords index on the front page is generated.
A description is shown in the left frame when an example is displayed. The optional stylesheet element is in output replaced by link to stylesheet specified with id attribute.
Element attValues makes specified data clickable in XSL stylesheet display. While name of XSL elements and attributes can be generated automatically, the values are to diverse to provide a universal mechanism.
xmlSource and xslStylesheet contain the actual examples. The starting tags are generated automatically.
And this is the source from whih example 1 was generated
<xslTutorial creator="firstname.lastname@example.org"> <index keywords='// /'/> <description>With XSL you can freely modify any source text. <stylesheet id="id4"/> and <stylesheet id="id5"/> produce different output from the same source file.</description> <example id="id1"> <xmlSource id="id3"> <title>XSL</title> <author>John Smith</author> </xmlSource> <attValues> <value match="//title">matches any title element anywhere in the document. </value> <value match="//author">matches any author element anywhere in the document. </value> <value match="/">matches the root element. </value> </attValues> <xslStylesheet id="id4"> <xsl:template match="/"> <H1><xsl:value-of select="//title"/></H1> <H2><xsl:value-of select="//author"/></H2> </xsl:template> </xslStylesheet> <xslStylesheet id="id5"> <xsl:template match="/"> <H2><xsl:value-of select="//author"/></H2> <H1><xsl:value-of select="//title"/></H1> </xsl:template> </xslStylesheet> </example> </xslTutorial>
Examples are a very useful, but if you want to really explain anything, they are not sufficient. At the same time, it would be very helpful, if examples could be recycled in different context. With this software you can form chapters from individual examples and books from chapters.
Entire book is also specified in a XML file. The following paragraph shows a prototype. In this case a book with name Introduction to XSL is created. Contents of the book appears in the right frame of start Page. The numbers give numbers of individual examples to be used in a chapter. I hope that the format is self-explanatory. I will provide further details when matters become more complicated.
<book email@example.com'> <title>Introduction to XSL</title> <chapter name='Introduction' pages='1 4'/> <chapter name='Advanced features' pages='5 6 7 5'/> <chapter name='END' pages='2 3 2'/> </book>