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

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

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
xslt html special characters
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,
right.

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">
                  <td><a>
                    <xsl:attribute name="href">#<xsl:value-of select="@id"/>

                    </xsl:attribute><xsl:value-of select="@id"/>
                    </a>
                  </td>
                </xsl:for-each>

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


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?

Guðmundur


 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.