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 ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.