Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
The next thing we need to do is to adapt the stylesheet to run in the browser. To do this, we need to write an HTML page containing JavaScript to invoke the transformation.
This particular example runs in Internet Explorer 6 or later. It won't run on Firefox, because it uses the Microsoft API to invoke the XSLT transformations. If you want to write pages that run under several different browsers, consider using the Sarissa package (
http://sarissa.sourceforge.net
) which provides a cross-product API.
If the XML file is large (family trees produced by serious genealogists often run to several megabytes) then this approach means the user is going to have to wait rather longer to see the first page of data. But the advantage is that once it's downloaded, browsing around the file can be done offline: there is no need to go back to the server to follow each link from one individual to another. This gives the user a lightning-fast response to navigation requests, and reduces the processing load and the number of hits on the server. Another benefit, given that many genealogists only have access to the limited Web space provided by a commercial ISP, is that no special code needs to be installed on the server.
This time, the transformation is controlled from JavaScript code on an HTML page
famtree.html
. The page itself reads as follows. The