Your assignment is to transform people.xml into an HTML page that resembles people_output.html. As part of this transformation, you must calculate the person’s age at his or her death. Calculating the age at death is more complicated than simply subtracting the birth year from the death year. You must also take into account whether or not the person has had a birthday in the year of his or her death.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE people [
<!ELEMENT people (person+)>
<!ELEMENT person (#PCDATA)>
<!ATTLIST person
birth CDATA #REQUIRED
death CDATA #IMPLIED
source CDATA #IMPLIED>
]>
<people>
<person birth="1837-04-05"
death="1909-04-10"
source="https://en.wikipedia.org/wiki/Algernon_Charles_Swinburne">
Algernon Charles Swinburne
</person>
<person birth="1802-02-26"
death="1885-05-22"
source="https://en.wikipedia.org/wiki/Victor_Hugo">
Victor Hugo
</person>
<person birth="1788-01-22"
death="1824-04-19"
source="https://en.wikipedia.org/wiki/Lord_Byron">
George Gordon, Lord Byron
</person>
<person birth="1795-10-31"
death="1821-02-23"
source="https://en.wikipedia.org/wiki/John_Keats">
John Keats
</person>
<person source="https://en.wikipedia.org/wiki/Percy_Bysshe_Shelley"
birth="1792-08-04"
death="1822-07-08">
Percy Bysshe Shelley
</person>
<person source="https://en.wikipedia.org/wiki/Christina_Rossetti"
birth="1830-12-05"
death="1894-12-29">
Christina Rossetti
</person>
<person source="https://en.wikipedia.org/wiki/Dante_Gabriel_Rossetti"
birth="1828-05-12"
death="1882-04-09">
Dante Gabriel Rossetti
</person>
<person source="https://en.wikipedia.org/wiki/William_Blake"
birth="1757-11-28"
death="1827-08-12">
William Blake
</person>
<person birth="1774-08-12"
death="1843-03-21"
source="https://en.wikipedia.org/wiki/Robert_Southey">
Robert Southey
</person>
<person birth="1775-01-30"
death="1864-09-17"
source="https://en.wikipedia.org/wiki/Walter_Savage_Landor">
Walter Savage Landor
</person>
<person birth="1770-04-07"
death="1850-04-23"
source="https://en.wikipedia.org/wiki/William_Wordsworth">
William Wordsworth
</person>
<person source="https://en.wikipedia.org/wiki/Samuel_Taylor_Coleridge"
birth="1772-10-21"
death="1834-07-25">
Samuel Taylor Coleridge
</person>
<person source="https://en.wikipedia.org/wiki/Matthew_Arnold"
birth="1822-12-24"
death="1888-04-15">
Matthew Arnold
</person>
<person source="https://en.wikipedia.org/wiki/Alfred,_Lord_Tennyson"
birth="1809-08-06"
death="1892-10-06">
Alfred, Lord Tennyson
</person>
<person source="https://en.wikipedia.org/wiki/Robert_Browning"
birth="1812-05-07"
death="1889-12-12">
Robert Browning
</person>
<person source="https://en.wikipedia.org/wiki/Elizabeth_Barrett_Browning"
birth="1806-03-06"
death="1861-06-29">
Elizabeth Barrett Browning
</person>
</people>
person
element, you may want to create variables for things like $birth-year
, $birth-month
, $birth-day
, $death-year
, etc. The substring()
function can help you extract the correct values from @birth
and @death
.=
, >=
, and -
, but there are many other workable solutions that might use different functions.<xsl:sort>
to sort people by birth date.@source
.