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

Re: Parsing errors on unknown entities (unicode characters)

Subject: Re: Parsing errors on unknown entities (unicode characters)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 26 Nov 1999 10:04:50 GMT
select char text unicode
> I'll fix the stylesheet before generating the MathML 2 entity files...

I think this produces well formed entity files.

David


<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xt="http://www.jclark.com/xt"
                extension-element-prefixes="xt"
                version="1.0">


<xsl:output
  method="text"
  />

<xsl:template name="alphadecl">
<xsl:param name="set"/>
<xsl:variable name="x">
  <xsl:choose>
  <xsl:when test="starts-with($set,'9')">
    <xsl:value-of select="substring-after($set,'13-')"/>
  </xsl:when>
  <xsl:when test="starts-with($set,'8')">
    <xsl:value-of select="substring-after($set,'-')"/>
  </xsl:when>
  <xsl:otherwise>
   <xsl:value-of select="$set"/>
  </xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xt:document method="text"  href="{$x}.ent">
  <xsl:for-each select="character/entity[@set=$set]">
    <xsl:sort select="@id"/>
    <xsl:text>&lt;!ENTITY </xsl:text>
    <xsl:value-of  select="@id"/>
    <xsl:call-template name="pad">
      <xsl:with-param
               name="x"
              select="15-string-length(@id)-string-length(string(../@dec))"/>
    </xsl:call-template>
    <xsl:text> "&amp;#</xsl:text>
    <xsl:if test="60 = ../@dec or 38 = ../@dec">
      <xsl:text>38;#</xsl:text>
    </xsl:if>
    <xsl:value-of select="../@dec"/>
    <xsl:text>;" &gt;&lt;!--</xsl:text>
    <xsl:value-of  select="../@id"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="desc"/>
    <xsl:text> --&gt;&#xA;</xsl:text>
  </xsl:for-each>
</xt:document>

</xsl:template>


<xsl:template name="pad">
<xsl:param name="x"/>
<xsl:if test="$x &gt; 0">
<xsl:text> </xsl:text>
<xsl:call-template name="pad">
<xsl:with-param name="x" select="$x - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template match="charlist">



  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isoamsa'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isoamsb'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isoamsc'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isoamso'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isoamsr'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isogrk3'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isomfrk'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isomopf'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isomscr'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'9573-13-isotech'"/>
  </xsl:call-template>


  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isobox'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isocyr1'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isocyr2'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isodia'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isogrk1'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isogrk2'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isolat1'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isolat2'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isonum'"/>
  </xsl:call-template>
  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'8879-isopub'"/>
  </xsl:call-template>


  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'mmlextra'"/>
  </xsl:call-template>

  <xsl:call-template name="alphadecl">
    <xsl:with-param name="set" select="'mmlalias'"/>
  </xsl:call-template>

</xsl:template>
</xsl:stylesheet>


 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.