Exercise XSLT/Patients

Topic: Merging database-like documents with XSLT; accessing data from multiple documents

XSLT is not restricted to processing a single input document. Its function 'document' allows additional input documents to be accessed. For example, select="document('f.xml')/*" would select the document element of the document in file f.xml. Based on this function, present an XSLT-based solution strategy for the following task: 
We record information about visits of patients at the doctor in a file like patients.xml. Patients are identified by their patient number (in attribute pnum). New visits are recorded in a file like new-visits.xml. Combine the contents of such files in a single document; a combination of the above mentioned files is shown in file patients-new.xml.
 
Example: 

java –jar saxon.jar patients.xml mergePatients.xslt updateFile=new-visits.xml

Use file mergePatients.xslt as a starting point for solving the task.