XML/XSLT: Examples


Example: XML Restaurant Menu


	<?xml version="1.0" encoding="UTF-8"?>
	<restaurant_menu>
	  <food>
		<name>Shrimp & Scallop Linguine</name>
		<price>$11.95</price>
		<description>Sautéed shrimp and sea scallops tossed with basil in our tomato cream sauce.</description>
		<category>Pasta</category>
	  </food>
	  <food>
		<name>Steak Oscar</name>
		<price>$17.95</price>
		<description>8-oz. center-cut sirloin, topped with premium lump crabmeat and citrus butter sauce. Served with grilled asparagus and mashed potatoes.</description>
		<category>Steaks</category>
	  </food>
	  <food>
		<name>Jerk Chicken</name>
		<price>$8.95</price>
		<description>Jerk chicken breast, fresh asparagus and mushrooms tossed in a Parmesan cream sauce with bow-tie pasta.</description>
		<calories>Chicken</calories>
	  </food>
	  <food>
		<name>Grilled Artichoke</name>
		<price>$8.50</price>
		<description>Grilled artichoke with sea salt, truffle, grana padano cheese, lemon aioli.</description>
		<calories>Small Plate</calories>
	  </food>
	</restaurant_menu>
	

Screenshot of Output:

  screenshot of XML page

Run It:

When you run an XML file in a browser the trees can be clicked to expand and close them.

menu.xml