XML Source

 
xslt for dummies
Chapter 6 - We Want Results!
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002
  

To help you follow the XSLT stylesheet examples in this chapter, each example uses the coffee.xml source document shown in Listing 6-1 or, as appropriate, the smaller coffee-light.xml shown in Listing 6-2. Turn back to these code listings when you want to refer to the source.

Listing 6-1: Coffee.xml
start example
 <?xml version="1.0"?> <!-- coffee.xml --> <coffees> <region name="Latin America"> <coffee name="Guatemalan Express" origin="Guatemala"> <taste>Curiously Mild And Bland</taste> <price>11.99</price> <availability>Year-round</availability> <bestwith>Breakfast</bestwith> </coffee> <coffee name="Costa Rican Deacon" origin="Costa Rica"> <taste>Solid Yet Understated</taste> <price>12.99</price> <availability>Year-round</availability> <bestwith>Dessert</bestwith> </coffee> </region> <region name="Africa"> <coffee name="Ethiopian Sunset Supremo" origin="Ethiopia"> <taste>Exotic And Untamed</taste> <price>14.99</price> <availability>Limited</availability> <bestwith>Chocolate</bestwith> </coffee> <coffee name="Kenyan Elephantismo" origin="Kenya"> <taste>Thick And Chewy</taste> <price>9.99</price> <availability>Year-round</availability> <bestwith>Elephant Ears</bestwith> </coffee> </region> </coffees> 
end example
 
Listing 6.2: Coffee-light.xml
start example
 <?xml version="1.0"?> <!-- coffee-light.xml --> <coffee name="Guatemalan Express" origin="Guatemala"> <taste>Curiously Mild And Bland</taste> <price>11.99</price> <availability>Year-round</availability> <bestwith>Breakfast</bestwith> </coffee> 
end example
 

Pretty in pink?

The result documents in this chapter are formatted in a way that maximizes readability. Therefore, in many cases, when you run the stylesheet shown in the examples, the output looks slightly different, in terms of where line breaks or indenting occur. Dont worry about this for now; focus on the content first and later you can pretty up the results. When it comes to XML output, formatting is irrelevant more often than not, and is usually added only for readability. Having said that, I discuss how to format output in full detail in Chapter 13.

  
 
 
2000-2002    Feedback


XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net