rdoc-f95 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
 - data/Manifest.txt +79 -0
 - data/PostInstall.txt +7 -0
 - data/README.rdoc +147 -0
 - data/Rakefile +28 -0
 - data/bin/rdoc-f95 +70 -0
 - data/lib/rdoc-f95.rb +306 -0
 - data/lib/rdoc-f95/code_objects.rb +776 -0
 - data/lib/rdoc-f95/diagram.rb +342 -0
 - data/lib/rdoc-f95/dot.rb +249 -0
 - data/lib/rdoc-f95/generator.rb +1088 -0
 - data/lib/rdoc-f95/generator/chm.rb +113 -0
 - data/lib/rdoc-f95/generator/chm/chm.rb +98 -0
 - data/lib/rdoc-f95/generator/html.rb +370 -0
 - data/lib/rdoc-f95/generator/html/hefss.rb +414 -0
 - data/lib/rdoc-f95/generator/html/html.rb +708 -0
 - data/lib/rdoc-f95/generator/html/kilmer.rb +418 -0
 - data/lib/rdoc-f95/generator/html/one_page_html.rb +121 -0
 - data/lib/rdoc-f95/generator/ri.rb +229 -0
 - data/lib/rdoc-f95/generator/xhtml.rb +106 -0
 - data/lib/rdoc-f95/generator/xhtml/ctop.xsl +1318 -0
 - data/lib/rdoc-f95/generator/xhtml/mathml.xsl +42 -0
 - data/lib/rdoc-f95/generator/xhtml/pmathml.xsl +612 -0
 - data/lib/rdoc-f95/generator/xhtml/pmathmlcss.xsl +872 -0
 - data/lib/rdoc-f95/generator/xhtml/xhtml.rb +732 -0
 - data/lib/rdoc-f95/generator/xml.rb +120 -0
 - data/lib/rdoc-f95/generator/xml/rdf.rb +113 -0
 - data/lib/rdoc-f95/generator/xml/xml.rb +111 -0
 - data/lib/rdoc-f95/install.rb +166 -0
 - data/lib/rdoc-f95/markup.rb +506 -0
 - data/lib/rdoc-f95/markup/formatter.rb +14 -0
 - data/lib/rdoc-f95/markup/fragments.rb +337 -0
 - data/lib/rdoc-f95/markup/inline.rb +361 -0
 - data/lib/rdoc-f95/markup/install.rb +57 -0
 - data/lib/rdoc-f95/markup/lines.rb +152 -0
 - data/lib/rdoc-f95/markup/mathml_wrapper.rb +91 -0
 - data/lib/rdoc-f95/markup/preprocess.rb +71 -0
 - data/lib/rdoc-f95/markup/sample/rdoc2latex.rb +16 -0
 - data/lib/rdoc-f95/markup/sample/sample.rb +42 -0
 - data/lib/rdoc-f95/markup/to_flow.rb +185 -0
 - data/lib/rdoc-f95/markup/to_html.rb +357 -0
 - data/lib/rdoc-f95/markup/to_html_crossref.rb +123 -0
 - data/lib/rdoc-f95/markup/to_latex.rb +328 -0
 - data/lib/rdoc-f95/markup/to_test.rb +50 -0
 - data/lib/rdoc-f95/markup/to_xhtml_texparser.rb +234 -0
 - data/lib/rdoc-f95/options.rb +745 -0
 - data/lib/rdoc-f95/parsers/parse_c.rb +775 -0
 - data/lib/rdoc-f95/parsers/parse_f95.rb +2499 -0
 - data/lib/rdoc-f95/parsers/parse_rb.rb +2587 -0
 - data/lib/rdoc-f95/parsers/parse_simple.rb +39 -0
 - data/lib/rdoc-f95/parsers/parserfactory.rb +99 -0
 - data/lib/rdoc-f95/ri.rb +2 -0
 - data/lib/rdoc-f95/ri/cache.rb +188 -0
 - data/lib/rdoc-f95/ri/descriptions.rb +147 -0
 - data/lib/rdoc-f95/ri/display.rb +244 -0
 - data/lib/rdoc-f95/ri/driver.rb +435 -0
 - data/lib/rdoc-f95/ri/formatter.rb +603 -0
 - data/lib/rdoc-f95/ri/paths.rb +105 -0
 - data/lib/rdoc-f95/ri/reader.rb +106 -0
 - data/lib/rdoc-f95/ri/util.rb +81 -0
 - data/lib/rdoc-f95/ri/writer.rb +64 -0
 - data/lib/rdoc-f95/stats.rb +23 -0
 - data/lib/rdoc-f95/template.rb +64 -0
 - data/lib/rdoc-f95/tokenstream.rb +33 -0
 - data/lib/rdoc-f95/usage.rb +210 -0
 - data/script/console +10 -0
 - data/script/destroy +14 -0
 - data/script/generate +14 -0
 - data/test/test_helper.rb +3 -0
 - data/test/test_rdoc-f95.rb +11 -0
 - metadata +156 -0
 
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            <xsl:stylesheet
         
     | 
| 
      
 3 
     | 
    
         
            +
              version="1.0"
         
     | 
| 
      
 4 
     | 
    
         
            +
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         
     | 
| 
      
 5 
     | 
    
         
            +
              xmlns:msxsl="urn:schemas-microsoft-com:xslt"
         
     | 
| 
      
 6 
     | 
    
         
            +
              xmlns:fns="http://www.w3.org/2002/Math/preference"
         
     | 
| 
      
 7 
     | 
    
         
            +
              xmlns:mml="http://www.w3.org/1998/Math/MathML"
         
     | 
| 
      
 8 
     | 
    
         
            +
              extension-element-prefixes="msxsl fns"
         
     | 
| 
      
 9 
     | 
    
         
            +
            >
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            <!--
         
     | 
| 
      
 12 
     | 
    
         
            +
            Copyright David Carlisle 2001, 2002.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            Use and distribution of this code are permitted under the terms of the <a
         
     | 
| 
      
 15 
     | 
    
         
            +
            href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"
         
     | 
| 
      
 16 
     | 
    
         
            +
            >W3C Software Notice and License</a>.
         
     | 
| 
      
 17 
     | 
    
         
            +
            -->
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            <xsl:include href="ctop.xsl"/>
         
     | 
| 
      
 20 
     | 
    
         
            +
            <xsl:include href="pmathml.xsl"/>
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            <xsl:output/>
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            <xsl:template match="/">
         
     | 
| 
      
 25 
     | 
    
         
            +
            <xsl:choose>
         
     | 
| 
      
 26 
     | 
    
         
            +
            <xsl:when test="system-property('xsl:vendor')='Transformiix'">
         
     | 
| 
      
 27 
     | 
    
         
            +
            <xsl:apply-templates mode="c2p"/>
         
     | 
| 
      
 28 
     | 
    
         
            +
            </xsl:when>
         
     | 
| 
      
 29 
     | 
    
         
            +
            <!-- not working, currently
         
     | 
| 
      
 30 
     | 
    
         
            +
            <xsl:when test="system-property('xsl:vendor')='Microsoft' and /*/@fns:renderer='css'">
         
     | 
| 
      
 31 
     | 
    
         
            +
            <xsl:variable name="pmml">
         
     | 
| 
      
 32 
     | 
    
         
            +
            <xsl:apply-templates mode="c2p"/>
         
     | 
| 
      
 33 
     | 
    
         
            +
            </xsl:variable>
         
     | 
| 
      
 34 
     | 
    
         
            +
            <xsl:apply-templates select="msxsl:node-set($pmml)/node()"/>
         
     | 
| 
      
 35 
     | 
    
         
            +
            </xsl:when>
         
     | 
| 
      
 36 
     | 
    
         
            +
            -->
         
     | 
| 
      
 37 
     | 
    
         
            +
            <xsl:otherwise>
         
     | 
| 
      
 38 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 39 
     | 
    
         
            +
            </xsl:otherwise>
         
     | 
| 
      
 40 
     | 
    
         
            +
            </xsl:choose>
         
     | 
| 
      
 41 
     | 
    
         
            +
            </xsl:template> 
         
     | 
| 
      
 42 
     | 
    
         
            +
            </xsl:stylesheet>
         
     | 
| 
         @@ -0,0 +1,612 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <xsl:stylesheet
         
     | 
| 
      
 2 
     | 
    
         
            +
              version="1.0"
         
     | 
| 
      
 3 
     | 
    
         
            +
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         
     | 
| 
      
 4 
     | 
    
         
            +
              xmlns:mml="http://www.w3.org/1998/Math/MathML"
         
     | 
| 
      
 5 
     | 
    
         
            +
              xmlns:h="http://www.w3.org/1999/xhtml"
         
     | 
| 
      
 6 
     | 
    
         
            +
              xmlns="http://www.w3.org/1999/xhtml"
         
     | 
| 
      
 7 
     | 
    
         
            +
              xmlns:msxsl="urn:schemas-microsoft-com:xslt"
         
     | 
| 
      
 8 
     | 
    
         
            +
              xmlns:fns="http://www.w3.org/2002/Math/preference"
         
     | 
| 
      
 9 
     | 
    
         
            +
              xmlns:doc="http://www.dcarlisle.demon.co.uk/xsldoc"
         
     | 
| 
      
 10 
     | 
    
         
            +
              xmlns:ie5="http://www.w3.org/TR/WD-xsl"
         
     | 
| 
      
 11 
     | 
    
         
            +
              exclude-result-prefixes="h ie5 fns msxsl fns doc"
         
     | 
| 
      
 12 
     | 
    
         
            +
              extension-element-prefixes="msxsl fns doc"
         
     | 
| 
      
 13 
     | 
    
         
            +
            >
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            <!--
         
     | 
| 
      
 16 
     | 
    
         
            +
            $Id: pmathml.xsl,v 1.1 2008-03-08 16:14:54 morikawa Exp $
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Copyright David Carlisle 2001, 2002.
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Use and distribution of this code are permitted under the terms of the <a
         
     | 
| 
      
 21 
     | 
    
         
            +
            href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"
         
     | 
| 
      
 22 
     | 
    
         
            +
            >W3C Software Notice and License</a>.
         
     | 
| 
      
 23 
     | 
    
         
            +
            -->
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            <!-- MathPlayer mpdialog code for contributed by
         
     | 
| 
      
 26 
     | 
    
         
            +
                 Jack Dignan and Robert Miner, both of Design Science.
         
     | 
| 
      
 27 
     | 
    
         
            +
            -->
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            <xsl:output method="xml" omit-xml-declaration="yes"  />
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            <ie5:if doc:id="iehack" test=".">
         
     | 
| 
      
 32 
     | 
    
         
            +
                <ie5:eval no-entities="t">'<!--'</ie5:eval>
         
     | 
| 
      
 33 
     | 
    
         
            +
            </ie5:if>
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            <fns:x name="mathplayer" o="MathPlayer.Factory.1">
         
     | 
| 
      
 37 
     | 
    
         
            +
            <object id="mmlFactory" 
         
     | 
| 
      
 38 
     | 
    
         
            +
                    classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">
         
     | 
| 
      
 39 
     | 
    
         
            +
            </object>
         
     | 
| 
      
 40 
     | 
    
         
            +
            <?import namespace="mml" implementation="#mmlFactory"?>
         
     | 
| 
      
 41 
     | 
    
         
            +
            </fns:x>
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            <fns:x name="techexplorer" o="techexplorer.AxTchExpCtrl.1">
         
     | 
| 
      
 44 
     | 
    
         
            +
            <object id="mmlFactory" classid="clsid:0E76D59A-C088-11D4-9920-002035EFB1A4">
         
     | 
| 
      
 45 
     | 
    
         
            +
            </object>
         
     | 
| 
      
 46 
     | 
    
         
            +
            <?import namespace="mml" implementation="#mmlFactory"?>
         
     | 
| 
      
 47 
     | 
    
         
            +
            </fns:x>
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            <!-- SCRIPT not script due to weird mozilla bug
         
     | 
| 
      
 51 
     | 
    
         
            +
            http://bugzilla.mozilla.org/show_bug.cgi?id=158457
         
     | 
| 
      
 52 
     | 
    
         
            +
            -->
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            <fns:x name="css" o="Microsoft.FreeThreadedXMLDOM">
         
     | 
| 
      
 55 
     | 
    
         
            +
            <SCRIPT for="window" event="onload">
         
     | 
| 
      
 56 
     | 
    
         
            +
            var xsl = new ActiveXObject("Microsoft.FreeThreadedXMLDOM");
         
     | 
| 
      
 57 
     | 
    
         
            +
            xsl.async = false;
         
     | 
| 
      
 58 
     | 
    
         
            +
            xsl.validateOnParse = false;
         
     | 
| 
      
 59 
     | 
    
         
            +
            xsl.load("pmathmlcss.xsl");
         
     | 
| 
      
 60 
     | 
    
         
            +
            var xslTemplate = new ActiveXObject("MSXML2.XSLTemplate.3.0");
         
     | 
| 
      
 61 
     | 
    
         
            +
            xslTemplate.stylesheet=xsl.documentElement;
         
     | 
| 
      
 62 
     | 
    
         
            +
            var xslProc = xslTemplate.createProcessor();
         
     | 
| 
      
 63 
     | 
    
         
            +
            xslProc.input = document.XMLDocument;
         
     | 
| 
      
 64 
     | 
    
         
            +
            xslProc.transform();
         
     | 
| 
      
 65 
     | 
    
         
            +
            var str = xslProc.output;
         
     | 
| 
      
 66 
     | 
    
         
            +
            <!-- work around bug in IE6 under Win XP, RM 6/5/2002 -->
         
     | 
| 
      
 67 
     | 
    
         
            +
            var repl = "replace";
         
     | 
| 
      
 68 
     | 
    
         
            +
            if (window.navigator.appVersion.match(/Windows NT 5.1/)) { repl = ""; }
         
     | 
| 
      
 69 
     | 
    
         
            +
            var newDoc = document.open("text/html", repl);
         
     | 
| 
      
 70 
     | 
    
         
            +
            newDoc.write(str);
         
     | 
| 
      
 71 
     | 
    
         
            +
            </SCRIPT>
         
     | 
| 
      
 72 
     | 
    
         
            +
            </fns:x>
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            <h:p>
         
     | 
| 
      
 76 
     | 
    
         
            +
            in mpdialog mode, we just write out some JavaScript to display 
         
     | 
| 
      
 77 
     | 
    
         
            +
            dialog to the reader asking whether they want to install MathPlayer 
         
     | 
| 
      
 78 
     | 
    
         
            +
            Depending on the response we get, we then instantiate an XSL processor
         
     | 
| 
      
 79 
     | 
    
         
            +
            and reprocess the doc, passing $secondpass according to the
         
     | 
| 
      
 80 
     | 
    
         
            +
            reader response.
         
     | 
| 
      
 81 
     | 
    
         
            +
            </h:p>
         
     | 
| 
      
 82 
     | 
    
         
            +
            <h:p>Using d-o-e is fairly horrible, but this code is only for IE
         
     | 
| 
      
 83 
     | 
    
         
            +
            anyway, and we need to force HTML semantics in this case.</h:p>
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            <xsl:variable name="mpdialog">
         
     | 
| 
      
 86 
     | 
    
         
            +
            var cookieName = "MathPlayerInstall=";
         
     | 
