Inside XSL-T (4/4) - exploring XML
Inside XSL-T
Creating result elements
All elements in the style sheet that are not from the XSL namespace will end up in the result document tree. The xsl:element element allows an element to be created with a computed name. The content of the xsl:element element is a template for the attributes and children of the created element. In a similar fashion XSL elements exist for creating other elements such as attributes, text, processing instructions, and comments.
Looping, selecting and sorting
While the template mechanism of XSLT is the preferred way of transforming documents, instructions like xsl:for-each, xsl:if, and xsl:choose (aka case, switch) are included for allowing the imperative programmer to iterate over a set and selectively process nodes. Finally a powerful sort operation allows for a node set to be reordered numerically and alphanumerically.Conclusion
Until browsers with support for the yet unfinished XSL formatting objects arrive, the only way to visualize XML documents is to transform them into HTML or to attach CSS to XML. Another popular area for XSLT will be the exchange of business information between different systems and organizations in the form of XML documents over the Internet, where a "style sheet" can be used to translate from one Document Type Definition (DTD) to another. XSLT is a powerful mechanism for transforming XML documents into something else, even non-XML formats such as RTF or PDF.
Produced by Michael Claßen
All Rights Reserved. Legal Notices.
URL: https://www.webreference.com/xml/column17/4.html
Created: Aug 13, 2000
Revised: Aug 13, 2000