Hello Gerard,
Gerard Milmeister wrote:
On Sat, 2002-11-09 at 22:46, David Carlisle wrote:
<!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
%mathml;
as noted in the mathml errata there's an updated dtd in
http://www.w3.org/Math/DTD/mathml2/mathml2.dtd
<xsl:template match="math">
the mathml dt dthat you've included will default mathml elements in to
the mathml namespace so this will need to be
<xsl:template match="m:math">
where m: is bound in the stylesheet to the mathml namespace
since you just want to copy math and all it's children you can simplify
what you had to
<xsl:template match="m:math">
<xsl:copy-of select"."/>
</xsl:template>
In the meantime I found the following solution.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.w3.org/1998/Math/MathML"
version="1.0">
<xsl:template match="m:*">
<xsl:element name="{name(.)}"
namespace="http://www.w3.org/1998/Math/MathML">
I think you can remove the attribute 'namespace'. This should remove the
namespace declarations on every output element. Instead of
<xsl:element name="{name(.)}"> you can then use <xsl:copy>. And the
attribute for-each can be shortened to <xsl:copy-of select="@*"/>.
Does still everything work?
Joerg
<xsl:for-each select="@*">
<xsl:attribute name="{name(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
This seems to work and has the advantage that I may create templates for
certain mathml elements when I would need them.
However, your solution may prove useful...
There is however a difference between the output from xalan (in Cocoon)
and xsltproc.
the xalan is as I would expect, however from xsltproc I get the
following:
<math xmlns="http://www.w3.org/1998/Math/MathML"
overflow="scroll"><msqrt xmlns="http://www.w3.org/1998/Math/MathML"><mi
xmlns="http://www.w3.org/1998/Math/MathML">x</mi>+<mi
xmlns="http://www.w3.org/1998/Math/MathML">y</mi></msqrt></math>
that is the namespace is included in every tag. Is this correct
and simply redundant or what?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list