| 
      
 87 
     | 
    
         
            +
            function MPInstall(){
         
     | 
| 
      
 88 
     | 
    
         
            +
             var showDialog=true;
         
     | 
| 
      
 89 
     | 
    
         
            +
             var c = document.cookie;
         
     | 
| 
      
 90 
     | 
    
         
            +
             var i = c.indexOf(cookieName);
         
     | 
| 
      
 91 
     | 
    
         
            +
             if (i >= 0) {
         
     | 
| 
      
 92 
     | 
    
         
            +
              if ( c.substr(i + cookieName.length, 1) >= 2) { showDialog=false; }
         
     | 
| 
      
 93 
     | 
    
         
            +
             }
         
     | 
| 
      
 94 
     | 
    
         
            +
             if (showDialog) {
         
     | 
| 
      
 95 
     | 
    
         
            +
              MPDialog();
         
     | 
| 
      
 96 
     | 
    
         
            +
              c = document.cookie;
         
     | 
| 
      
 97 
     | 
    
         
            +
              i = c.indexOf(cookieName);
         
     | 
| 
      
 98 
     | 
    
         
            +
             }
         
     | 
| 
      
 99 
     | 
    
         
            +
             if (i >= 0) return c.substr(i + cookieName.length, 1);
         
     | 
| 
      
 100 
     | 
    
         
            +
             else return null;
         
     | 
| 
      
 101 
     | 
    
         
            +
            }
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
            function MPDialog() {
         
     | 
| 
      
 104 
     | 
    
         
            +
             var vArgs="";
         
     | 
| 
      
 105 
     | 
    
         
            +
             var sFeatures="dialogWidth:410px;dialogHeight:190px;help:off;status:no";
         
     | 
| 
      
 106 
     | 
    
         
            +
             var text = "";
         
     | 
| 
      
 107 
     | 
    
         
            +
             text += "javascript:document.write('"
         
     | 
| 
      
 108 
     | 
    
         
            +
             text += '<script>'
         
     | 
| 
      
 109 
     | 
    
         
            +
             text += 'function fnClose(v) { '
         
     | 
| 
      
 110 
     | 
    
         
            +
             text += 'var exp = new Date();'
         
     | 
| 
      
 111 
     | 
    
         
            +
             text += 'var thirtyDays = exp.getTime() + (30 * 24 * 60 * 60 * 1000);'
         
     | 
| 
      
 112 
     | 
    
         
            +
             text += 'exp.setTime(thirtyDays);'
         
     | 
| 
      
 113 
     | 
    
         
            +
             text += 'var cookieProps = ";expires=" + exp.toGMTString();'
         
     | 
| 
      
 114 
     | 
    
         
            +
             text += 'if (document.forms[0].dontask.checked) v+=2;'
         
     | 
| 
      
 115 
     | 
    
         
            +
             text += 'document.cookie="' + cookieName + '"+v+cookieProps;'
         
     | 
| 
      
 116 
     | 
    
         
            +
             text += 'window.close();'
         
     | 
| 
      
 117 
     | 
    
         
            +
             text += '}'
         
     | 
| 
      
 118 
     | 
    
         
            +
             text += '</' + 'script>'
         
     | 
| 
      
 119 
     | 
    
         
            +
             text += '<head><title>Install MathPlayer?</title></head>'
         
     | 
| 
      
 120 
     | 
    
         
            +
             text += '<body bgcolor="#D4D0C8"><form>'
         
     | 
| 
      
 121 
     | 
    
         
            +
             text += '<table cellpadding=10 style="font-family:Arial;font-size:10pt" border=0 width=100%>'
         
     | 
| 
      
 122 
     | 
    
         
            +
             text += '<tr><td align=left>This page requires Design Science\\\'s MathPlayer&trade;.<br>'
         
     | 
| 
      
 123 
     | 
    
         
            +
             text += 'Do you want to download and install MathPlayer?</td></tr>';
         
     | 
| 
      
 124 
     | 
    
         
            +
             text += '<tr><td align=center><input type="checkbox" name="dontask">'
         
     | 
| 
      
 125 
     | 
    
         
            +
             text += 'Don\\\'t ask me again</td></tr>'
         
     | 
| 
      
 126 
     | 
    
         
            +
             text += '<tr><td align=center><input id=yes type="button" value=" Yes "'
         
     | 
| 
      
 127 
     | 
    
         
            +
             text += ' onClick="fnClose(1)">&nbsp;&nbsp;&nbsp;'
         
     | 
| 
      
 128 
     | 
    
         
            +
             text += '<input type="button" value="  No  " onClick="fnClose(0)"></td></tr>'
         
     | 
| 
      
 129 
     | 
    
         
            +
             text += '</table></form>';
         
     | 
| 
      
 130 
     | 
    
         
            +
             text += '</body>'
         
     | 
| 
      
 131 
     | 
    
         
            +
             text += "')"
         
     | 
| 
      
 132 
     | 
    
         
            +
             window.showModalDialog( text , vArgs, sFeatures );
         
     | 
| 
      
 133 
     | 
    
         
            +
            }
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            function WaitDialog() {
         
     | 
| 
      
 136 
     | 
    
         
            +
             var vArgs="";
         
     | 
| 
      
 137 
     | 
    
         
            +
             var sFeatures="dialogWidth:510px;dialogHeight:150px;help:off;status:no";
         
     | 
| 
      
 138 
     | 
    
         
            +
             var text = "";
         
     | 
| 
      
 139 
     | 
    
         
            +
             text += "javascript:document.write('"
         
     | 
| 
      
 140 
     | 
    
         
            +
             text += '<script>'
         
     | 
| 
      
 141 
     | 
    
         
            +
             text += 'window.onload=fnLoad;'
         
     | 
| 
      
 142 
     | 
    
         
            +
             text += 'function fnLoad() {document.forms[0].yes.focus();}'
         
     | 
| 
      
 143 
     | 
    
         
            +
             text += 'function fnClose(v) { '
         
     | 
| 
      
 144 
     | 
    
         
            +
             text += 'window.returnValue=v;'
         
     | 
| 
      
 145 
     | 
    
         
            +
             text += 'window.close();'
         
     | 
| 
      
 146 
     | 
    
         
            +
             text += '}'
         
     | 
| 
      
 147 
     | 
    
         
            +
             text += '</' + 'script>'
         
     | 
| 
      
 148 
     | 
    
         
            +
             text += '<head><title>Wait for Installation?</title></head>'
         
     | 
| 
      
 149 
     | 
    
         
            +
             text += '<body bgcolor="#D4D0C8" onload="fnLoad()"><form><'
         
     | 
| 
      
 150 
     | 
    
         
            +
             text += 'table cellpadding=10 style="font-family:Arial;font-size:10pt" border=0 width=100%>'
         
     | 
| 
      
 151 
     | 
    
         
            +
             text += '<tr><td align=left>Click OK once MathPlayer is installed '
         
     | 
| 
      
 152 
     | 
    
         
            +
             text += 'to refresh the page.<br>'
         
     | 
| 
      
 153 
     | 
    
         
            +
             text += 'Click Cancel to view the page immediately without MathPlayer.</td></tr>';
         
     | 
| 
      
 154 
     | 
    
         
            +
             text += '<tr><td align=center><input id=yes type="button" '
         
     | 
| 
      
 155 
     | 
    
         
            +
             text += 'value="   OK   " onClick="fnClose(1)">&nbsp;&nbsp;&nbsp;'
         
     | 
| 
      
 156 
     | 
    
         
            +
             text += '<input type="button" value="Cancel" onClick="fnClose(0)"></td></tr>'
         
     | 
| 
      
 157 
     | 
    
         
            +
             text += '</table></form>';
         
     | 
| 
      
 158 
     | 
    
         
            +
             text += '</body>'
         
     | 
| 
      
 159 
     | 
    
         
            +
             text += "')"
         
     | 
| 
      
 160 
     | 
    
         
            +
             return window.showModalDialog( text , vArgs, sFeatures );
         
     | 
| 
      
 161 
     | 
    
         
            +
            }
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
            var result = MPInstall();
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
            var action = "fallthrough";
         
     | 
| 
      
 166 
     | 
    
         
            +
            if (result == 1 || result == 3) {
         
     | 
| 
      
 167 
     | 
    
         
            +
             window.open("http://www.dessci.com/webmath/mathplayer");
         
     | 
| 
      
 168 
     | 
    
         
            +
             var wait = WaitDialog();
         
     | 
| 
      
 169 
     | 
    
         
            +
             if ( wait == 1) {
         
     | 
| 
      
 170 
     | 
    
         
            +
              action =  "install";
         
     | 
| 
      
 171 
     | 
    
         
            +
              document.location.reload();
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
             }
         
     | 
| 
      
 174 
     | 
    
         
            +
            }
         
     | 
