Special characters turn out as garbage in xslt->html conversion

Subject: Special characters turn out as garbage in xslt->html conversion
From: Guðmundur Erlingsson <txakolin@xxxxxxxxx>
Date: Fri, 8 Sep 2000 09:03:15 -0000
Hi all,

First of, thanks to all who gave me advice on xslt->html conversion, I have
now solved the problem. Except it led to another problem. But that's life,

Anyway, I have a xml-file with a list of employees. The list is broken into
alphabetical sections. In the XSL-file I put in two loops. The first one
goes through the document and collects data on the alphabetical sections and
outputs an html table that shows all the letters of the alphabets as links
to the appropriate sections. It looks like this:

                <xsl:for-each select="skjal/hluti">
                    <xsl:attribute name="href">#<xsl:value-of select="@id"/>

                    </xsl:attribute><xsl:value-of select="@id"/>

The second loop goes through the document, one section at a time, prints out
the name of each section and displays appropriate data on employees that
pertain to that section, like this:

            <xsl:for-each select="skjal/hluti">
                  <xsl:attribute name="name">
                    <xsl:value-of select="@id"/>
                  <xsl:value-of select="@id"/>
               <xsl:for-each select="starfsm">
                <p class="noindent">
                    <xsl:when test="starf[.='']"><xsl:value-of
                    <xsl:otherwise><xsl:value-of select="nafn"/>,
                    <xsl:when test="starf[.='']"></xsl:when>
                    <xsl:when test="deild[.='']"><br/></xsl:when>
                    <xsl:when test="netfang[.='']"></xsl:when>
                    <xsl:otherwise><i>Netfang:</i> <tt><xsl:value-of
                 <i>Sími:</i> <xsl:value-of select="simi"/></p><br/>

So far so good. As I am using Icelandic I put 'encoding="iso-8859-1"' at
beginning of the files, and also use "<xsl:output method="html"/>" (I'm
using instant-saxon for the conversion to html). Everything works ok, except
the "href" attribute. That is, the second loop gives this (for an A with
acute accent): 

      <a name="&Aacute;">&Aacute;</a>

just like it should. If however the html-attribute is "href" the output is
like this in html:

      <a href="#%C3%81">&Aacute;</a>

I have absolutely no idea why this happens and haven't been able to find any
clues. This could of course be a bug in saxon for all I know. Any ideas?


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

Current Thread