[xsl] JavaScript and UTF-8 International Characters

Subject: [xsl] JavaScript and UTF-8 International Characters
From: "Steven Egert" <stvne@xxxxxxxxxxx>
Date: Fri, 04 Jan 2002 10:14:12 -0600
I am trying to get the value returned to a JavaScript function to be the UTF-8 encoded value in a transformation. But whenever I use a JavaScript function and pass a value to that function, that value always comes in unencoded, and when I try to run the script with this value it runs, but the values returned are useless. Here is a copy of my transform:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:a="DAV:" xmlns:XSLUtils="urn:xslutilities" xmlns:html="http://www.w3.org/TR/REC-html40"; exclude-result-prefixes="html XSLUtils a">


<xsl:output method="html" version="4.0" indent="yes" omit-xml-declaration="yes"/>

<xsl:param name="LinkTarget" select="' '"></xsl:param>
<xsl:param name="PageURL" select="' '"></xsl:param>

<xsl:template match="/">

<form name="frmKeywords">
<input type="hidden" name="hidKey"/>
<input type="hidden" name="hidPage"/>
<input type="hidden" name="hidCourse"/>
</form>

<xsl:apply-templates/></xsl:template>
<xsl:template match="searchresponse"><xsl:apply-templates/></xsl:template>
<xsl:template match="responseheaders"/>
<xsl:template match="responseadmin"/>

<xsl:template match="responsedata/a:multistatus">
	<xsl:apply-templates select="a:response"/>
</xsl:template>

<xsl:template match="a:response">
<xsl:element name="tr">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position () mod 2=1">
<xsl:text>white</xsl:text>
</xsl:when>
<xsl:when test="position () mod 2=0">
<xsl:text>shaded</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:attribute>
<td><b>
<xsl:element name="a">
<xsl:choose>
<xsl:when test="$LinkTarget='popwindow'">
<xsl:attribute name="href">JavaScript:openpop('<xsl:value of select="a:propstat/a:prop/ReturnURL"/>')
</xsl:attribute>
<xsl:value-of select="a:propstat/a:prop/Title" />
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="a:propstat/a:prop/ReturnURL"/>
</xsl:attribute>
<xsl:value-of select="a:propstat/a:prop/Title" />
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="target"><xsl:value-of select="$LinkTarget" />
</xsl:attribute>
</xsl:element></b>
<xsl:choose>
<xsl:when test="a:propstat/a:prop/Description=''"> -- No Description Available.
</xsl:when>
<xsl:otherwise>
<xsl:text> -- </xsl:text>
<xsl:value-of select="a:propstat/a:prop/Description"/>
<xsl:text>...</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>
<td align="left">
<xsl:variable name="multivalue2" select="string(a:propstat/a:prop/Keywords)"/>
<xsl:variable name="valuecount2" select="XSLUtils:Count($multivalue2, ';')"></xsl:variable>
<xsl:variable name="one" select="string(XSLUtils:Item($multivalue2,';',1))"></xsl:variable>
<xsl:variable name="two" select="string(XSLUtils:Item($multivalue2,';',2))"></xsl:variable>
<xsl:variable name="three" select="string(XSLUtils:Item($multivalue2,';',3))"></xsl:variable>
<xsl:variable name="sKeywords" select="a:propstat/a:prop/Keywords"></xsl:variable>
<xsl:variable name="sCourse" select="a:propstat/a:prop/Title" ></xsl:variable>


<div class='SearchIndentDIV'>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:if test="$valuecount2 > 0">
JavaScript:Open('<xsl:value-of select="$one"/>')
</xsl:if>
</xsl:attribute>
<xsl:attribute name="target"><xsl:text>_self</xsl:text>
</xsl:attribute>
<xsl:value-of select="$one"></xsl:value-of><br/>
</xsl:element>
</div>
<div class='SearchIndentDIV'>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:if test="$valuecount2 > 1">
JavaScript:Open('<xsl:value-of select="$two"/>')
</xsl:if>
</xsl:attribute>
<xsl:attribute name="target"><xsl:text>_self</xsl:text>
</xsl:attribute>
<xsl:value-of select="$two"></xsl:value-of><br/>
</xsl:element>
</div>
<div class='SearchIndentDIV'>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:if test="$valuecount2 > 2">
JavaScript:Open('<xsl:value-of select="$three"/>')
</xsl:if>
</xsl:attribute>
<xsl:attribute name="target"><xsl:text>_self</xsl:text>
</xsl:attribute>
<xsl:value-of select="$three"></xsl:value-of><br/>
</xsl:element>
</div>
<xsl:if test="$valuecount2 > 3">
<xsl:element name="a">
<xsl:attribute name="href">JavaScript:keyWordsPop('<xsl:value-of select="$sKeywords"/>', '<xsl:value-of select="$PageURL" />', '<xsl:value-of select="$sCourse" />')
</xsl:attribute>
<xsl:element name="p">
<xsl:attribute name="align">right</xsl:attribute>
<b><xsl:text>More... </xsl:text></b>
</xsl:element>
</xsl:element>
</xsl:if>
</td>
</xsl:element>
</xsl:template>


</xsl:stylesheet>

The two java functions that I am having problems passing international characters two are keyWordsPop and Open. Any help you can give me would be greatly appreciated.

Thanks.

Steve


_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com



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



Current Thread