| 
      
 175 
     | 
    
         
            +
            if (action == "fallthrough") {
         
     | 
| 
      
 176 
     | 
    
         
            +
            var xsl = new ActiveXObject("Microsoft.FreeThreadedXMLDOM");
         
     | 
| 
      
 177 
     | 
    
         
            +
            xsl.async = false;
         
     | 
| 
      
 178 
     | 
    
         
            +
            xsl.validateOnParse = false;
         
     | 
| 
      
 179 
     | 
    
         
            +
            xsl.load("pmathmlcss.xsl");
         
     | 
| 
      
 180 
     | 
    
         
            +
            var xslTemplate = new ActiveXObject("MSXML2.XSLTemplate.3.0");
         
     | 
| 
      
 181 
     | 
    
         
            +
            xslTemplate.stylesheet=xsl.documentElement;
         
     | 
| 
      
 182 
     | 
    
         
            +
            var xslProc = xslTemplate.createProcessor();
         
     | 
| 
      
 183 
     | 
    
         
            +
            xslProc.input = document.XMLDocument;
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
            xslProc.transform();
         
     | 
| 
      
 186 
     | 
    
         
            +
            var str = xslProc.output;
         
     | 
| 
      
 187 
     | 
    
         
            +
            <!-- work around bug in IE6 under Win XP, RM 6/5/2002 -->
         
     | 
| 
      
 188 
     | 
    
         
            +
            var repl = "replace";
         
     | 
| 
      
 189 
     | 
    
         
            +
            if (window.navigator.appVersion.match(/Windows NT 5.1/)) { repl = ""; }
         
     | 
| 
      
 190 
     | 
    
         
            +
            var newDoc = document.open("text/html", repl);
         
     | 
| 
      
 191 
     | 
    
         
            +
            newDoc.write(str);
         
     | 
| 
      
 192 
     | 
    
         
            +
            document.close();
         
     | 
| 
      
 193 
     | 
    
         
            +
            }
         
     | 
| 
      
 194 
     | 
    
         
            +
            </xsl:variable>
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
            <fns:x name="mathplayer-dl" >mathplayer-dl</fns:x>
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
            <fns:x name="techexplorer-plugin" >techexplorer-plugin</fns:x>
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
            <xsl:variable name="root" select="/"/>
         
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
            <xsl:param name="activex">
         
     | 
| 
      
 205 
     | 
    
         
            +
               <xsl:choose>
         
     | 
| 
      
 206 
     | 
    
         
            +
                 <xsl:when test="/*/@fns:renderer='techexplorer-plugin'">techexplorer-plugin</xsl:when>
         
     | 
| 
      
 207 
     | 
    
         
            +
                 <xsl:when test="system-property('xsl:vendor')!='Microsoft'"/>
         
     | 
| 
      
 208 
     | 
    
         
            +
                 <xsl:otherwise>
         
     | 
| 
      
 209 
     | 
    
         
            +
            <xsl:variable name="docpref" select="document('')/*/fns:x[@name=$root/*/@fns:renderer][1]"/>
         
     | 
| 
      
 210 
     | 
    
         
            +
                 <xsl:choose>
         
     | 
| 
      
 211 
     | 
    
         
            +
                 <xsl:when test="$docpref='mathplayer-dl'">mathplayer-dl</xsl:when>
         
     | 
| 
      
 212 
     | 
    
         
            +
                 <xsl:when test="$docpref and fns:isinstalled(string($docpref/@o))='true'">
         
     | 
| 
      
 213 
     | 
    
         
            +
                       <xsl:copy-of select="$docpref/node()"/>
         
     | 
| 
      
 214 
     | 
    
         
            +
                 </xsl:when>
         
     | 
| 
      
 215 
     | 
    
         
            +
                 <xsl:otherwise>
         
     | 
| 
      
 216 
     | 
    
         
            +
                   <xsl:copy-of select="(document('')/*/fns:x[fns:isinstalled(string(@o))='true'])[1]/node()"/>
         
     | 
| 
      
 217 
     | 
    
         
            +
                 </xsl:otherwise>
         
     | 
| 
      
 218 
     | 
    
         
            +
              </xsl:choose>
         
     | 
| 
      
 219 
     | 
    
         
            +
                 </xsl:otherwise>
         
     | 
| 
      
 220 
     | 
    
         
            +
              </xsl:choose>
         
     | 
| 
      
 221 
     | 
    
         
            +
            </xsl:param>
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
            <h:div doc:ref="iehack">
         
     | 
| 
      
 224 
     | 
    
         
            +
            <h:h3>IE5 hacks</h:h3>
         
     | 
| 
      
 225 
     | 
    
         
            +
            <h:p>This code will be ignored by an XSLT engine as a top level
         
     | 
| 
      
 226 
     | 
    
         
            +
            element in a foreign namespace. It will be executed by an IE5XSL
         
     | 
| 
      
 227 
     | 
    
         
            +
            engine and insert <!-- into the output stream, ie the start of a
         
     | 
| 
      
 228 
     | 
    
         
            +
            comment. This will comment out all the XSLT code which will be copied
         
     | 
| 
      
 229 
     | 
    
         
            +
            to the output. A similar clause below will close this comment, it is
         
     | 
| 
      
 230 
     | 
    
         
            +
            then followed by the IE5XSL templates to be executed.</h:p>
         
     | 
| 
      
 231 
     | 
    
         
            +
            <h:p>This trick is due to Jonathan Marsh of Microsoft, and used in
         
     | 
| 
      
 232 
     | 
    
         
            +
            <h:a href="http://www.w3.org/TR/2001/WD-query-datamodel-20010607/xmlspec-ie-dm.xsl">the stylesheet for
         
     | 
| 
      
 233 
     | 
    
         
            +
            the XPath 2 data model draft</h:a>.</h:p>
         
     | 
| 
      
 234 
     | 
    
         
            +
            </h:div>
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
            <h:h2>XSLT stylesheet</h:h2>
         
     | 
| 
      
 237 
     | 
    
         
            +
            <h:h3>MSXSL script block</h:h3>
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
            <h:p>The following script block implements an extension function that
         
     | 
| 
      
 240 
     | 
    
         
            +
            tests whether a specified ActiveX component is known to the client.
         
     | 
| 
      
 241 
     | 
    
         
            +
            This is used below to test for the existence of MathML rendering
         
     | 
| 
      
 242 
     | 
    
         
            +
            components.</h:p>
         
     | 
| 
      
 243 
     | 
    
         
            +
            <msxsl:script language="JScript" implements-prefix="fns">
         
     | 
| 
      
 244 
     | 
    
         
            +
                function isinstalled(ax) 
         
     | 
| 
      
 245 
     | 
    
         
            +
                {
         
     | 
| 
      
 246 
     | 
    
         
            +
                try {
         
     | 
| 
      
 247 
     | 
    
         
            +
                    var ActiveX = new ActiveXObject(ax);
         
     | 
| 
      
 248 
     | 
    
         
            +
                    return "true";
         
     | 
| 
      
 249 
     | 
    
         
            +
                } catch (e) {
         
     | 
| 
      
 250 
     | 
    
         
            +
                    return "false";
         
     | 
| 
      
 251 
     | 
    
         
            +
                }
         
     | 
| 
      
 252 
     | 
    
         
            +
            }
         
     | 
| 
      
 253 
     | 
    
         
            +
            </msxsl:script>
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
            <h:p>The main bulk of this stylesheet is an identity transformation so...</h:p>
         
     | 
| 
      
 256 
     | 
    
         
            +
            <xsl:template match="*|comment()">
         
     | 
| 
      
 257 
     | 
    
         
            +
            <xsl:copy>
         
     | 
| 
      
 258 
     | 
    
         
            +
            <xsl:copy-of select="@*"/>
         
     | 
| 
      
 259 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 260 
     | 
    
         
            +
            </xsl:copy>
         
     | 
