Re: MathML JavaScript Question

> Am I doing something wrong? Is this a limitation of the style sheets?
> Any help will be gratefully received!!! 

I don't think it's really the stylesheets so much as the difference
between scripting in an xml and html dom. You don't say which browser
you are using but the details are likely to be different unless your
javascript explicitly uses code to work cross browser.

In firefox for example you don't need the stylesheet at all to display
xhtml+mathml but your test file works in the same way (not displaying
the script) I think you need to generate the elements using suitable dom
calls to create the nodes rather than using document.write() in xhtml but
cross browser javascript isn't really my speciality, others may comment.
Note also that in an xhtml script element (unlike an html script
element) < will start an element tag rather than just standing for a <
character.

so

 <script>
      	document.write("<math ...</math>");
</script>

will be parsed as

a script node with three child nodes,
1) a text node
' 
      	document.write("'
2) a child math element node
3) and a second text node 
'
");
'

If you want to pass "<math xmlns=.... " as a _string_ to a javascript
function then you'd need
 <script><![CDATA[

...
]]></script>

so that < and & were not special. (This is not needed in html as in html
script and style are declared as CDATA elements, but the CDATA element
type does not exist in XML, so in XHTML you have to explictly escape
scripts that use < or &.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Received on Wednesday, 14 December 2005 15:51:16 UTC