A year ago, I tried to explain how effectively data and its presentation can be separated in a web applicatoin with the help of XML and XSL. In a few words, instead of using templating (like JSP, Velocity, FreeMarker, etc.) and injection of data into HTML, we compose them in the form of an XML document and then let the XSL stylesheet transform them into HTML. Here is a brief example of how all this can be used together with the Takes framework.
Tag Archives: XSL
XSL transformation (XSLT) is a powerful mechanism for converting one XML document into another. However, in Java, XML manipulations are rather verbose and complex. Even for a simple XSL transformation, you have to write a few dozen lines of code — and maybe even more than that if proper exception handling and logging is needed. jcabi-xml is a small open source library that makes life much easier by enabling XML parsing and XPath traversing with a few simple methods. Let’s see how this library helps in XSL transformations.
First, take a look at a practical example — rultor.com — a hosted DevOps assistant that automates release, merge, and deploy operations. Rultor keeps each conversation session with an end user (a.k.a. “talk”) in a DynamoDB record. There are multiple situations to handle in each talk; that’s why using multiple columns of a record is not really feasible. Instead, we’re keeping only a few parameters of each talk in record columns (like ID and name) and putting all the rest in a single XML column.
In this example we are going to see how you can install and use an XML editor for your Eclipse IDE. XML is a mark-up language that has its own unique characteristics, and it’s used in a vast number of applications, mostly web based, but in recent years it plays a crucial role generally in universal, platform independent information exchanging between systems. A developer can be greatly supported by an IDE when editing XML files or projects, as it offers features like code completion, code generation etc. Of course, a decent IDE XML Pluging would not only allow you to edit pure raw XML files, but also of XML-like files like HTML, XHTML, WSDL, XSD, XSL and even CSS.
There are many XML Editors as Eclipse plugins that do the job and most of them are quite good. In this example though, we are going to use a famous one, Oxygen XML