in mpdialog mode, we just write out some JavaScript to display
dialog to the reader asking whether they want to install MathPlayer
Depending on the response we get, we then instantiate an XSL processor
and reprocess the doc, passing $secondpass according to the
reader response.

Using d-o-e is fairly horrible, but this code is only for IE
anyway, and we need to force HTML semantics in this case.

IE5 hacks

This code will be ignored by an XSLT engine as a top level
element in a foreign namespace. It will be executed by an IE5XSL
engine and insert <!-- into the output stream, ie the start of a
comment. This will comment out all the XSLT code which will be copied
to the output. A similar clause below will close this comment, it is
then followed by the IE5XSL templates to be executed.

XSLT stylesheet

MSXSL script block

The following script block implements an extension function that
tests whether a specified ActiveX component is known to the client.
This is used below to test for the existence of MathML rendering
components.

The main bulk of this stylesheet is an identity transformation so...

XHTML elements are copied sans prefix (XHTML is default namespace
here, so these elements will still be in XHTML namespace

IE's treatment of XHTML as HTML needs a little help here...

>

This just ensures the mathml prefix declaration isn't copied from
the source at this stage, so that the system will use the mml prefix
coming from this stylesheet

We modify the head element to add code to specify a Microsoft
"Behaviour" if the behaviour component is known to the system.

Test for MathPlayer (Design Science)Test for Techexplorer (IBM)

Test for Microsoft. In this case we just
output a small HTML file that executes a script that will re-process
the source docuument with a different stylesheet. Doing things this
way avoids the need to xsl:import the second stylesheet, which would
very much increase the processing overhead of running this
stylesheet.

Further tests (eg for netscape/mozilla) could
be added here if necessary
namespace="mml" implementation="#mmlFactory"

Somewhat bizarrely in an otherwise namespace aware system,
Microsoft behaviours are defined to trigger off the
prefix not the Namespace. In the code above
we associated a MathML rendering behaviour (if one was found) with the
prefix mml: so here we ensure that this is the prefix
that actually gets used in the output.

Copy semantics element through in IE (so mathplayer gets to see
mathplayer annotations, otherwise use first child or a presentation annotation.

>/>""

IE5XSL stylesheet

In a rare fit of sympathy for users of
the-language-known-as-XSL-in-IE5 this file incorporates a
version of the above code designed to work in the Microsoft dialect.
This is needed otherwise users of a MathML rendering behaviour would
have to make a choice whether they wanted to use this stylesheet
(keeping their source documents conforming XHTML+MathML) or to use
the explicit Microsoft Object code, which is less portable, but would
work in at least IE5.5.

This entire section of code, down to the end of the stylesheet is
contained within this ie5:if. Thus XSLT sees it as a top level element
from a foreign namespace and silently ignores it. IE5XSL sees it as
"if true" and so executes the code.

First close the comment started at the beginning. This ensures
that the bulk of the XSLT code, while being copied to the result tree
by the IE5XSL engine, will not be rendered in the browser.