XSLT: Examples


Example: XML Restaurant Menu


	<?xml version="1.0" encoding="UTF-8"?>
	<?xml-stylesheet type="text/xsl" href="menu2.xsl" ?>
	<restaurant_menu>
	  <food>
		<name>Shrimp & Scallop Linguine</name>
		<price>$11.95</price>
		<description>Sautée 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>
		<category>Chicken</category>
	  </food>
	  <food>
		<name>Grilled Artichoke</name>
		<price>$8.50</price>
		<description>Grilled artichoke with sea salt, truffle, grana padano cheese, lemon aioli.</description>
		<category>Small Plate</category>
	  </food>
	</restaurant_menu>
	

Run It With Linked XSLT Stylesheet(formatting XML):

menu2.xml


Run raw XSL file:

This file type is in a tree format that can clicked to expand and collapse tree branches.

menu2.xml


Example: Vinyl Record Collection

Run It With Linked XSLT Stylesheet (formatting XML):

vinyl.xml


Run raw XSL file:

This file type is in a tree format that can clicked to expand and collapse tree branches.

vinyl.xml