<html>
<body>
Well, the task is pretty simple, but I can't get anything working.
<br><br>
I want to parse in an xhtml document containing mathml with all the
entitities defined like alpha and beta. This should then be transformed
using xslt into another xml-document.<br>
The test-xhtml document is shown below:<br>
----<br>
<i><?xml version="1.0"
encoding="ISO-8859-1"?><br>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML
2.0//EN"<br>
"<a href="http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" eudora="autourl">http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd</a>"
[<!ENTITY mathml
"http://www.w3.org/1998/Math/MathML">]><br>
<html xmlns="http://www.w3.org/1999/xhtml"><br>
<body> <br>
<math
xmlns="http://www.w3.org/1998/Math/MathML"><br>
<mrow><br>
<mi>&#950;</mi><br>
</mrow><br>
</math><br>
</body><br>
<x-tab> </x-tab></html><br>
</i>----<br><br>
Here is what I've tryed:<br><br>
Parsing the document in using a SAXBuilder with the default
settings:<br>
-----<br>
<i>SAXBuilder builder = new
SAXBuilder(); <br>
FileInputStream stream =
null;<br>
if (file.exists()) {<br>
try
{<br>
stream = new FileInputStream(file);<br>
InputStreamReader reader = new InputStreamReader(stream);<br>
builder.setValidation(false);<br>
try {<br>
doc = builder.build(reader);<br>
} catch (Exception e) {<br>
e.printStackTrace();<br>
}<br>
} <br>
}<br>
</i>---<br>
This results in this error:<br>
<i> "org.jdom.IllegalTargetException: The target
"IS10744:arch" is not legal for JDOM/XML Processing
Instructions: Processing instruction targets cannot contain
colons."<br><br>
</i>Then I tryed to trick the SAXBuilder so that the DTD's are not used
by setting the entityResolver to an entityResolver, that doesn't do
anything.<br>
---<br>
<x-tab> </x-tab><i>SAXBuilder
builder = new SAXBuilder();<br>
<x-tab> </x-tab>builder.setEntityResolver(new
NoOpEntityResolver());<br>
</i>---<br>
This results in some output to System.err:<br>
<i><x-tab> </x-tab>"[Fatal
Error] :1:66: White spaces are required between publicId and
systemId."<br>
</i>But the transformation seems to occur.<br><br>
I tryed writing the parsed document to a file. This file doesn't contain
the entity: <i>&#950;</i> <br>
---<br>
<i><?xml version="1.0" encoding="UTF-8"?><br>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML
2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"><br>
<html xmlns="http://www.w3.org/1999/xhtml"><br>
<body bgcolor="white"><br>
Hello world<br>
<math
xmlns="http://www.w3.org/1998/Math/MathML"><br>
<mrow><br>
<mi>?</mi><br>
</mrow><br>
</math><br>
</body><br>
<x-tab> </x-tab></html><br>
---<br>
</i>That could be due to an encoding mistake somewhere.<br><br>
So as you can tell I've been struggling with this issue for quite some
time getting nowhere. Is it really that difficult parsing in an xhtml
document and transforming it using xslt?<br><br>
How can I transform an xhtml document containing mathml into another xml
document using xslt?<br><br>
Regards<br><br>
<x-sigsep><p></x-sigsep>
Morten Andersen<br>
Master of applied mathematics and computer science<br>
Associate professor<br><br>
The Maersk Institute of Production technology at Southern Danish
University
<a href="http://www.mip.sdu.dk/" eudora="autourl">www.mip.sdu.dk<br>
</a>Campusvej 55<br>
DK-5230 Odense M<br>
Denmark<br>
+45 65 50 36 54<br>
+45 61 71 11 03<br>
Jabber id: hat@jabber.dk<br>
</body>
</html>