[xsl] Entity References

Subject: [xsl] Entity References
From: "Werner Hager" <eryndel@xxxxxxxx>
Date: Tue, 7 Aug 2001 09:54:32 -0700
Greetings List,

I've just recently joined and it looks like there is a lot of useful
information going around.   Maybe I can get some ideas about my particular
problem.   I'm writing an XSLT to transform one MathML Document to another
MathML Document with the addition of some formatting tags so it prints
better on a braille printer.   The issue is the special entities that are
used in MathML.  Since a MathML document doesn't need to declare their
entities, I think my processor is having problems with them.   Here is the
sample MathML Document:

<mrow>
   <mfenced>
      <mrow>
         <mi>x</mi>
  <mo>+</mo>
  <mn>2</mn>
      </mrow>
   </mfenced>
   <mo>&InvisibleTimes;</mo>
   <mfenced>
      <mrow>
  <mi>x</mi>
  <mo>-</mo>
  <mn>3</mn>
      </mrow>
   </mfenced>
</mrow>

And this is the XSLT I have so far

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
   <xsl:template match="/">
      <mstyle scriptminsize="36pt" width="5mm">
  <xsl:apply-templates/>
      </mstyle>
   </xsl:template>
   <xsl:template match="mi">
      <mi fontstyle="normal">
  <xsl:apply-templates/>
      </mi>
   </xsl:template>
   <xsl:template match="mfenced">
      <mfenced>
  <mspace/>
  <xsl:apply-templates/>
      </mfenced>
   </xsl:template>
   <xsl:template match="*|@*|text()">
      <xsl:copy>
  <xsl:apply-templates/>
      </xsl:copy>
   </xsl:template>

</xsl:stylesheet>

I'm using Xalan-Java for testing puposes, but I want it to work with MSXSL
as well (I want most of the process to be invisible to the user)   With
Xalan, I get the error [the entity "InvisibleTimes" was referenced but not
declared].   MathML has a large number of these entities...   Any ideas how
I can copy them into the result tree?

Thank you,

Werner Hager
----------------------------------------------
Science Access Project
Oregon State University
werner@xxxxxxxxxxxxxxxxxxxxx
----------------------------------------------




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread