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

Non English characters in attribute values

Subject: Non English characters in attribute values
From: David Sinclair <dsinclair@xxxxxxxxxxxx>
Date: Mon, 20 Sep 2004 11:55:01 +0100
david sinclair
Hi,

I am having a problem with non-english characters and how they appear in
attribute values as apposed to element content.   This is a simplified
version of the code I having a problem with:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="html" version="4.01" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
   <html>
      <body><xsl:apply-templates select="//values" /></body>
   </html>
</xsl:template>

<xsl:template match="values">
   <ul><xsl:apply-templates select="value" /></ul>
</xsl:template>

<xsl:template match="value">
   <li>
       <xsl:element name="a">
           <xsl:attribute
name="href">javascript:pushSelectionBackToOpener('<xsl:value-of
select="."/>')</xsl:attribute>
           <xsl:value-of select="."/>
       </xsl:element>
   </li>
</xsl:template>
</xsl:stylesheet>

Here is an example of the source document:
<?xml version="1.0" encoding="utf-8"?>
<result>
   <values>
       <value>Larry</value>
       <value>Gishle</value>
   </values>
</result>

The result of running this xsl on the source doc is as follows (note
that the href attribute is different from the element content):
<html xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <head>
     <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

     <title></title>
  </head>
  <body></body>
  <ul>
     <li><a
href="javascript:pushSelectionBackToOpener('Larry')">Larry</a></li>
     <li><a
href="javascript:pushSelectionBackToOpener('Gis%C3%A8le')">Gis&egrave;le</a><
/li>
  </ul>
</html>

The javascript function puts its parameter into an htm form field, and
appears as "GisC(le" instead of  "Gishle".  Does anyone know how I can
get the right value to apear in the attribute value?  I am using  Saxon
8 BTW.

David Sinclair.

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.