| 
      
 261 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
            <h:p>XHTML elements are copied sans prefix (XHTML is default namespace
         
     | 
| 
      
 266 
     | 
    
         
            +
            here, so these elements will still be in XHTML namespace</h:p>
         
     | 
| 
      
 267 
     | 
    
         
            +
            <xsl:template match="h:*">
         
     | 
| 
      
 268 
     | 
    
         
            +
            <xsl:element name="{local-name(.)}">
         
     | 
| 
      
 269 
     | 
    
         
            +
             <xsl:copy-of select="@*"/>
         
     | 
| 
      
 270 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 271 
     | 
    
         
            +
            </xsl:element>
         
     | 
| 
      
 272 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 273 
     | 
    
         
            +
             
     | 
| 
      
 274 
     | 
    
         
            +
            <h:p>IE's treatment of XHTML as HTML needs a little help here...</h:p>
         
     | 
| 
      
 275 
     | 
    
         
            +
            <xsl:template match="h:br|h:hr">
         
     | 
| 
      
 276 
     | 
    
         
            +
            <xsl:choose>
         
     | 
| 
      
 277 
     | 
    
         
            +
            <xsl:when test="system-property('xsl:vendor')='Microsoft'">
         
     | 
| 
      
 278 
     | 
    
         
            +
              <xsl:value-of disable-output-escaping="yes" select="concat('<',local-name(.))"/>
         
     | 
| 
      
 279 
     | 
    
         
            +
              <xsl:apply-templates mode="verb" select="@*"/>
         
     | 
| 
      
 280 
     | 
    
         
            +
              <xsl:text disable-output-escaping="yes">></xsl:text>
         
     | 
| 
      
 281 
     | 
    
         
            +
            </xsl:when>
         
     | 
| 
      
 282 
     | 
    
         
            +
            <xsl:otherwise>
         
     | 
| 
      
 283 
     | 
    
         
            +
            <xsl:element name="{local-name(.)}">
         
     | 
| 
      
 284 
     | 
    
         
            +
             <xsl:copy-of select="@*"/>
         
     | 
| 
      
 285 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 286 
     | 
    
         
            +
            </xsl:element>
         
     | 
| 
      
 287 
     | 
    
         
            +
            </xsl:otherwise>
         
     | 
| 
      
 288 
     | 
    
         
            +
            </xsl:choose>
         
     | 
| 
      
 289 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
      
 291 
     | 
    
         
            +
            <h:p>This just ensures the mathml prefix declaration isn't copied from
         
     | 
| 
      
 292 
     | 
    
         
            +
            the source at this stage, so that the system will use the mml prefix
         
     | 
| 
      
 293 
     | 
    
         
            +
            coming from this stylesheet</h:p>
         
     | 
| 
      
 294 
     | 
    
         
            +
            <xsl:template match="h:html|html">
         
     | 
| 
      
 295 
     | 
    
         
            +
            <html>
         
     | 
| 
      
 296 
     | 
    
         
            +
            <xsl:copy-of select="@*[not(namespace-uri(.)='http://www.w3.org/2002/Math/preference')]"/>
         
     | 
| 
      
 297 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 298 
     | 
    
         
            +
            </html>
         
     | 
| 
      
 299 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 300 
     | 
    
         
            +
             
     | 
| 
      
 301 
     | 
    
         
            +
            <h:p>We modify the head element to add code to specify a Microsoft
         
     | 
| 
      
 302 
     | 
    
         
            +
            "Behaviour" if the behaviour component is known to the system.</h:p>
         
     | 
| 
      
 303 
     | 
    
         
            +
            <h:span doc:ref="mp">Test for MathPlayer (Design Science)</h:span>
         
     | 
| 
      
 304 
     | 
    
         
            +
            <h:span doc:ref="te">Test for Techexplorer (IBM)</h:span>
         
     | 
| 
      
 305 
     | 
    
         
            +
            <h:span doc:ref="ms"><h:div>Test for Microsoft. In this case we just
         
     | 
| 
      
 306 
     | 
    
         
            +
            output a small HTML file that executes a script that will re-process
         
     | 
| 
      
 307 
     | 
    
         
            +
            the source docuument with a different stylesheet. Doing things this
         
     | 
| 
      
 308 
     | 
    
         
            +
            way avoids the need to xsl:import the second stylesheet, which would
         
     | 
| 
      
 309 
     | 
    
         
            +
            very much increase the processing overhead of running this
         
     | 
| 
      
 310 
     | 
    
         
            +
            stylesheet.</h:div></h:span>
         
     | 
| 
      
 311 
     | 
    
         
            +
            <h:span doc:ref="other">Further tests (eg for netscape/mozilla) could
         
     | 
| 
      
 312 
     | 
    
         
            +
            be added here if necessary</h:span>
         
     | 
| 
      
 313 
     | 
    
         
            +
            <xsl:template match="h:head|head">
         
     | 
| 
      
 314 
     | 
    
         
            +
            <head>
         
     | 
| 
      
 315 
     | 
    
         
            +
             
     | 
| 
      
 316 
     | 
    
         
            +
            <!-- new if for IE frames bug -->
         
     | 
| 
      
 317 
     | 
    
         
            +
            <xsl:if test="system-property('xsl:vendor')='Microsoft'">
         
     | 
| 
      
 318 
     | 
    
         
            +
            <xsl:if test="name(msxsl:node-set($activex)/*)=''">
         
     | 
| 
      
 319 
     | 
    
         
            +
            <object id="mmlFactory" 
         
     | 
| 
      
 320 
     | 
    
         
            +
                    classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">
         
     | 
| 
      
 321 
     | 
    
         
            +
            </object>
         
     | 
| 
      
 322 
     | 
    
         
            +
            <xsl:processing-instruction name="import">
         
     | 
| 
      
 323 
     | 
    
         
            +
             namespace="mml" implementation="#mmlFactory"
         
     | 
| 
      
 324 
     | 
    
         
            +
            </xsl:processing-instruction>
         
     | 
| 
      
 325 
     | 
    
         
            +
            </xsl:if>
         
     | 
| 
      
 326 
     | 
    
         
            +
            </xsl:if>
         
     | 
| 
      
 327 
     | 
    
         
            +
             
     | 
| 
      
 328 
     | 
    
         
            +
            <xsl:choose>
         
     | 
| 
      
 329 
     | 
    
         
            +
            <xsl:when doc:id="mp" test="$activex='mathplayer-dl'">
         
     | 
| 
      
 330 
     | 
    
         
            +
                <xsl:if test="fns:isinstalled('MathPlayer.Factory.1')='false'">
         
     | 
| 
      
 331 
     | 
    
         
            +
                 <SCRIPT for="window" event="onload">
         
     | 
| 
      
 332 
     | 
    
         
            +
                   <xsl:value-of select="$mpdialog" disable-output-escaping="yes"/>
         
     | 
| 
      
 333 
     | 
    
         
            +
                 </SCRIPT>
         
     | 
| 
      
 334 
     | 
    
         
            +
                </xsl:if>
         
     | 
| 
      
 335 
     | 
    
         
            +
               <xsl:copy-of select="document('')/*/fns:x[@name='mathplayer']"/>
         
     | 
| 
      
 336 
     | 
    
         
            +
            </xsl:when>
         
     | 
| 
      
 337 
     | 
    
         
            +
            <xsl:when doc:id="mp" test="not($activex='techexplorer-plugin') and system-property('xsl:vendor')='Microsoft'">
         
     | 
| 
      
 338 
     | 
    
         
            +
              <xsl:copy-of select="$activex"/>
         
     | 
| 
      
 339 
     | 
    
         
            +
            </xsl:when>
         
     | 
| 
      
 340 
     | 
    
         
            +
            <xsl:otherwise doc:id="other">
         
     | 
| 
      
 341 
     | 
    
         
            +
            </xsl:otherwise>
         
     | 
| 
      
 342 
     | 
    
         
            +
            </xsl:choose>
         
     | 
| 
      
 343 
     | 
    
         
            +
              <xsl:apply-templates/>
         
     | 
| 
      
 344 
     | 
    
         
            +
            </head>
         
     | 
| 
      
 345 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 346 
     | 
    
         
            +
             
     | 
| 
      
 347 
     | 
    
         
            +
             
     | 
| 
      
 348 
     | 
    
         
            +
            <xsl:template match="mml:math" priority="22">
         
     | 
| 
      
 349 
     | 
    
         
            +
            <xsl:choose>
         
     | 
| 
      
 350 
     | 
    
         
            +
            <xsl:when test="$activex='techexplorer-plugin'">
         
     | 
| 
      
 351 
     | 
    
         
            +
            <embed  type="text/mathml" height="75" width="300">
         
     | 
| 
      
 352 
     | 
    
         
            +
            <xsl:attribute name="mmldata">
         
     | 
| 
      
 353 
     | 
    
         
            +
            <xsl:apply-templates mode="verb" select="."/>
         
     | 
| 
      
 354 
     | 
    
         
            +
            </xsl:attribute>
         
     | 
| 
      
 355 
     | 
    
         
            +
            </embed>
         
     | 
| 
      
 356 
     | 
    
         
            +
            </xsl:when>
         
     | 
| 
      
 357 
     | 
    
         
            +
            <xsl:otherwise>
         
     | 
| 
      
 358 
     | 
    
         
            +
            <xsl:element name="mml:{local-name(.)}">
         
     | 
| 
      
 359 
     | 
    
         
            +
             <xsl:copy-of select="@*"/>
         
     | 
| 
      
 360 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 361 
     | 
    
         
            +
            </xsl:element>
         
     | 
| 
      
 362 
     | 
    
         
            +
            </xsl:otherwise>
         
     | 
| 
      
 363 
     | 
    
         
            +
            </xsl:choose>
         
     | 
| 
      
 364 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
      
 366 
     | 
    
         
            +
             
     | 
| 
      
 367 
     | 
    
         
            +
            <!-- squash annotation elements -->
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
             
     | 
| 
      
 370 
     | 
    
         
            +
             
     | 
| 
      
 371 
     | 
    
         
            +
            <h:p>Somewhat bizarrely in an otherwise namespace aware system,
         
     | 
| 
      
 372 
     | 
    
         
            +
            Microsoft behaviours are defined to trigger off the
         
     | 
| 
      
 373 
     | 
    
         
            +
            <h:em>prefix</h:em> not the <h:em>Namespace</h:em>. In the code above
         
     | 
| 
      
 374 
     | 
    
         
            +
            we associated a MathML rendering behaviour (if one was found) with the
         
     | 
| 
      
 375 
     | 
    
         
            +
            prefix <h:code>mml:</h:code> so here we ensure that this is the prefix
         
     | 
| 
      
 376 
     | 
    
         
            +
            that actually gets used in the output.</h:p>
         
     | 
| 
      
 377 
     | 
    
         
            +
            <xsl:template match="mml:*">
         
     | 
| 
      
 378 
     | 
    
         
            +
            <xsl:element name="mml:{local-name(.)}">
         
     | 
| 
      
 379 
     | 
    
         
            +
             <xsl:copy-of select="@*"/>
         
     | 
| 
      
 380 
     | 
    
         
            +
            <xsl:apply-templates/>
         
     | 
| 
      
 381 
     | 
    
         
            +
            </xsl:element>
         
     | 
| 
      
 382 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 383 
     | 
    
         
            +
             
     | 
| 
      
 384 
     | 
    
         
            +
            <h:p>Copy semantics element through in IE (so mathplayer gets to see
         
     | 
| 
      
 385 
     | 
    
         
            +
            mathplayer annotations, otherwise use first child or a presentation annotation.</h:p>
         
     | 
| 
      
 386 
     | 
    
         
            +
            <xsl:template match="mml:semantics">
         
     | 
| 
      
 387 
     | 
    
         
            +
            <xsl:choose>
         
     | 
| 
      
 388 
     | 
    
         
            +
             <xsl:when test="system-property('xsl:vendor')='Microsoft'">
         
     | 
| 
      
 389 
     | 
    
         
            +
               <xsl:element name="mml:{local-name(.)}">
         
     | 
| 
      
 390 
     | 
    
         
            +
                <xsl:copy-of select="@*"/>
         
     | 
| 
      
 391 
     | 
    
         
            +
                <xsl:apply-templates/>
         
     | 
| 
      
 392 
     | 
    
         
            +
               </xsl:element>
         
     | 
| 
      
 393 
     | 
    
         
            +
             </xsl:when>
         
     | 
| 
      
 394 
     | 
    
         
            +
             <xsl:when test="mml:annotation-xml[@encoding='MathML-Presentation']">
         
     | 
| 
      
 395 
     | 
    
         
            +
               <xsl:apply-templates select="mml:annotation-xml[@encoding='MathML-Presentation']/node()"/>  
         
     | 
| 
      
 396 
     | 
    
         
            +
             </xsl:when>
         
     | 
| 
      
 397 
     | 
    
         
            +
             <xsl:otherwise>
         
     | 
| 
      
 398 
     | 
    
         
            +
               <xsl:apply-templates select="*[1]"/>  
         
     | 
| 
      
 399 
     | 
    
         
            +
             </xsl:otherwise>
         
     | 
| 
      
 400 
     | 
    
         
            +
            </xsl:choose>
         
     | 
| 
      
 401 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 402 
     | 
    
         
            +
             
     | 
| 
      
 403 
     | 
    
         
            +
            <!-- a version of my old verb.xsl -->
         
     | 
| 
      
 404 
     | 
    
         
            +
             
     | 
| 
      
 405 
     | 
    
         
            +
            <!-- non empty elements and other nodes. -->
         
     | 
| 
      
 406 
     | 
    
         
            +
            <xsl:template mode="verb" match="*[*]|*[text()]|*[comment()]|*[processing-instruction()]">
         
     | 
| 
      
 407 
     | 
    
         
            +
              <xsl:value-of select="concat('<',local-name(.))"/>
         
     | 
| 
      
 408 
     | 
    
         
            +
              <xsl:apply-templates mode="verb" select="@*"/>
         
     | 
| 
      
 409 
     | 
    
         
            +
              <xsl:text>></xsl:text>
         
     | 
| 
      
 410 
     | 
    
         
            +
              <xsl:apply-templates mode="verb"/>
         
     | 
| 
      
 411 
     | 
    
         
            +
              <xsl:value-of select="concat('</',local-name(.),'>')"/>
         
     | 
| 
      
 412 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 413 
     | 
    
         
            +
             
     | 
| 
      
 414 
     | 
    
         
            +
            <!-- empty elements -->
         
     | 
| 
      
 415 
     | 
    
         
            +
            <xsl:template mode="verb" match="*">
         
     | 
| 
      
 416 
     | 
    
         
            +
              <xsl:value-of select="concat('<',local-name(.))"/>
         
     | 
| 
      
 417 
     | 
    
         
            +
              <xsl:apply-templates mode="verb" select="@*"/>
         
     | 
| 
      
 418 
     | 
    
         
            +
              <xsl:text>/></xsl:text>
         
     | 
| 
      
 419 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 420 
     | 
    
         
            +
             
     | 
| 
      
 421 
     | 
    
         
            +
            <!-- attributes
         
     | 
| 
      
 422 
     | 
    
         
            +
                 Output always surrounds attribute value by "
         
     | 
| 
      
 423 
     | 
    
         
            +
                 so we need to make sure no literal " appear in the value  -->
         
     | 
| 
      
 424 
     | 
    
         
            +
            <xsl:template mode="verb" match="@*">
         
     | 
| 
      
 425 
     | 
    
         
            +
              <xsl:value-of select="concat(' ',local-name(.),'=')"/>
         
     | 
| 
      
 426 
     | 
    
         
            +
              <xsl:text>"</xsl:text>
         
     | 
| 
      
 427 
     | 
    
         
            +
              <xsl:call-template name="string-replace">
         
     | 
| 
      
 428 
     | 
    
         
            +
                <xsl:with-param name="from" select="'"'"/>
         
     | 
| 
      
 429 
     | 
    
         
            +
                <xsl:with-param name="to" select="'&quot;'"/> 
         
     | 
| 
      
 430 
     | 
    
         
            +
                <xsl:with-param name="string" select="."/>
         
     | 
| 
      
 431 
     | 
    
         
            +
              </xsl:call-template>
         
     | 
| 
      
 432 
     | 
    
         
            +
              <xsl:text>"</xsl:text>
         
     | 
| 
      
 433 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 434 
     | 
    
         
            +
             
     | 
| 
      
 435 
     | 
    
         
            +
            <!-- pis -->
         
     | 
| 
      
 436 
     | 
    
         
            +
            <xsl:template mode="verb" match="processing-instruction()"/>
         
     | 
| 
      
 437 
     | 
    
         
            +
             
     | 
| 
      
 438 
     | 
    
         
            +
            <!-- only works if parser passes on comment nodes -->
         
     | 
| 
      
 439 
     | 
    
         
            +
            <xsl:template mode="verb" match="comment()"/>
         
     | 
| 
      
 440 
     | 
    
         
            +
             
     | 
| 
      
 441 
     | 
    
         
            +
             
     | 
| 
      
 442 
     | 
    
         
            +
            <!-- text elements
         
     | 
| 
      
 443 
     | 
    
         
            +
                 need to replace & and < by entity references-->
         
     | 
| 
      
 444 
     | 
    
         
            +
            <xsl:template mode="verb" match="text()">
         
     | 
| 
      
 445 
     | 
    
         
            +
              <a name="{generate-id(.)}"/>
         
     | 
| 
      
 446 
     | 
    
         
            +
              <xsl:call-template name="string-replace">
         
     | 
| 
      
 447 
     | 
    
         
            +
                <xsl:with-param name="to" select="'&gt;'"/>
         
     | 
| 
      
 448 
     | 
    
         
            +
                <xsl:with-param name="from" select="'>'"/> 
         
     | 
| 
      
 449 
     | 
    
         
            +
                <xsl:with-param name="string">
         
     | 
| 
      
 450 
     | 
    
         
            +
                  <xsl:call-template name="string-replace">
         
     | 
| 
      
 451 
     | 
    
         
            +
                    <xsl:with-param name="to" select="'&lt;'"/>
         
     | 
| 
      
 452 
     | 
    
         
            +
                    <xsl:with-param name="from" select="'<'"/> 
         
     | 
| 
      
 453 
     | 
    
         
            +
                    <xsl:with-param name="string">
         
     | 
| 
      
 454 
     | 
    
         
            +
                      <xsl:call-template name="string-replace">
         
     | 
| 
      
 455 
     | 
    
         
            +
                        <xsl:with-param name="to" select="'&amp;'"/>
         
     | 
| 
      
 456 
     | 
    
         
            +
                        <xsl:with-param name="from" select="'&'"/> 
         
     | 
| 
      
 457 
     | 
    
         
            +
                        <xsl:with-param name="string" select="."/>
         
     | 
| 
      
 458 
     | 
    
         
            +
                      </xsl:call-template>
         
     | 
| 
      
 459 
     | 
    
         
            +
                    </xsl:with-param>
         
     | 
| 
      
 460 
     | 
    
         
            +
                  </xsl:call-template>
         
     | 
| 
      
 461 
     | 
    
         
            +
                </xsl:with-param>
         
     | 
| 
      
 462 
     | 
    
         
            +
              </xsl:call-template>
         
     | 
| 
      
 463 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 464 
     | 
    
         
            +
             
     | 
| 
      
 465 
     | 
    
         
            +
             
     | 
| 
      
 466 
     | 
    
         
            +
            <!-- end  verb mode -->
         
     | 
| 
      
 467 
     | 
    
         
            +
             
     | 
| 
      
 468 
     | 
    
         
            +
            <!-- replace all occurences of the character(s) `from'
         
     | 
| 
      
 469 
     | 
    
         
            +
                 by the string `to' in the string `string'.-->
         
     | 
| 
      
 470 
     | 
    
         
            +
            <xsl:template name="string-replace" >
         
     | 
| 
      
 471 
     | 
    
         
            +
              <xsl:param name="string"/>
         
     | 
| 
      
 472 
     | 
    
         
            +
              <xsl:param name="from"/>
         
     | 
| 
      
 473 
     | 
    
         
            +
              <xsl:param name="to"/>
         
     | 
| 
      
 474 
     | 
    
         
            +
              <xsl:choose>
         
     | 
| 
      
 475 
     | 
    
         
            +
                <xsl:when test="contains($string,$from)">
         
     | 
| 
      
 476 
     | 
    
         
            +
                  <xsl:value-of select="substring-before($string,$from)"/>
         
     | 
| 
      
 477 
     | 
    
         
            +
                  <xsl:value-of select="$to"/>
         
     | 
| 
      
 478 
     | 
    
         
            +
                  <xsl:call-template name="string-replace">
         
     | 
| 
      
 479 
     | 
    
         
            +
                  <xsl:with-param name="string" select="substring-after($string,$from)"/>
         
     | 
| 
      
 480 
     | 
    
         
            +
                  <xsl:with-param name="from" select="$from"/>
         
     | 
| 
      
 481 
     | 
    
         
            +
                  <xsl:with-param name="to" select="$to"/>
         
     | 
| 
      
 482 
     | 
    
         
            +
                  </xsl:call-template>
         
     | 
| 
      
 483 
     | 
    
         
            +
                </xsl:when>
         
     | 
| 
      
 484 
     | 
    
         
            +
                <xsl:otherwise>
         
     | 
| 
      
 485 
     | 
    
         
            +
                  <xsl:value-of select="$string"/>
         
     | 
| 
      
 486 
     | 
    
         
            +
                </xsl:otherwise>
         
     | 
| 
      
 487 
     | 
    
         
            +
              </xsl:choose>
         
     | 
| 
      
 488 
     | 
    
         
            +
            </xsl:template>
         
     | 
| 
      
 489 
     | 
    
         
            +
             
     | 
| 
      
 490 
     | 
    
         
            +
             
     | 
| 
      
 491 
     | 
    
         
            +
            <!-- end of verb.xsl -->
         
     | 
| 
      
 492 
     | 
    
         
            +
             
     | 
| 
      
 493 
     | 
    
         
            +
             
     | 
| 
      
 494 
     | 
    
         
            +
             
     | 
| 
      
 495 
     | 
    
         
            +
            <h:h2>IE5XSL stylesheet</h:h2>
         
     | 
| 
      
 496 
     | 
    
         
            +
            <h:p>In a rare fit of sympathy for users of
         
     | 
| 
      
 497 
     | 
    
         
            +
            <h:em>the-language-known-as-XSL-in-IE5</h:em> this file incorporates a
         
     | 
| 
      
 498 
     | 
    
         
            +
            version of the above code designed to work in the Microsoft dialect.
         
     | 
| 
      
 499 
     | 
    
         
            +
            This is needed otherwise users of a MathML rendering behaviour would
         
     | 
| 
      
 500 
     | 
    
         
            +
            have to make a choice whether they wanted to use this stylesheet
         
     | 
| 
      
 501 
     | 
    
         
            +
            (keeping their source documents conforming XHTML+MathML) or to use
         
     | 
| 
      
 502 
     | 
    
         
            +
            the explicit Microsoft Object code, which is less portable, but would
         
     | 
| 
      
 503 
     | 
    
         
            +
            work in at least IE5.5.</h:p>
         
     | 
| 
      
 504 
     | 
    
         
            +
             
     | 
| 
      
 505 
     | 
    
         
            +
            <h:p>This entire section of code, down to the end of the stylesheet is
         
     | 
| 
      
 506 
     | 
    
         
            +
            contained within this ie5:if. Thus XSLT sees it as a top level element
         
     | 
| 
      
 507 
     | 
    
         
            +
            from a foreign namespace and silently ignores it. IE5XSL sees it as
         
     | 
| 
      
 508 
     | 
    
         
            +
            "if true" and so executes the code.</h:p>
         
     | 
| 
      
 509 
     | 
    
         
            +
             
     | 
| 
      
 510 
     | 
    
         
            +
             
     | 
| 
      
 511 
     | 
    
         
            +
            <h:p doc:ref="closecomment">First close the comment started at the beginning. This ensures
         
     | 
| 
      
 512 
     | 
    
         
            +
            that the bulk of the XSLT code, while being copied to the result tree
         
     | 
| 
      
 513 
     | 
    
         
            +
            by the IE5XSL engine, will not be rendered in the browser.</h:p>
         
     | 
| 
      
 514 
     | 
    
         
            +
             
     | 
| 
      
 515 
     | 
    
         
            +
            <h:span doc:ref="eval">Lacking attribute value templates in
         
     | 
| 
      
 516 
     | 
    
         
            +
            xsl:element, and the local-name() function, we resort to constructing
         
     | 
| 
      
 517 
     | 
    
         
            +
            the start and end tags in strings in javascript, then using
         
     | 
| 
      
 518 
     | 
    
         
            +
            no-entities attribute which is the IE5XSL equivalent of disable-output-encoding</h:span>
         
     | 
| 
      
 519 
     | 
    
         
            +
            <ie5:if test=".">
         
     | 
| 
      
 520 
     | 
    
         
            +
             
     | 
| 
      
 521 
     | 
    
         
            +
            <ie5:eval doc:id="closecomment" no-entities="t">'-->'</ie5:eval>
         
     | 
| 
      
 522 
     | 
    
         
            +
             
     | 
| 
      
 523 
     | 
    
         
            +
            <ie5:apply-templates select=".">
         
     | 
| 
      
 524 
     | 
    
         
            +
             
     | 
| 
      
 525 
     | 
    
         
            +
             
     | 
| 
      
 526 
     | 
    
         
            +
            <ie5:script>
         
     | 
| 
      
 527 
     | 
    
         
            +
                function mpisinstalled() 
         
     | 
| 
      
 528 
     | 
    
         
            +
                {
         
     | 
| 
      
 529 
     | 
    
         
            +
                try {
         
     | 
| 
      
 530 
     | 
    
         
            +
                    var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
         
     | 
| 
      
 531 
     | 
    
         
            +
                    return "true";
         
     | 
| 
      
 532 
     | 
    
         
            +
                } catch (e) {
         
     | 
| 
      
 533 
     | 
    
         
            +
                    return "false";
         
     | 
| 
      
 534 
     | 
    
         
            +
                }
         
     | 
| 
      
 535 
     | 
    
         
            +
            }
         
     | 
| 
      
 536 
     | 
    
         
            +
            </ie5:script>
         
     | 
| 
      
 537 
     | 
    
         
            +
             
     | 
| 
      
 538 
     | 
    
         
            +
            <ie5:template match="/">
         
     | 
| 
      
 539 
     | 
    
         
            +
            <ie5:apply-templates/>
         
     | 
| 
      
 540 
     | 
    
         
            +
            </ie5:template>
         
     | 
| 
      
 541 
     | 
    
         
            +
             
     | 
| 
      
 542 
     | 
    
         
            +
            <ie5:template match="head|h:head"/>
         
     | 
| 
      
 543 
     | 
    
         
            +
             
     | 
| 
      
 544 
     | 
    
         
            +
            <ie5:template match="text()">
         
     | 
| 
      
 545 
     | 
    
         
            +
            <ie5:value-of select="."/>
         
     | 
| 
      
 546 
     | 
    
         
            +
            </ie5:template>
         
     | 
| 
      
 547 
     | 
    
         
            +
             
     | 
| 
      
 548 
     | 
    
         
            +
            <ie5:template match="*|@*">
         
     | 
| 
      
 549 
     | 
    
         
            +
            <ie5:copy>
         
     | 
| 
      
 550 
     | 
    
         
            +
            <ie5:apply-templates select="*|text()|@*"/>
         
     | 
| 
      
 551 
     | 
    
         
            +
            </ie5:copy>
         
     | 
| 
      
 552 
     | 
    
         
            +
            </ie5:template>
         
     | 
| 
      
 553 
     | 
    
         
            +
             
     | 
| 
      
 554 
     | 
    
         
            +
             
     | 
| 
      
 555 
     | 
    
         
            +
            <ie5:template match="mml:*">
         
     | 
| 
      
 556 
     | 
    
         
            +
            <ie5:eval  no-entities="t" doc:id="eval">'<mml:' + this.nodeName.substring(this.nodeName.indexOf(":")+1)</ie5:eval>
         
     | 
| 
      
 557 
     | 
    
         
            +
            <ie5:for-each select="@*">
         
     | 
| 
      
 558 
     | 
    
         
            +
            <ie5:eval no-entities="t">' ' + this.nodeName</ie5:eval>="<ie5:value-of select="."/>"
         
     | 
| 
      
 559 
     | 
    
         
            +
            </ie5:for-each>
         
     | 
| 
      
 560 
     | 
    
         
            +
            <ie5:eval no-entities="t">'>'</ie5:eval>
         
     | 
| 
      
 561 
     | 
    
         
            +
            <ie5:apply-templates select="*|text()"/>
         
     | 
| 
      
 562 
     | 
    
         
            +
            <ie5:eval no-entities="t">'</mml:' +  this.nodeName.substring(this.nodeName.indexOf(":")+1) + '>'</ie5:eval>
         
     | 
| 
      
 563 
     | 
    
         
            +
            </ie5:template>
         
     | 
| 
      
 564 
     | 
    
         
            +
             
     | 
| 
      
 565 
     | 
    
         
            +
             
     | 
| 
      
 566 
     | 
    
         
            +
            <ie5:template match="mml:math">
         
     | 
| 
      
 567 
     | 
    
         
            +
            <ie5:if expr="mpisinstalled()=='false'">
         
     | 
| 
      
 568 
     | 
    
         
            +
            <embed  type="text/mathml" height="75" width="300">
         
     | 
| 
      
 569 
     | 
    
         
            +
            <ie5:attribute name="mmldata">
         
     | 
| 
      
 570 
     | 
    
         
            +
            <ie5:eval  doc:id="eval"  no-entities="t">'<math>'</ie5:eval>
         
     | 
| 
      
 571 
     | 
    
         
            +
            <ie5:apply-templates/>
         
     | 
| 
      
 572 
     | 
    
         
            +
            <ie5:eval  doc:id="eval"  no-entities="t">'</math>'</ie5:eval>
         
     | 
| 
      
 573 
     | 
    
         
            +
            </ie5:attribute>
         
     | 
| 
      
 574 
     | 
    
         
            +
            </embed>
         
     | 
| 
      
 575 
     | 
    
         
            +
            </ie5:if>
         
     | 
| 
      
 576 
     | 
    
         
            +
            <ie5:if expr="mpisinstalled()=='true'">
         
     | 
| 
      
 577 
     | 
    
         
            +
            <ie5:eval  doc:id="eval"  no-entities="t">'<mml:' + this.nodeName.substring(this.nodeName.indexOf(":")+1)</ie5:eval>
         
     | 
| 
      
 578 
     | 
    
         
            +
            <ie5:for-each select="@*">
         
     | 
| 
      
 579 
     | 
    
         
            +
            <ie5:eval no-entities="t">' ' + this.nodeName</ie5:eval>="<ie5:value-of select="."/>"
         
     | 
| 
      
 580 
     | 
    
         
            +
            </ie5:for-each>
         
     | 
| 
      
 581 
     | 
    
         
            +
            <ie5:eval no-entities="t">'>'</ie5:eval>
         
     | 
| 
      
 582 
     | 
    
         
            +
            <ie5:apply-templates select="*|text()"/>
         
     | 
| 
      
 583 
     | 
    
         
            +
            <ie5:eval no-entities="t">'</mml:' +  this.nodeName.substring(this.nodeName.indexOf(":")+1) + '>'</ie5:eval>
         
     | 
| 
      
 584 
     | 
    
         
            +
            </ie5:if>
         
     | 
| 
      
 585 
     | 
    
         
            +
            </ie5:template>
         
     | 
| 
      
 586 
     | 
    
         
            +
             
     | 
| 
      
 587 
     | 
    
         
            +
            <ie5:template match="html|h:html">
         
     | 
| 
      
 588 
     | 
    
         
            +
            <html   xmlns:mml="http://www.w3.org/1998/Math/MathML">
         
     | 
| 
      
 589 
     | 
    
         
            +
            <head>
         
     | 
| 
      
 590 
     | 
    
         
            +
            <ie5:if expr="mpisinstalled()=='true'">
         
     | 
| 
      
 591 
     | 
    
         
            +
            <object id="mmlFactory"
         
     | 
| 
      
 592 
     | 
    
         
            +
                    classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">
         
     | 
| 
      
 593 
     | 
    
         
            +
            </object>
         
     | 
| 
      
 594 
     | 
    
         
            +
            <ie5:pi name="IMPORT">
         
     | 
| 
      
 595 
     | 
    
         
            +
             namespace="mml" implementation="#mmlFactory"
         
     | 
| 
      
 596 
     | 
    
         
            +
            </ie5:pi>
         
     | 
| 
      
 597 
     | 
    
         
            +
            </ie5:if>
         
     | 
| 
      
 598 
     | 
    
         
            +
            <ie5:apply-templates select="h:head/*|head/*"/>
         
     | 
| 
      
 599 
     | 
    
         
            +
            </head>
         
     | 
| 
      
 600 
     | 
    
         
            +
            <body>
         
     | 
| 
      
 601 
     | 
    
         
            +
            <ie5:apply-templates select="body|h:body"/>
         
     | 
| 
      
 602 
     | 
    
         
            +
            </body>
         
     | 
| 
      
 603 
     | 
    
         
            +
            </html>
         
     | 
| 
      
 604 
     | 
    
         
            +
            </ie5:template>
         
     | 
| 
      
 605 
     | 
    
         
            +
             
     | 
| 
      
 606 
     | 
    
         
            +
            </ie5:apply-templates>
         
     | 
| 
      
 607 
     | 
    
         
            +
             
     | 
| 
      
 608 
     | 
    
         
            +
             
     | 
| 
      
 609 
     | 
    
         
            +
            </ie5:if>
         
     | 
| 
      
 610 
     | 
    
         
            +
             
     | 
| 
      
 611 
     | 
    
         
            +
             
     | 
| 
      
 612 
     | 
    
         
            +
            </xsl:stylesheet>
         
     |