A question arising in the mind of XML/DTD designers is whether to model and encode certain information using an element, or alternatively, using an attribute. The answer to the above question is not clear-cut. But the general guideline is:
The principle is data goes in elements and metadata goes in attributes. Elements are also useful when they contain special characters like “<”, “>”, etc which are harder to use in attributes. The most important reason to use element is its extensibility. It is far easier to create child elements to reflect complex content than to break an attribute into pieces. You can use attributes along with elements to refine your understanding of that element with extra information. Attributes are less verbose but using attributes instead of child elements with the view of optimizing document size is a short term strategy, which can have long term consequences.
XSLT, or the Extensible Stylesheet Language for Transformations, is a formal W3C recommendation that was approved on November 16, 1999. It is a language in both the markup and the programming sense of the word in that it provides a mechanism to transform an XML structure into either another XML structure, HTML, or any number of other text-based formats (such as SQL). While it can be used to create the display output of a Web page, the real power of XSLT is its ability to change the underlying structures rather than simply the media representations of those structures, as is the case with cascading style sheets (CSS).
The origins of XSLT derive from the limitation of CSS to provide a way to make structural alterations to an XML document, at a time when the compelling reason for the creation of XML was oriented more toward creating a replacement of XML than of providing a universal data description language. The Extensible Stylesheet Language (XSL) thus became an effort to build a new way of formatting XML.
However, it soon became evident to both the participants in the W3C Style Working group and to early XML adopters that a language that could transform XML from one format to another would radically simplify much of the code that was being generated. Microsoft released a proposal to the W3C, initially termed the XML Query Language (or XQL), which in turn was adopted by the W3C as the XSL Pattern language. Most of the features of this language in turn found their way into the final XSLT specification.
The resulting standard incorporates parameters for modifying XSLT for varying initial conditions, named templates for creating functional blocks of code, and a number of enhanced functions for numeric and string manipulation. XSLT also has provisions for adding functionality built into the language, something that Microsoft takes advantage of in its implementation to add a number of highly useful features including access to COM objects and scripting.
XPath is a query language defined for XML that provides a simple syntax to select the subset of nodes in a document. With XPath, you can retrieve collections of elements by specifying a directory-like path (hence the name) as well as conditions placed on the path. XPath is critical both for XSLT and the XML DOM, and also has ties to the XPointer specification (which lets you select fragments of documents based on combinations of Uniform Resource Locators [URLs] and XPath expressions).
XSLT is a language that transforms one XML document to another. That means it provides a mechanism for single-sourcing XML data, for creating rich views in Web pages that can be dynamically changed by the user, and for filtering data for targeted communications. XSLT is robust enough to encode business rules. It can generate graphics (not just Web pages) from data. It can even handle communicating with other servers—especially in conjunction with scripting modules that can be integrated into the XSLT—and it can generate the appropriate messages within the body of XSLT itself. While it is not likely to replace most of the interactions within desktop systems (for reasons pertaining to both performance and ease of use), XSLT will likely end up becoming one of the primary “programming” languages for communicating between systems within the next few years.