|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Parsing errors on unknown entities (unicode characters)
> 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"/><!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> "&#<xsl:value-of
select="../@dec"/>" ><--<xsl:value-of
select="../@id"/><xsl:text> </xsl:text>
<xsl:value-of select="desc"/> -->
</xsl:for-each>
</xt:document>
</xsl:template>
<xsl:template name="pad">
<xsl:param name="x"/>
<xsl:if test="$x > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








