W3C home > Mailing lists > Public > www-math@w3.org > March 2003

Re: Adding unicode mappings to any document (including MathML)

From: Reece Dunn <msclrhd@hotmail.com>
Date: Fri, 14 Mar 2003 13:28:08 +0000
To: shade33@mail.ru
Cc: www-math@w3.org
Message-ID: <F16uAy0BYTxHwMQFLcV00000f62@hotmail.com>
>What do you think about entities.xsl from my XSLT MathML library.

Where can I find entities.xsl?


>What about used algorithm?

The main algorithm is this:

   <xsl:template match = "text()" name = "text"> <xsl:param name = "x" 
select = "."/>
      <xsl:variable name = "y" select = "normalize-space($x)"/>
      <xsl:variable name = "u" select = 
"msxsl:node-set($unicode)[@value=$y]"/>
      <xsl:choose>
         <xsl:when test = "$u and msxsl:node-set($u)/@font">
            <span style = "font-family: '{msxsl:node-set($u)/@font}';">
               <xsl:copy-of select = "msxsl:node-set($u)/node()"/>
            </span>
         </xsl:when><xsl:when test = "msxsl:node-set($u)">
            <xsl:copy-of select = "msxsl:node-set($u)/node()"/>
         </xsl:when><xsl:when test = "ancestor::*[1][ self::po ]">
            <xsl:copy-of select = "$y"/>
         </xsl:when><xsl:otherwise>
            <xsl:value-of select = "$x"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

At the moment it makes use of the microsoft msxsl:node-set(...) function. 
This is another thing I am looking into generalizing (adding XSLT2.0 
support?)

the main table is created like this:

   <xsl:variable name = "unicode" select = "
      document('U+00000.xsl')/*/unicode:entry
    | document('U+00300.xsl')/*/unicode:entry | 
document('U+00370.xsl')/*/unicode:entry
    | document('U+02000.xsl')/*/unicode:entry
    | document('U+02100.xsl')/*/unicode:entry | 
document('U+02150.xsl')/*/unicode:entry | 
document('U+02190.xsl')/*/unicode:entry
    | document('U+02200.xsl')/*/unicode:entry
    | document('U+02300.xsl')/*/unicode:entry
    | document('U+03000.xsl')/*/unicode:entry
   "/>

with some of the entries from U+02300.xsl looking like this:

   <unicode:entry ver = "3.2" value = "&#9115;" font = 
"Symbol"></unicode:entry> <!-- left  paren upper hook -->
   <unicode:entry ver = "3.2" value = "&#9116;" font = 
"Symbol"></unicode:entry> <!-- left  paren extension -->
   <unicode:entry ver = "3.2" value = "&#9117;" font = 
"Symbol"></unicode:entry> <!-- left  paren lower hook -->
   <unicode:entry ver = "3.2" value = "&#9118;" font = 
"Symbol"></unicode:entry> <!-- right paren upper hook -->
   <unicode:entry ver = "3.2" value = "&#9119;" font = 
"Symbol"></unicode:entry> <!-- right paren extension -->
   <unicode:entry ver = "3.2" value = "&#9120;" font = 
"Symbol"></unicode:entry> <!-- right paren lower hook -->

I don't know how this differs from yours.

Also, if anyone wants the complete thing, ask me via e-mail and I will send 
it you.

-rhd-
mailto:msclrhd@hotmail.com

_________________________________________________________________



Received on Friday, 14 March 2003 08:28:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:54 GMT