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

RE: <xsl:attribute name="href"> formatting problem

Subject: RE: <xsl:attribute name="href"> formatting problem
From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx>
Date: Thu, 6 May 2004 11:54:17 -0700
xsl attribute name href
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(&quot;',$var1, '&quot;)')}">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(&#34;Fig.&nbsp;2&nbsp;Struktur ausw&auml;hlen&#34;)">Link</a>

Josh
-----Original Message-----
From: Bianca Poignee [mailto:bianca_p@xxxxxx]
Sent: Thursday, May 06, 2004 11:26 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  <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 &#160;
characters ("Fig.&#160;2&#160;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

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.