Fred (archive)
Usenet Archive
- Joined
- Jul 4, 2001
- Messages
- 348
- Reaction score
- 0
I'm experimenting with MathML, and have run into difficulty.
Given the simple XML:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE component SYSTEM "mathml2.dtd">
<mathDisplay>
<math>
<msub>
<mi>z</mi>
<mn>2</mn>
</msub>
</math>
</mathDisplay>
and the simple XSLT stylesheet given below, I expect the output <?xml version="1.0" encoding="utf-8"?> <mathML><xmathDisplay><xmath><xmsub><xmi>z</xmi> <xmn>2</xmn></xmsub></xmath></xmathDisplay></mathML> Instead, I get <?xml version="1.0" encoding="utf-8"?> <mathML><xmathDisplay>z2</xmathDisplay></mathML> I get the results I expect if I delete the DOCTYPE line from the xml file.
I can also get the results I expect if I change the names of the MathML elements to, say, <a>, <b>, <c>, ...
In what way is the behavior of an XSLT stylesheet dependent upon the details of an XML document's doctype?
Thanks!
The spreadsheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="*"/> <xsl
utput method="xml" encoding="utf-8"/> <xsl:template match="/"> <mathML> <xsl:apply-templates/> </mathML> </xsl:template> <xsl:template match="mathDisplay"> <xmathDisplay> <xsl:apply-templates/> </xmathDisplay> </xsl:template> <xsl:template match="math"> <xmath> <xsl:apply-templates/> </xmath> </xsl:template> <xsl:template match="msub"> <xmsub> <xsl:apply-templates/> </xmsub> </xsl:template> <xsl:template match="mi"> <xmi> <xsl:apply-templates/> </xmi> </xsl:template> <xsl:template match="mn"> <xmn> <xsl:apply-templates/> </xmn> </xsl:template> </xsl:stylesheet>
Given the simple XML:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE component SYSTEM "mathml2.dtd">
<mathDisplay>
<math>
<msub>
<mi>z</mi>
<mn>2</mn>
</msub>
</math>
</mathDisplay>
and the simple XSLT stylesheet given below, I expect the output <?xml version="1.0" encoding="utf-8"?> <mathML><xmathDisplay><xmath><xmsub><xmi>z</xmi> <xmn>2</xmn></xmsub></xmath></xmathDisplay></mathML> Instead, I get <?xml version="1.0" encoding="utf-8"?> <mathML><xmathDisplay>z2</xmathDisplay></mathML> I get the results I expect if I delete the DOCTYPE line from the xml file.
I can also get the results I expect if I change the names of the MathML elements to, say, <a>, <b>, <c>, ...
In what way is the behavior of an XSLT stylesheet dependent upon the details of an XML document's doctype?
Thanks!
The spreadsheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="*"/> <xsl