[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: MathML and XSL

Subject: Re: MathML and XSL
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 13 Nov 2002 22:53:47 +0100
mathml and xsl
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.