{"id":86,"date":"2013-11-10T19:07:56","date_gmt":"2013-11-10T19:07:56","guid":{"rendered":"https:\/\/jbfsoftware.com\/wordpress\/?page_id=86"},"modified":"2024-12-02T05:42:09","modified_gmt":"2024-12-02T04:42:09","slug":"sevilla-xslt","status":"publish","type":"page","link":"https:\/\/jbfsoftware.com\/wordpress\/sevilla-xslt\/","title":{"rendered":"Using XSLT with Sevilla"},"content":{"rendered":"<p>One of the reports Sevilla can produce is the XML dump. Hardly understood by some and one of the most appreciated features by others, it&#8217;s time to explain one of the most interesting possibilities: To create web pages from the dump using style sheet processing.<\/p>\n<p>Style sheet processing is a technique that processes an XML file, based on some cookbook, to some kind of output. The cookbook is an XML stylesheet and is also an XML file. It is written in a stylesheet processing language: XSL. The style sheet processing is called XSLT. XML stylesheet language transformation.<\/p>\n<p>It is important to know how to build these stylesheets if you want to use the feature. I will not start a crash course XSLT here because there are various resources on the web, like <a href=\"http:\/\/www.w3schools.com\/\" target=\"_blank\" rel=\"noopener\">http:\/\/www.w3schools.com<\/a>. Better even is buying a good XML book. Some global understanding of html and xml in general is strongly recommended before building style sheets.<\/p>\n<p>Now lets go into some detail what style sheet processing means. Look at the schema:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/joomla15\/..\/data\/img\/Sevilla\/XSLT01.gif\" alt=\"\" width=\"595\" height=\"246\" align=\"bottom\" \/><\/p>\n<p>Style sheet processing is done by a style sheet processor. It picks up a style sheet, and an input file. Then it processes the input file, based on the rules in the stylesheet to an output file. The output file can for instance be an html document.<\/p>\n<p>Now you need three things to generate the output, don&#8217;t you? You need a style sheet processor, a style sheet and an XML document to process.<\/p>\n<p>If we want to create html pages from the XML output from Sevilla we first need an XML output. This is easy: generate an XML dump from Sevilla, using the option in the report menu. This Sevilla output serves as the XML document in the image above, and hence as the input document for the style sheet processor.<\/p>\n<p>Next you need a style sheet processor. There are various but I found Xalan to be a good one. It can be downloaded from <a href=\"http:\/\/xml.apache.org\/\" target=\"_blank\" rel=\"noopener\">http:\/\/xml.apache.org<\/a>, but I added an easy to install version <a href=\"\/res\/misc\/Xalan-1.10.0.exe\">here<\/a>. Xalan needs an other program, called Xerces. This can be download from <a href=\"http:\/\/xml.apache.org\/\" target=\"_top\" rel=\"noopener\">http:\/\/xml.apache.org<\/a> too, but an easy to install version is <a href=\"\/res\/misc\/Xerces-2.7.0.exe\">here<\/a>. Get Xalan and Xerces and install them. Another style sheet processor can do the job, but the rest of this page assumes Xalan. Install Xalan and Xerces.<\/p>\n<p>Last we need the stylesheet. You can use the stylesheets I used for chess club <a href=\"http:\/\/www.caissa-eenhoorn.nl\/\" target=\"_blank\" rel=\"noopener\">Ca\u00efssa-Eenhoorn<\/a>. You can get them <a href=\"\/res\/sevilla\/xslt-example.zip\">here<\/a>. Download them and unpack the file into some directory. But you can also try Tom Visser&#8217;s stylesheets. Tom, who is the driving force behind the XML dump, created completely different ones for his club <a href=\"http:\/\/www.schaakclub-roden.nl\/\">Schaakclub Roden<\/a> and kindly permitted me to add them <a href=\"\/res\/sevilla\/xslt-roden.zip\" target=\"_blank\" rel=\"noopener\">here<\/a>. The two together show well the endless possibilities this technique offers.<\/p>\n<p>There a two so called <em>bat<\/em> files which need modification for your specific situation. To edit them, open them with notepad or wordpad or a similar tool. Use of Word is not recommended. First edit xalan.bat. It looks something like this:<\/p>\n<table border=\"1\" width=\"700\">\n<tbody>\n<tr>\n<td class=\"program\">@echo off<br \/>\nrem set the location of Xalan en Xerces<br \/>\nset XALAN=C:\\xml\\xalan<br \/>\nset XERCES=C:\\xml\\xerces<br \/>\nrem call Xalan<br \/>\nset OLDPATH=%PATH%<br \/>\nset PATH=%PATH%;%XALAN%\\bin;%XALAN%\\lib;%XERCES%\\lib;%XERCES%\\bin<br \/>\n%XALAN%\\bin\\xalan %1 %2 %3 %4 %5 %6 %7 %8 %9rem clean-up the environment variables<br \/>\nset PATH=%OLDPATH%<br \/>\nset OLDPATH=<br \/>\nset XERCES=<br \/>\nset XALAN=<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Make sure the locations of Xalan and Xerces are set correctly, to the paths where you installed them. Change it according to your situation and save the file.<\/p>\n<p>The second bat files is build.bat, and looks like this:<\/p>\n<table border=\"1\" width=\"700\">\n<tbody>\n<tr>\n<td class=\"program\">@echo off<br \/>\nrem setting which paring system you use<br \/>\nset SYST=KEIZER<br \/>\nrem set SYST=SWISS<br \/>\nrem setting where the style sheets are to be found<br \/>\nset XSL=.<br \/>\nrem settings that control the location of the .sev file and the .xml output file<br \/>\nset SRC=.\\Competition.sev<br \/>\nset DUMP=.\\output.xmlrem the main part: running xalan<br \/>\ncall xalan.bat -o &#8220;games.html&#8221; &#8220;%SRC%&#8221; &#8220;%XSL%\\games.xsl&#8221;<br \/>\nrem call xalan.bat -o &#8220;histbsc.html&#8221; &#8220;%SRC%&#8221; &#8220;%XSL%\\history.xsl&#8221;<br \/>\nif not &#8220;%SYST%&#8221; == &#8220;SWISS&#8221; call xalan.bat -o &#8220;ranking.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\ranking.xsl&#8221;<br \/>\nif &#8220;%SYST%&#8221; == &#8220;SWISS&#8221; call xalan.bat -o &#8220;ranking.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\rankingsws.xsl&#8221;<br \/>\ncall xalan.bat -o &#8220;rating.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\rating.xsl&#8221;<br \/>\ncall xalan.bat -o &#8220;tpr.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\tpr.xsl&#8221;<br \/>\ncall xalan.bat -o &#8220;sevperc.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\sevperc.xsl&#8221;<br \/>\ncall xalan.bat -o &#8220;rtginc.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\rtginc.xsl&#8221;<br \/>\nif not &#8220;%SYST%&#8221; == &#8220;SWISS&#8221; call xalan.bat -o &#8220;history.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\exthist.xsl&#8221;<br \/>\nif &#8220;%SYST%&#8221; == &#8220;SWISS&#8221; call xalan.bat -o &#8220;history.html&#8221; &#8220;%DUMP%&#8221; &#8220;%XSL%\\exthistsws.xsl&#8221;rem clean environment variables<br \/>\nset DUMP=<br \/>\nset SRC=<br \/>\nset XSL=<br \/>\nset SYST=<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The line starting with <span class=\"program\">set SYST<\/span> should reflect the pairing system used. If you use a Swiss competition remove the <span class=\"program\">rem<\/span> from the line with Swiss, and add it to the line with Keizer:<br \/>\n<span class=\"program\">rem set SYST=KEIZER<br \/>\nset SYST=SWISS<\/span><\/p>\n<p>Then the lines with <span class=\"program\">set SRC<\/span> and <span class=\"program\">set DUMP<\/span> should tell the location of your Sevilla file, and of your Sevilla XML output document. Change the lines as needed for your situation. Then save the file.<\/p>\n<p>Now we have prepared everything to create the documents. This is very easy: just run the file<span class=\"program\"> build.bat<\/span>. You can doubleclick it from Explorer, or open a command window and type <span class=\"program\">build<\/span>. After a short while the program shoud end and the html documents should be generated in the same directory. If you try to view them by double clicking some nice page should appear.<\/p>\n<p>You can easily modify the xsl documents provided if you want to. To make bigger changes XSLT knowledge is needed. If you are somewhat experienced with XSLT the big challenge is to create your own style sheets to make much nicer pages than I did &#8211; you can of course still peek into my or Tom&#8217;s examples because you still have to deal with the same Sevilla output.<\/p>\n<p>Good luck.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the reports Sevilla can produce is the XML dump. Hardly understood by some and one of the most appreciated features by others, it&#8217;s time to explain one of the most interesting possibilities: To create web pages from the &hellip; <a href=\"https:\/\/jbfsoftware.com\/wordpress\/sevilla-xslt\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-86","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/pages\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":0,"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/pages\/86\/revisions"}],"wp:attachment":[{"href":"https:\/\/jbfsoftware.com\/wordpress\/wp-json\/wp\/v2\/media?parent=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}