XSLT » Elements » DevGuru Staff List XML file

For all of our examples in this XSLT Quick Reference, we will use one of two XML files. Note that both files contain the same information: the name, dob (date of birth), age, address, and phone (number) for six DevGuru staff members. In the first example, each piece of data in contained between the appropriate opening and closing element. In the second example, each piece of data is assigned to an attribute of an element.

DevGuru Staff List XML file

Here is the source code for devguru_staff_list.xml:

Examples

Code:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="devguru_staff_list.xsl
<devguru_staff>
<programmer>
<name>Bugs Bunny</name>
<dob>03/21/1970</dob>
<age>31</age>
<address>4895 Wabbit Hole Road</address>
<phone>865-111-1111</phone>
</programmer>
<programmer>
<name>Daisy Duck</name>
<dob>08/09/1949</dob>
<age>51</age>
<address>748 Golden Pond</address>
<phone>865-222-2222</phone>
</programmer>
<programmer>
<name>Minnie Mouse</name>
<dob>04/13/1977</dob>
<age>24</age>
<address>4064 Cheese Factory Blvd</address>
<phone>865-333-3333</phone>
</programmer>
<programmer>
<name>Pluto</name>
<dob>07/04/1979</dob>
<age>21</age>
<address>414 Dog Lane</address>
<phone>865-333-3333</phone>
</programmer>
<programmer>
<name>Porky Pig</name>
<dob>11/30/1956</dob>
<age>44</age>
<address>555 Mud Pit Pike</address>
<phone>865-444-4444</phone>
</programmer>
<programmer>
<name>Road Runner</name>
<dob>01/19/1953</dob>
<age>48</age>
<address>135 Desert View Street</address>
<phone>none</phone>
</programmer>
</devguru_staff>
Language(s): XSLT

DevGuru Staff List Two XML file

As stated above, this second version contains the same information, but each piece of information is assigned to an attribute of the programmer element.

Here is the source code for devguru_staff_list_two.xml:

Examples

Code:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="devguru_staff_list_two.xsl"?>
<devguru_staff>
<programmer
name="Bugs Bunny"
dob="03/21/1970"
age="31"
address="4895 Wabbit Hole Road"
phone="865-111-1111"
/>
<programmer
name="Daisy Duck"
dob="08/09/1949"
age="51"
address="748 Golden Pond"
phone="865-222-2222"
/>
<programmer
name="Minnie Mouse"
dob="04/13/1977"
age="24"
address="4064 Cheese Factory Blvd"
phone="865-333-3333"
/>
<programmer
name="Pluto"
dob="07/04/1979"
age="21"
address="414 Dog Lane"
phone=""
/>
<programmer
name="Porky Pig"
dob="11/30/1956"
age="44"
address="555 Mud Pit Pike"
phone="865-444-4444"
/>
<programmer
name="Road Runner"
dob="01/19/1953"
age="48"
address="135 Desert View Street"
phone="865-555-5555"
/>
</devguru_staff>
Language(s): XSLT

See Also: