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

Re: MathML tags in an attribute of an HTML EMBED tag ?

Subject: Re: MathML tags in an attribute of an HTML EMBED tag ?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 26 Oct 2000 10:45:02 +0100
embed tag xml
Frédéric,

>and I want to output this :
>
><EMBED TYPE="text/mathml" MMLDATA="
><math>...some mathml ...</math>" HEIGHT="75" WIDTH="200" />
>to render MathML with the IBM techexplorer plug-in.

This is not well-formed XML as it stands.  Do you know whether the the IBM
techexplorer plug-in will work if you have:

<EMBED TYPE="text/mathml" MMLDATA="
&lt;math&gt;...some mathml ...&lt;/math&gt;" HEIGHT="75" WIDTH="200" />

instead, as this *is* well-formed XML and therefore easier to produce?

If so (and I hope so), then you can use a serialising template to take the
contents of the FORMULE element and turn it into a serialised XML version:

----
<xsl:template match="FORMULE">
  <EMBED TYPE="text/mathml" HEIGHT="75" WIDTH="200">
    <xsl:attribute name="MMLDATA">
      <xsl:apply-templates mode="serialise" />
    </xsl:attribute>
  </EMBED>
</xsl:template>

<xsl:template match="*" mode="serialise">
  <xsl:text />&lt;<xsl:value-of select="name()" />
  <xsl:for-each select="@*">
    <xsl:text> </xsl:text>
    <xsl:value-of select="name()" />
    <xsl:text />="<xsl:value-of select="." />"<xsl:text />
  </xsl:for-each>
  <xsl:text>&gt;</xsl:text>
  <xsl:apply-templates mode="serialise" />
  <xsl:text />&lt;/<xsl:value-of select="name()" />&gt;<xsl:text />
</xsl:template>

<xsl:template match="text()[not(normalize-space())]" mode="serialise" />
----

If not, then you have two options.  One is to produce the whole thing as
text;  obviously that's undesirable because you can't take advantage of the
way you can build elements and attributes in XSLT.  The other is to create
an output filter or emitter or whatever that can be plugged into Xalan and
used to serialise the DOM in whatever way you want.  Again, that involves a
lot of work.

Sorry not to be more help,

Jeni


Jeni Tennison
http://www.jenitennison.com/


 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.