[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: Thu, 25 Nov 1999 10:03:14 GMT
xsl value of unicode
> as someone said, http://www.tug.org/applications/jadetex/unicode.xml
> contains everything that I have ever discovered, from which you can
> extract what you want. the real claim to fame of this monster is that
> it contains all the MathML characters (all recent changes to this file 
> come from David Carlisle, using it for MathML)

The entity files distributed in the zip file linked from the MathML 1.01
REC were generated from this file using dsssl, and just include the
entity sets used in MathML. Some of the ISO entity sets not needed for
MathML are not distributed, although the source information is in
unicode.xml.

The xsl below will extract an XML compatible entity file (or files) from
unicode.xml, just edit it to get the sets you want, as posted it just
makes one for ISOPUB from ISO 8879. It uses the xt:document extension
for xt. Information for how to make it work with other XSL engines
greatfully received. (Vendor neutral extension namespace, perhaps?:-)

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"/>&lt;!ENTITY <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> "&amp;#<xsl:value-of 
      select="../@dec"/>" &gt;&lt;--<xsl:value-of 
      select="../@id"/><xsl:text> </xsl:text>
<xsl:value-of select="desc"/> --&gt;
</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="'8879-isopub'"/>
  </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.