Even better...
<a href="#" onclick="alert('{$var1}')">Link</a>
-----Original Message-----
From: Josh Canfield
Sent: Thursday, May 06, 2004 11:54 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] <xsl:attribute name="href"> formatting problem
I would guess that the html serializer is smart enough to know that you can't
have an umlaut in a URL, but not smart enough to detect that you are in a
javascript function (just a guess).
I would suggest using the onclick attribute, and setting the href to #
Something like:
<a href="#" onclick="{concat('myFunc("',$var1, '")')}">Link</a>
or if you prefer
<xsl:element name="a">
<xsl:attribute name="href">#</xsl:attribute>
<xsl:attribute name="onclick">myFunc("<xsl:value-of
select="$var1"/>"</xsl:attribute>Link</xsl:element>
which both generate:
<a href="#" onclick="myFunc("Fig. 2 Struktur
auswählen")">Link</a>
Josh
-----Original Message-----
From: Bianca Poignee [mailto:bianca_p(_at_)gmx(_dot_)at]
Sent: Thursday, May 06, 2004 11:26 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] <xsl:attribute name="href"> formatting problem
I have a weird formatting problem with my XSL script output... :-(
I am using MSXML 4.0 and >IE5.5.
My script should generate an anchor with a call to a javascript function
that needs a string parameter.
<xsl:element name="a"><xsl:attribute
name="href">javascript:myFunc('<xsl:value-of
select="$var1"/>')</xsl:attribute>Link</xsl:element>
The current value of var1 contains the german umlaut for "a" and some  
characters ("Fig. 2 Struktur ausw#a#hlen" where the #a# is the
german umlaut)
If I do the transformation like written above, my result is as follows:
Fig.%C2%A01%C2%A0Struktur ausw%C3%A4hlen
BUT! If I use a different attribute name (like "test" instead of "href"),
then my string doesn't get formattet like this, but the result is:
Fig. 1 Struktur ausw#a#hlen
How can I reach a formatting that doesn't come with "%C2%A0" and all that
stuff when using "href"? My javascript would need to decode all of them
manually otherwise.. ;-)
Thanks for any help,
Bianca from Germany
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--