As with any other application, the first thing you must decide when you plan an XML application is how to represent your data. Data design is important because it affects which template rules you will use in the XSLT style sheet, and what kind of performance your XSLT solution can achieve.
In an XSLT solution, data comes in the form of XML documents. You can store data values in an XML element, either as the content of the element or as an attribute value. As an illustration, this example puts company information as the content of some elements, and the sales numbers as attributes of others. All this information is contained in the input XML file, Sales.xml.
To create the Sales.xml file
<?xml version="1.0"?> <sales> <summary> <heading>Scootney Publishing</heading> <subhead>Regional Sales Report</subhead> <description>Sales report for the West Coast, Central and East Coast regions</description> </summary> <data> <region> <name>West Coast</name> <quarter number="1" books_sold="24000" /> <quarter number="2" books_sold="38600" /> <quarter number="3" books_sold="44030" /> <quarter number="4" books_sold="21000" /> </region> <region> <name>Central</name> <quarter number="1" books_sold="11000" /> <quarter number="2" books_sold="16080" /> <quarter number="3" books_sold="25000" /> <quarter number="4" books_sold="29000" /> </region> <region> <name>East Coast</name> <quarter number="1" books_sold="27000" /> <quarter number="2" books_sold="31400" /> <quarter number="3" books_sold="40100" /> <quarter number="4" books_sold="30000" /> </region> </data> </sales>
Internet Explorer shows the file as an unformatted XML listing. This is the default display for Internet Explorer when viewing an XML file.
Basic XSLT processing involves the following: