Example E-2. firstxml.xps
<%
$t->{'humps'}{pre} = "<td>";
$t->{'humps'}{post} = "</td>";
$t->{'disposition'}{pre} = "<td>";
$t->{'disposition'}{post} = "</td>";
$t->{'species'}{pre} = "<tr><td>{\@name}</td>";
$t->{'species'}{post} = "</tr>";
%>
<html>
<head>
<title>Know Your Dromedaries</title>
</head>
<body>
<table border="1">
<tr><th>Species</th>
<th>No. of Humps</th>
<th>Disposition</th></tr>
<%= apply_templates('/dromedaries/species') %>
</table>
</body>
</html>
Save this file as firstxml.xps.
Now to get the original file, firstxml.xml, to
be transformed on the server by text.xps, we
need to somehow associate that file with the stylesheet. Under AxKit
there are a number of ways to do that, with varying flexibility. The
simplest way is to edit your firstxml.xml file
and, immediately after the <?xml
version="1.0"?> declaration, add the following:
<?xml-stylesheet href="firstxml.xps"
type="application/x-xpathscript"?>
Now assuming the files are both in the same directory under your
httpd document root, you should be able to make
a request for text.xml and see server-side
transformed XML in your browser. Now try changing the source XML
file, and watch AxKit detect the change next time you load the file
in the browser.