Alan Searle wrote:
However, I would now like to generate a number of XML files and not
include the XSL file declaration in the header. Instead, I would like
to have an HTML 'index' offering a number of options that can be applied
to particular XML files. For example options might be opening
particular XML files either in 'detail', 'overview' or 'graphic' (SVG
chart) mode.
That processing instructon <?xml-stylesheet?> is mainly useful for
client-side XSLT where a browser user loads the XML document in a
browser window and the browser can then check for the xml-stylesheet
processing instruction and apply the stylesheet if it supports XSLT.
In theory you can provide several such processing instructions, see
<http://www.w3.org/TR/xml-stylesheet/>
with pseudo attributes like title and/or alternate and the browser could
then offer the stylesheets in a menu, the same way Mozilla for instance
does that for CSS stylesheets if you view HTML documents.
In practice I don't know of a browser supporting that however.
As with most stuff you get a much more useful solution if you go server
side and apply the transformation there, that way the browser deals with
the HTML or XML or SVG your stylesheet on the server produces and sends
to the client. That way you could have one server side application (e.g.
transformer.asp or transformer.jsp or transformer.cgi or
transformer.php) that could take the XML URL and the stylesheet URL or
file name as parameters in the query string, read out the query string
parameters, apply the transformation and send the result to the client.
You could then simply use a HTML form e.g.
<form action="transformer.jsp">
<select name="stylesheet">
<option value="html.xml">HTML sheet</option>
<option value="svg.xml">SVG sheet</option>
...
</select>
<input type="hidden" name="xmlInput" value="whatever.xml">
<input type="submit" value="show transformation result">
</form>
to let the user select a stylesheet.
--
Martin Honnen
http://JavaScript.FAQTs.com/