The XSLT
langage
How to transform XML to?
XML to LaTeX TransformationTayeb Lemlouma, June 2001Most of LaTeX users type their LaTeX model once, and then use the same model for further documents. To simplify the use of LaTeX especially for those who never try LaTeX in papers and reports redaction I have developed a Style Sheet that allows to transform XML documents to LaTeX documents. The input XML documents structure is very simple, and can be edited easily. To do so, I defined a simple LaTeX DTD that can respond to the most general case of the LaTeX use when redacting scientific papers. Of course, the Style Sheet and the DTD can be ameliorated and modified according to authors particular needs. My Style Sheet shows how can we dapt content for particular constraints using transformations. When developing the Style Sheet we can feel some of the XSLT limitations, especially when processing data at a very low level. The Style Sheet that I have developed uses two recursive functions, be careful for stack over errors. This case may appear if the length of the text is very high. A sweet solution can be to define a new XSLT function by modifying the ’translate()’ function code (FuncTranslate.java). The 'translate()' function admits three arguments. It returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. The function to be redefined is similar to ‘translate()’ one and very easy to design. It must replace a character by the corresponding string of character (and not character). In the following you can find : the LaTeX DTD, the Style Sheet and a complete example that shows how to transform XML to LaTeX: The LaTeX DTD: A Document Type Definition of LaTeX documents |