O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Our First Example

For our first example, we’ll have a set of U.S. postal addresses that we want to sort. (No chauvinism is intended here; obviously every country has different conventions for mailing addresses. We just needed a short sample document that can be sorted in many useful ways.) Here’s our original document:

<?xml version="1.0"?>
<!-- names.xml --> <addressbook> <address> <name> <title>Mr.</title> <first-name>Chester Hasbrouck</first-name> <last-name>Frisby</last-name> </name> <street>1234 Main Street</street> <city>Sheboygan</city> <state>WI</state> <zip>48392</zip> </address> <address> <name> <first-name>Mary</first-name> <last-name>Backstayge</last-name> </name> <street>283 First Avenue</street> <city>Skunk Haven</city> <state>MA</state> <zip>02718</zip> </address> <address> <name> <title>Ms.</title> <first-name>Natalie</first-name> <last-name>Attired</last-name> </name> <street>707 Breitling Way</street> <city>Winter Harbor</city> <state>ME</state> <zip>00218</zip> </address> <address> <name> <first-name>Harry</first-name> <last-name>Backstayge</last-name> </name> <street>283 First Avenue</street> <city>Skunk Haven</city> <state>MA</state> <zip>02718</zip> </address> <address> <name> <first-name>Mary</first-name> <last-name>McGoon</last-name> </name> <street>103 Bryant Street</street> <city>Boylston</city> <state>VA</state> <zip>27318</zip> </address> <address> <name> <title>Ms.</title> <first-name>Amanda</first-name> <last-name>Reckonwith</last-name> </name> <street>930-A ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required